client-py
client-py copied to clipboard
Search Patient by Identifier (MRN or else)
Hi all,
I can perform the query supplying the MRN identifier system code as below, but that doesn't seem the way to do it. Is there a better more elegant way?
from fhirclient import client
from fhirclient.models.patient import Patient as FHIRPatient
settings = {
"app_id": "NOT_USED_YET",
"api_base": "https://fhir-open.cerner.com/r4/ec2458f2-1e24-41c8-b71b-0e701af7583d"
}
def get_patient_by_mrn(mrn):
smart = client.FHIRClient(settings=settings)
query = FHIRPatient.where(struct={
'identifier': 'urn:oid:2.16.840.1.113883.6.1000|%s' % mrn
})
try:
resources = query.perform_resources(smart.server)
except Exception as ex:
print(str(ex))
Thanks for the great work, I'm willing to contribute