fhir-works-on-aws-deployment icon indicating copy to clipboard operation
fhir-works-on-aws-deployment copied to clipboard

Query Observation resourceTypes based on PatientId as reference

Open vcareit opened this issue 2 years ago • 1 comments

What's on your mind? I have registered Patient. Once the patient is successfully created I have the Patient Id. I then create an Observation with a reference to the patient. Since Observation uuid saved in dynamo DB is created at runtime. How can I query the observation when I only know the PatientId ? Below is the sample json for an observation where in my app I only know the id which is a reference '542a1e76'.

My question is how can I query and get this json as response if I only know the Patient reference and not the Observation id ?

url used: https://xxx.amazonaws.com/xxx/Observation/

{ "id": "471864a1-db65-4e8e-aab8-c548821fce52", "vid": 1, "basedOn": [], "category": [ { "coding": [ { "code": "vital-signs", "display": "Vital Signs", "system": "http://terminology.hl7.org/CodeSystem/observation-category" } ] } ], "code": { "coding": [ { "code": "87422-2", "display": "Glucose [Moles/volume] in Blood", "system": "http://loinc.org" } ] }, "derivedFrom": [ { "id": "542a1e76", "display": "Patient Name", "type": "http://vCare.dk" } ], "documentStatus": "AVAILABLE", "effectiveDateTime": "2022-07-31T18:53:00.000+02:00", "effectivePeriod": { "start": "2021-07-31T00:00:00.000+02:00" }, "encounter": { "reference": "encounter/OBSSG" }, "interpretation": [ { "coding": [ { "code": "VH", "display": "Very High", "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation" } ] } ], "issued": "2022-07-31T16:51:57.884490Z", "lockEndTs": 1659286349698, "meta": { "lastUpdated": "2022-07-31T16:52:29.698Z", "versionId": "1" }, "modifierExtension": [], "note": [], "performer": [ { "id": "542a1e76", "display": "Sweets", "type": "http://vCare.dk" }, { "id": "542a1e76", "display": "Overeating", "type": "http://vCare.dk" }, { "id": "542a1e76", "display": "Alcohol", "type": "http://vCare.dk" }, { "id": "542a1e76", "display": "Pain", "type": "http://vCare.dk" } ], "resourceType": "Observation", "status": "registered", "subject": { "reference": "542a1e76/OBSSG" }, "valueQuantity": { "id": "202207311851", "code": "mg/dl", "system": "http://unitsofmeasure.org", "unit": "mg/dl", "value": 315 }, "valueRange": { "id": "542a1e76", "extension": [], "high": { "id": "202207311851", "code": "mg/dl", "system": "http://unitsofmeasure.org", "unit": "mg/dl", "value": 200 }, "low": { "id": "202207311851", "code": "mg/dl", "system": "http://unitsofmeasure.org", "unit": "mg/dl", "value": 80 } }, "valueString": "Testing new ID", "_references": [ "542a1e76/OBSSG", "encounter/OBSSG" ] }

Versions (please complete the following information): I am using the latest release. I have tried to pass the below additional params to filter the results. I get in response all the results which are not even associated with the Patient reference.

var response = await http.get( url, headers: <String, String>{ 'Content-Type': 'application/json; charset=UTF-8', "endpointType": "REST", "region": "XXXX", "authorizationType": "AMAZON_COGNITO_USER_POOLS", 'Authorization': await _getIdToken(), 'resourceType': R4ResourceType.Observation.toString(), 'derived-from': '542a1e76', '_references': '542a1e76/OBSSG', }, );

vcareit avatar Jul 31 '22 22:07 vcareit

Hi @vcareit, if I am understanding correctly, you are trying to:

  1. Create a patient
  2. Create an Observation with a reference to the above Patient Resource
  3. Get the Observation resource by using the Patient id

Is that correct? If so, the id of the observation will be returned when it is created, so you can use that for future queries. Alternatively, you can try using the supported _revinclude search parameter to search for your Patient and include the observation in the results. An example query could be <API_URL>/Patient/542a1e76?_revinclude=Observation:subject.

Let me know if this helps!

ssvegaraju avatar Aug 04 '22 19:08 ssvegaraju

FHIR Works on AWS has been moved to maintenance mode. While in maintenance, we will not add any new features to this solution. All security issues should be reported directly to AWS Security at [[email protected]] (mailto:[email protected]). If you are new to this solution, we advise you to explore using [HealthLake] (https://aws.amazon.com/healthlake), which is our managed service for building FHIR based transactional and analytics applications. You can get started by contacting your AWS Account team. If you are an existing customer of FHIR Works on AWS, and have additional questions or need immediate help, please reach out to [email protected] or contact your AWS Account team.

nisankep avatar Apr 03 '23 22:04 nisankep