Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Patient by Identifier (MRN or else) #116

Open
ducu opened this issue Mar 25, 2022 · 0 comments
Open

Search Patient by Identifier (MRN or else) #116

ducu opened this issue Mar 25, 2022 · 0 comments

Comments

@ducu
Copy link
Collaborator

ducu commented Mar 25, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant