nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
372 stars 104 forks source link

contact.telecom.extension.valueUrl does not validate phone number values #62

Closed lee-hyunkyu closed 3 years ago

lee-hyunkyu commented 3 years ago

Description

I'm trying to construct a Patient resource after fetching it via a FHIR call.

What I Did

I fetched some data and tried to construct it using the Patient model class.

The contact field for the resulting patient information was

"contact": [
    {
        "relationship": [{ /* a relationship object */}],
        "name": { /* a name object */ },
        "telecom": [{
            "extension": [{
                "valueUrl": "(123)123-1234",
                "url": "http://hl7.org/fhir/StructureDefinition/iso21090-TEL-address"
            }],
            /* rest of the telecom object*/
        }]
    }],
contact -> 0 -> telecom -> 0 -> extension -> 0 -> valueUrl
invalid or missing URL scheme (type=value_error.url.scheme)

The url rfc defines that parenthesis are not valid so the sender seems to be at fault. Is there any way for me to continue to use the library to construct this Patient resource and specifically ignore validating this field?

nazrulworld commented 3 years ago

One solution could be if possible change valueUrl to valueString. But it is not possible to turn that validation off.

lee-hyunkyu commented 3 years ago

Unfortunately that's not possible. Going to close the issue since we found a workaround