Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a test to handle DIF10 records from NPI #236

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Added a test to handle DIF10 records from NPI #236

merged 2 commits into from
Jan 17, 2024

Conversation

steingod
Copy link
Collaborator

NPI releases DIF10 records with an appearance like:
'''
<Metadata_Dates>
<Metadata_Creation>2023-12-04T17:11:12Z</Metadata_Creation>
<Metadata_Last_Revision>Not provided</Metadata_Last_Revision>
<Data_Creation>Not provided</Data_Creation>
<Data_Last_Revision>Not provided</Data_Last_Revision>
</Metadata_Dates>
'''
This cause issues on ingestion side for MMD records which have dates of type "Not provided". A hack to prevent such strings to pass through has been added. Full datetime validation would be easier with XSLT 2, but for now we are using XSLT 1.

@steingod steingod self-assigned this Jan 15, 2024
@ferrighi
Copy link
Collaborator

I've tested the modifications, but this is not extracting the fields when it is a datetime element (the string is not of length 8). Since dif 10 supports a controlled vocabulary for Metadata_Last_Revision (and in principle also for other datetime fields) I have 2 suggestions:

  • exclude the valid vocabulary entries:
    <xsl:if test="$datetimestr != 'Not provided' and $datetimestr !='unknown' and $datetimestr !='present' and $datetimestr !='unbounded' and $datetimestr !='future'">
  • make sure there are numbers in the string:
    <xsl:if test="translate($datetimestr, '1234567890', '') != $datetimestr">

I've tested both and they seem to work. I can implement and push to this branch if you have any preference.

@steingod
Copy link
Collaborator Author

steingod commented Jan 17, 2024 via email

@ferrighi
Copy link
Collaborator

I've added the filtering of strings, and left the bit redundant check on the presence of number. It should create a valid mmd if datetime is provided.

@ferrighi ferrighi merged commit 674919f into master Jan 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants