nazrulworld / fhir.resources

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

element of type url ValidationError when relative reference #100

Closed Healthedata1 closed 2 years ago

Healthedata1 commented 2 years ago

Description

for an element of type url this error came up

File ~/.pyenv/versions/3.10.2/envs/jupyter/lib/python3.10/site-packages/pydantic/main.py:331, in pydantic.main.BaseModel.init()

ValidationError: 1 validation error for BundleEntry resource -> content -> 0 -> attachment -> url invalid or missing URL scheme (type=value_error.url.scheme)

here is the DocumentReferencesniippet that raises this error:

...
"content": [
    {
      "attachment": {
        "contentType": "text/plain",
        "url": "/Binary/1-note",
        "title": "Uri where the data can be found: [base]/Binary/1-note"
      },
      "format": {
        "system": "urn:oid:1.3.6.1.4.1.19376.1.2.3",
        "code": "urn:hl7-org:sdwg:ccda-structuredBody:2.1",
        "display": "Documents following C-CDA constraints using a structured body"
      }
    }
  ],
...

however Under Attachments, the following (see statement in bold) re interpreting as relative reference is acceptable

The actual content of an Attachment can be conveyed directly using the data element or a URL reference can be provided. If both are provided, the reference SHALL point to the same content as found in the data. The reference can never be reused to point to some different data (i.e. the reference is version specific). The URL reference SHALL point to a location that resolves to actual data; some URIs such as cid: meet this requirement. **If the URL is a relative reference, it is interpreted in the same way as a resource reference.***

What I Did

see fhir chat :https://chat.fhir.org/#narrow/stream/179166-implementers/topic/DocumentReference.20and.20Binary/near/280661226

nazrulworld commented 2 years ago

@Healthedata1 I will look into it.

nazrulworld commented 2 years ago

Fixes in this commit https://github.com/nazrulworld/fhir.resources/commit/4e6415898b68b2895c7056bc88deadeeaa050092