Open gitpushdashf opened 3 years ago
Hi, @gitpushdashf thanks for your interest in this project. Can you please add the problem with the details, perhaps with an example?
//I tried Resource, but it doesn't seem to automatically map the resource.// you mean fhir.resources.resource.Resource
?
We're wanting to make sure the FHIR that developer write is valid. We have some fields that can be any JSON FHIR, whether MedicationRequest or Bundle. So we load the JSON into a dict, and then try to process it. However, we don't know in advance if it might be a MedicationRequest, Bundle, etc. We just want to raise an error if it's invalid.
We've been using jsonschema for this, but the error messages are terrible. These are much easier to read.
Yes, that's right. I meant fhir.resources.resource.Resource
.
Ok, here's what I came up with:
from fhir.resources import construct_fhir_element
construct_fhir_element(resource["resourceType"], resource)
Piggybacking off of #76.
Hi,
I'd like to validate any type of FHIR dictionary. Whether a Bundle, MedicationRequest, etc. I just want to know that it's valid FHIR.
So far I have:
Which works great for bundles. I tried Resource, but it doesn't seem to automatically map the resource.
Is this possible with fhir.resources, or easily atainable? I like the error messages a lot more than JSON Schema.
Thank you!