Closed sbwhitney closed 3 years ago
@nazrulworld I can make a PR request to update this line:
But would you want to update for all FHIR versions?
^[A-Za-z0-9\-_.]+$
would be the new regex. Also, would I branch off master?
Edit: I receive forbidden error when trying to push new branch to remote:
remote: Permission to nazrulworld/fhir.resources.git denied to sbwhitney. fatal: unable to access 'https://github.com/nazrulworld/fhir.resources.git/': The requested URL returned error: 403
Update: I can see that the regex is configurable. https://github.com/nazrulworld/fhir.resources#resourceid-aka-fhirtypesid-constraint-extensibility
First of all @sbwhitney thanks a lot for this issue.
If you look at FHIR specification https://www.hl7.org/fhir/datatypes.html#id by default underscore (_) is not allowed. So the default behavior is regex = re.compile(r"^[A-Za-z0-9\-.]+$")
(should be if your system communicate to other system)
But it is possible to override this behavior. https://github.com/nazrulworld/fhir.resources#resourceid-aka-fhirtypesid-constraint-extensibility
>>> from fhir.resources.fhirtypes import Id
>>> Id.configure_constraints(regex=re.compile(r"^[A-Za-z0-9\-_.]+$"))
For PR.
Thanks for the info @nazrulworld. Much appreciated. No PR necessary as underscore (_) is disallowed.
Description
If resource.id element has an underscore, validation fails
What I Did
pydantic.error_wrappers.ValidationError: 1 validation error for Patient id string does not match regex "^[A-Za-z0-9-.]+$" (type=value_error.str.regex; pattern=^[A-Za-z0-9-.]+$)