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

Make fhir primitive element field optional if extension value is provided. #40

Closed nazrulworld closed 3 years ago

nazrulworld commented 3 years ago

https://www.hl7.org/fhir/extensibility.html#Special-Case

Certainly SMART doesn't impose any limits on how FHIR JSON works -- it sounds like there's some question about how FHIR treats extensions that are present in place of required elements. https://www.hl7.org/fhir/extensibility.html#Special-Case provides the official guidance to corroborate @Md Nazrul Islam's note above that "Maybe... when _intent value is provided then the intent field should be optional." -- indeed, required elements can be missing if extensions are provided.

https://chat.fhir.org/#narrow/stream/179218-python/topic/JSON.20representation.20of.20primitive.20elements.20%28validation%29/near/214834853

@Md Nazrul Islam I tested with beta 6.x.x version and this doesn't pass validation:

"_intent": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason", "valueCode": "unknown" } ] },

Am I doing something wrong?

pydantic.error_wrappers.ValidationError: 1 validation error for MedicationRequest intent field required (type=value_error.missing)


https://chat.fhir.org/#narrow/stream/179218-python/topic/JSON.20representation.20of.20primitive.20elements.20%28validation%29/near/214840441

@_Stephen Whitney|269724 said:

I see thanks @**Md Nazrul Islam**. It passes validation using open hapi fhir server as written at http://hapi.fhir.org/baseR4/Bundle/$validate

Ok, that is something a little bit long discussion need to be done. Maybe there should be when _intent value is provided then the intent field should be optional.

sbwhitney commented 3 years ago

Impressive turnaround time. Thank you @nazrulworld. 👍