Add Person ORCID Organization ROR_ID#654
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
||
| from pydantic import AfterValidator | ||
|
|
||
| ORCID_REGEX = re.compile(r"^\d{4}-\d{4}-\d{4}-\d{4}$") |
There was a problem hiding this comment.
Looking at the specs, seems like valid ORCIDs may have an "X" character as well at the last position (checksum), see https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier.
Also, would be great if we could even check the checksum as additional after-validation.
There was a problem hiding this comment.
Fixed and added checksum validation
| from pydantic import AfterValidator | ||
|
|
||
| ORCID_REGEX = re.compile(r"^\d{4}-\d{4}-\d{4}-\d{4}$") | ||
| ROR_REGEX = re.compile(r"^0[a-z0-9]{8}$") |
There was a problem hiding this comment.
According to the specs, the regular expression to validate should be: ^0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2}$, see https://ror.readme.io/docs/identifier.
The last two digits are also a checksum which could be validated I suppose.
There was a problem hiding this comment.
Fixed and added checksum validation
|
Other than the comments above, LGTM. @chr-pok I can do the ORCID / ROR ID checks on obi-one side. |
Note that they will still be added here in the application layer. |
Sure, I guess the earlier we check the better. But I suppose if the user provides a wrong ORCID / ROR ID, you won't be able to fetch any metadata anyway. |
1fcc062 to
2f14841
Compare
Issue: openbraininstitute/obi-one#793