Stream: cda to fhir
Topic: AllergyIntolerance
Ilayaraja Mahalingam (May 23 2018 at 16:31):
Hi,
I am trying to assign Patient resource as inline reference to AllergyIntolerance.recorder but it is always coming as "Contained" resource.
Below is the sample code I am using,
org.hl7.fhir.dstu3.model.AllergyIntolerance allergyIntolerance = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); org.hl7.fhir.dstu3.model.Patient patient = new org.hl7.fhir.dstu3.model.Patient(); org.hl7.fhir.dstu3.model.Identifier identifier = new org.hl7.fhir.dstu3.model.Identifier(); org.hl7.fhir.dstu3.model.Reference reference = new org.hl7.fhir.dstu3.model.Reference(); identifier.setSystem("system"); identifier.setValue("value"); patient.addIdentifier(identifier); reference.setResource(patient); allergyIntolerance.setRecorder(reference); System.out.println("op:" + ca.uhn.fhir.context.FhirContext.forDstu3().newXmlParser().encodeResourceToString(allergyIntolerance));
_op:<AllergyIntolerance xmlns="http://hl7.org/fhir"><contained><Patient xmlns="http://hl7.org/fhir"><id value="1"/><identifier><system value="system"/><value value="value"/></identifier></Patient></contained><recorder><reference value="#1"/></recorder></AllergyIntolerance>_
Like said above, Patient resource is coming as contained resource in the above response, but my expected response is like below,
_<AllergyIntolerance xmlns="http://hl7.org/fhir"><recorder><Patient><identifier><system value="system"/><value value="value"/></identifier></Patient></recorder></AllergyIntolerance>_
Below are my maven dependencies for HAPI library,
**<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>1.5</version>
</dependency>**
Somebody can help me here?
Jean Duteau (May 23 2018 at 16:48):
Your response with the contained resource is correct. FHIR will never inline one resource inside of another. (And this shouldn't be in the #cda to fhir topic as it is not CDA-specific.)
Ilayaraja Mahalingam (May 25 2018 at 09:32):
Thanks Jean for your prompt response.
Ilayaraja Mahalingam (May 28 2018 at 02:19):
Thanks Jean for your prompt response.
Last updated: Apr 12 2022 at 19:14 UTC