Referencing FHIR Resources
The method by which other FHIR resources, e.g. Medication
or Patient
, are referenced within the MedicationRequest will be a local implementation decision.
There are three options;
- Referenced by URL to a FHIR Server
- Referenced by an identifier to a resource within the same FHIR Bundle
- Referenced by an identifier to a “contained” resource within the MedicationRequest resource
FHIR snippets using XML notation are as follows:
1. by URL to a FHIR server
Using references by URL is the recommended / target solution where FHIR servers are available. These may be future nationally available FHIR servers or locally implemented FHIR servers. When referencing by URL it is recommended that the reference.display
is populated with appropriate text as per the guidance within this document.
<MedicationRequest xmlns="http://hl7.org/fhir"> <subject> <reference value="https://acmefhirserver/patient/2245386903"/> <display value="Joe Bloggs"/> </subject> <medicationReference> <reference value="https://acmefhirserver/medication/87652004"/> <display value="Atenolol"/> </medicationReference> </MedicationRequest>
2. by identifier within the Bundle
Where a FHIR server is not available or not used within an implementation, the reference by identifier within the same Bundle is the next recommended implementation option.
<Bundle xmlns="http://hl7.org/fhir"> <entry> <fullUrl value="patient-2245386903"/> <resource> <Patient> <!-- patient details for Joe Bloggs --> </Patient> </resource> </entry> <entry> <fullUrl value="medication-87652004"/> <resource> <Medication> <!-- medication details for Atenolol --> </Medication> </resource> </entry> <entry> <resource> <MedicationRequest> <subject> <reference value="patient-2245386903"/> <display value="Joe Bloggs"/> </subject> <medicationReference> <reference value="medication-87652004"/> <display value="Atenolol"/> </medicationReference> </MedicationRequest> </resource> </entry> </Bundle>
3. by identifier to contained resource
The use of a contained FHIR resource should be the last option considered.
For resources like Patient
this could introduce duplication within the complete FHIR payload.
Resource .text
elements should not be populated when using contained resources. When resources are contained inside the MedicationRequest resource all text should be represented in the MedicationRequest.text
element, including data from contained resources. This would make the MedicationRequest.text
element a concatination of many string, likely unreadable and confusing.
<MedicationRequest xmlns="http://hl7.org/fhir"> <contained> <Patient> <id value="patient-2245386903"/> <!-- patient details for Joe Bloggs --> </Patient> </contained> <contained> <Medication> <id value="medication-87652004"/> <!-- medication details for Atenolol --> </Medication> </contained> <subject> <reference value="#patient-2245386903"/> <display value="Joe Bloggs"/> </subject> <medicationReference> <reference value="#medication-87652004"/> <display value="Atenolol"/> </<medicationReference> </MedicationRequest>