This document illustrates the relationships between commonly-used constellations of FHIR resources.

Medication Structures

The structures described below are represented in the FHIR Logical table format.

This schemas in this Primer are available in FHIR Logical Tables and Shape Expressions Compact Syntax (ShExC).

View as: Logical Table (press 'l') or ShExC (press 'c') .

MedicationOrder

NameType
✉ MedicationOrder DomainResource
├⧆ identifier Identifier*
├▭ status code?
├? medication[x] 1
│├⧆ medicationCodeableConcept CodeableConcept
│└☞ medicationReference Reference(Medication)
├☞ patient Reference(Patient)?
├☞ encounter Reference(Encounter)?
├▭ dateWritten dateTime?
├☞ prescriber Reference(Practitioner)?
├? reason[x] ?
│├⧆ reasonCodeableConcept CodeableConcept
│└☞ reasonReference Reference(Condition)
├▭ dateEnded dateTime?
├⧆ reasonEnded CodeableConcept?
├⧆ note Annotation*
├⧇ dosageInstruction BackboneElement*
│├▭ text string?
│├⧆ additionalInstructions CodeableConcept?
│├⧆ timing Timing?
│├? asNeeded[x] ?
││├▭ asNeededBoolean boolean
││└⧆ asNeededCodeableConcept CodeableConcept
│├? site[x] ?
││├⧆ siteCodeableConcept CodeableConcept
││└☞ siteReference Reference(BodySite)
│├⧆ route CodeableConcept?
│├⧆ method CodeableConcept?
│├? dose[x] ?
││├⧆ doseRange Range
││└⧆ doseQuantity SimpleQuantity
│├? rate[x] ?
││├⧆ rateRatio Ratio
││└⧆ rateRange Range
│└⧆ maxDosePerPeriod Ratio?
├⧇ dispenseRequest BackboneElement?
│├? medication[x] ?
││├⧆ medicationCodeableConcept CodeableConcept
││└☞ medicationReferenceReference(Medication)
│├⧆ validityPeriod Period?
│├▭ numberOfRepeatsAllowed positiveInt?
│├⧆ quantity SimpleQuantity?
│└⧆ expectedSupplyDuration Duration?
├⧇ substitution BackboneElement?
│├⧆ type CodeableConcept1
│└⧆ reason CodeableConcept?
└☞ priorPrescription Reference(MedicationOrder)?
PREFIX : <http://hl7.org/fhir/MedicationOrder.>
<MedicationOrder> {
  a                                   [fhir:MedicationOrder]?,
  :identifier                           @<Identifier>*,
  :status                               @<code>?,
  ( :medicationCodeableConcept          @<CodeableConcept> |
    :medicationReference { fhir:reference @<Medication> }
  ),
  :patient             { fhir:reference @<Patient> }?,
  :encounter           { fhir:reference @<Encounter> }?,
  :dateWritten                          $<dateTime>?,
  :prescriber          { fhir:reference @<Practitioner> }?,
  ( :reasonCodeableConcept              @<CodeableConcept> |
    :reasonReference   { fhir:reference @<Condition> }
  )?,
  :dateEnded                            $<dateTime>?,
  :reasonEnded                          @<CodeableConcept>?,
  :note                                 @<Annotation>*,
  :dosageInstruction {
    :dosageInstruction.text             @<string>?,
    :dosageInstruction.additionalInstructions
                                        @<CodeableConcept>?,
    :dosageInstruction.timing           @<Timing>?,
    ( :dosageInstruction.asNeededBoolean
                                        @<boolean> |
      :dosageInstruction.asNeededCodeableConcept
                                        @<CodeableConcept>
    )?,
    ( :dosageInstruction.siteCodeableConcept
                                        @<CodeableConcept>,
      :dosageInstruction.siteReference
                       { fhir:reference @<BodySite> }
    )?,
    :dosageInstruction.route            @<CodeableConcept>?,
    :dosageInstruction.method           @<CodeableConcept>?,
    ( :dosageInstruction.doseRange      @<Range> |
      :dosageInstruction.doseQuantity   @<SimpleQuantity>
    )?,
    ( :dosageInstruction.rateRatio      @<Ratio> |
      :dosageInstruction.rateRange      @<Range>
    )?,
    :dosageInstruction.maxDosePerPeriod @<Ratio>?
  },
  :dispenseRequest {
    ( :dispenseRequest.medicationCodeableConcept
                                        @<CodeableConcept> |
      :dispenseRequest.medicationReference
                       { fhir:reference @<Medication> }
    )?,
    :dispenseRequest.validityPeriod     @<Period>?,
    :dispenseRequest.numberOfRepeatsAllowed fhir:positiveInt?,
    :dispenseRequest.quantity           @<SimpleQuantity>?,
    :dispenseRequest.expectedSupplyDuration @<Duration>?
  }?,
  :substitution {
    :substitution.type                  @<CodeableConcept>,
    :substitution.reason                @<CodeableConcept>?
  }?,
  :priorPrescription
                       { fhir:reference @<MedicationOrder> }?
}

MedicationDispense

NameType
✉ MedicationDispense DomainResource
├⧆ identifier Identifier?
├▭ status code?
├? medication[x] 1
│├⧆ medicationCodeableConcept CodeableConcept
│└☞ medicationReference Reference(Medication)
├☞ patient Reference(Patient)?
├☞ dispenser Reference(Practitioner)?
├☞ authorizingPrescription Reference(MedicationOrder)*
├⧆ type CodeableConcept?
├⧆ quantity SimpleQuantity?
├⧆ daysSupply SimpleQuantity?
├▭ whenPrepared dateTime?
├▭ whenHandedOver dateTime?
├☞ destination Reference(Location)?
├☞ receiver Reference(Patient | Practitioner)*
├⧆ note Annotation*
├⧇ dosageInstruction BackboneElement*
│├▭ text string?
│├⧆ additionalInstructions CodeableConcept?
│├⧆ timing Timing?
│├? asNeeded[x] ?
││├▭ asNeededBoolean boolean
││└⧆ asNeededCodeableConcept CodeableConcept
│├? site[x] ?
││├⧆ siteCodeableConcept CodeableConcept
││└☞ siteReference Reference(BodySite)
│├⧆ route CodeableConcept?
│├⧆ method CodeableConcept?
│├? dose[x] ?
││├⧆ doseRange Range
││└⧆ doseQuantity SimpleQuantity
│├? rate[x] ?
││├⧆ rateRatio Ratio
││└⧆ rateRange Range
│└⧆ maxDosePerPeriod Ratio?
└⧇ substitution BackboneElement?
 ├⧆ type CodeableConcept1
 ├⧆ reason CodeableConcept*
 └☞ responsibleParty Reference(Practitioner)*
PREFIX : <http://hl7.org/fhir/MedicationDispense.>
<MedicationDispense> {
  a                                  [fhir:MedicationDispense]?,
  :identifier                             @<Identifier>?,
  :status                                 @<code>?,
  ( :medicationCodeableConcept            @<CodeableConcept> |
    :medicationReference { fhir:reference @<Medication> }
  ),
  :patient               { fhir:reference @<Patient> }?,
  :dispenser             { fhir:reference @<Practitioner> }?,
  :authorizingPrescription
                         { fhir:reference @<MedicationOrder> }*,
  :type                                   @<CodeableConcept>?,
  :quantity                               @<SimpleQuantity>?,
  :daysSupply                             @<SimpleQuantity>?,
  :whenPrepared                           $<dateTime>?,
  :whenHandedOver                         $<dateTime>?,
  :destination           { fhir:reference @<Location> }?,
  :receiver              { fhir:reference @<Patient> } OR
                         { fhir:reference @<Practitioner> }*,
  :note                                   @<Annotation>*,
  :dosageInstruction {
    :dosageInstruction.text               @<string>?,
    :dosageInstruction.additionalInstructions
                                          @<CodeableConcept>?,
    :dosageInstruction.timing             @<Timing>?,
    ( :dosageInstruction.asNeededBoolean  @<boolean> |
      :dosageInstruction.asNeededCodeableConcept
                                          @<CodeableConcept>
    )?,
    ( :dosageInstruction.siteCodeableConcept
                                          @<CodeableConcept> |
      :dosageInstruction.siteReference
                         { fhir:reference @<BodySite> }
    )?,
    :dosageInstruction.route              @<CodeableConcept>?,
    :dosageInstruction.method             @<CodeableConcept>?,
    ( :dosageInstruction.doseRange        @<Range> |
      :dosageInstruction.doseQuantity     @<SimpleQuantity>
    )?,
    ( :dosageInstruction.rateRatio        @<Ratio> |
      :dosageInstruction.rateRange        @<Range>
    )?,
    :dosageInstruction.maxDosePerPeriod   @<Ratio>?
  }*,
  :substitution {
    :substitution.type                    @<CodeableConcept>,
    :substitution.reason                  @<CodeableConcept>*,
    :substitution.responsibleParty
                         { fhir:reference @<Practitioner> }*
  }?
}

Range

NameType
⧇ Range Element
├⧆ low SimpleQuantity?
└⧆ high SimpleQuantity?
PREFIX : <http://hl7.org/fhir/Range.>
<Range> {
  a         [fhir:Range]?,
  :low      @<SimpleQuantity>?,
  :high     @<SimpleQuantity>?
}

Medication

NameType
✉ Medication DomainResource
├⧆ code CodeableConcept?
├▭ isBrand boolean?
├☞ manufacturer Reference(Organization)?
├⧇ product BackboneElement?
│├⧆ form CodeableConcept?
│├⧇ ingredient BackboneElement*
││├☞ item Reference(Substance | Medication)1
││└⧆ amount Ratio?
│└⧇ batch BackboneElement*
│ ├▭ lotNumber string?
│ └▭ expirationDate dateTime?
└⧇ package BackboneElement?
 ├⧆ container CodeableConcept?
 └⧇ content BackboneElement*
  ├☞ item Reference(Medication)1
  └⧆ amount SimpleQuantity?
PREFIX : <http://hl7.org/fhir/Medication.>
<Medication> {
  a                               [fhir:Medication]?,
  :code                           @<CodeableConcept>?,
  :isBrand                        @<boolean>?,
  :manufacturer  { fhir:reference @<Organization> }?,
  :product {
    :product.form                 @<CodeableConcept>?,
    :product.ingredient {
      :product.ingredient.item
                 { fhir:reference @<Substance> } OR
                 { fhir:reference @<Medication> },
      :product.ingredient.amount  @<Ratio>
    }*,
    :product.batch {
      :product.batch.lotNumber    @<string>?,
      :product.batch.expirationDate $<dateTime>?
    }*
  }?,
  :package {
    :package.container            @<CodeableConcept>?,
    :package.content {
      :package.content.item
                 { fhir:reference @<Medication> },
      :package.content.amount     @<SimpleQuantity>?
    }*
  }?
}

Timing

NameType
⧇ Timing Element
├▭ event dateTime*
├⧇ repeat Element?
│├? bounds[x] ?
││├⧆ boundsQuantity Duration
││├⧆ boundsRange Range
││└⧆ boundsPeriod Period
│├▭ count integer?
│├▭ duration decimal?
│├▭ durationMax decimal?
│├▭ durationUnits code?
│├▭ frequency integer?
│├▭ frequencyMax integer?
│├▭ period decimal?
│├▭ periodMax decimal?
│├▭ periodUnits code?
│└▭ when code?
└⧆ code CodeableConcept?
PREFIX : <http://hl7.org/fhir/Timing.>
<Timing> {
  a                          [fhir:Timing]?,
  :event                     $<dateTime>*,
  :repeat {
    ( :repeat.boundsQuantity @<Duration> |
      :repeat.boundsRange    @<Range> |
      :repeat.boundsPeriod   @<Period>
    )?,
    :repeat.count            @<int>?,
    :repeat.duration         @<decimal>?,
    :repeat.durationMax      @<decimal>?,
    :repeat.durationUnits    @<code>?,
    :repeat.frequency        @<int>?,
    :repeat.frequencyMax     @<int>?,
    :repeat.period           @<decimal>?,
    :repeat.periodMax        @<decimal>?,
    :repeat.periodUnits      @<code>?,
    :repeat.when             @<code>?
  }?,
  :code                      @<CodeableConcept>?
}

Ratio

NameType
⧇ Ratio Element
├⧆ numerator Quantity?
└⧆ denominator Quantity?
PREFIX : <http://hl7.org/fhir/Ratio.>
<Ratio> {
  a                [fhir:Ratio]?,
  :numerator       @<Quantity>?,
  :denominator     @<Quantity>?
}

Turtle Example

Collapse nested structures
PREFIX fhir: <http://hl7.org/fhir/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<MedicationOrder/12345-67> a fhir:MedicationOrder;
   fhir:MedicationOrder.identifier   [ 
      a fhir:Identifier;
      fhir:Identifier.use    [ fhir:value "usual" ];
      fhir:Identifier.system [ fhir:value "http://myorg.example/prescriptions/" ];
      fhir:Identifier.value  [ fhir:value "12345-67" ];
   ];
   fhir:MedicationOrder.status       [ fhir:value "completed" ];
   fhir:MedicationOrder.medicationCodeableConcept _:med1;
   fhir:MedicationOrder.patient      [ fhir:reference <Patient/12345> ];
   fhir:MedicationOrder.dateWritten  "2000-11-21T15:00:00"^^xsd:dateTime ;
   fhir:MedicationOrder.prescriber   [ fhir:reference <Practitioner/98765> ];
   fhir:MedicationOrder.dateEnded    "2000-11-21"^^xsd:date ;
   fhir:MedicationOrder.dosageInstruction [
      fhir:MedicationOrder.dosageInstruction.text [ fhir:value "T1 TAB PO QID FW" ];
      fhir:MedicationOrder.dosageInstruction.timing
[
   a fhir:Timing;
   fhir:Timing.repeat [                                          # sig "QID"
     fhir:Timing.repeat.duration    [ fhir:value "1"^^xsd:decimal ];
     fhir:Timing.repeat.frequency   [ fhir:value "4"^^xsd:int ];
     fhir:Timing.repeat.periodUnits [ fhir:value "d" ]
   ]
] ;
      fhir:MedicationOrder.dosageInstruction.asNeededBoolean [ fhir:value true ];
      fhir:MedicationOrder.dosageInstruction.route        [ 
         a fhir:CodeableConcept;                                           # sig "PO"
         fhir:CodeableConcept.coding [ 
            a fhir:Coding;
            fhir:Coding.system  [ fhir:value "http://snomed.info/sct" ];
            fhir:Coding.code    [ fhir:value "394899003" ];
            fhir:Coding.display [ fhir:value "oral administration of treatment" ]
          ]
       ];
      fhir:MedicationOrder.dosageInstruction.doseQuantity [ fhir:value 1 ] # sig "T1"
   ];
.
<MedicationDispense/12345-67-89> a fhir:MedicationDispense;
   fhir:MedicationDispense.identifier     [ 
      a fhir:Identifier;
      fhir:Identifier.use    [ fhir:value "usual" ];
      fhir:Identifier.system [ fhir:value "http://myorg.example/pickups" ];
      fhir:Identifier.value  [ fhir:value "12345-67-89" ];
    ];
   fhir:MedicationDispense.status         [ fhir:value "completed" ];
   fhir:MedicationDispense.medicationCodeableConcept _:med1;
   fhir:MedicationDispense.patient        [ fhir:reference <Patient/12345> ];
   fhir:MedicationDispense.dispenser      [ fhir:reference <Practitioner/98765> ];
   fhir:MedicationDispense.authorizingPrescription
                                          [ fhir:reference <MedicationOrder/12345-67> ];
   fhir:MedicationDispense.type           [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [ 
         a fhir:Coding;
         fhir:Coding.system  [ fhir:value "http:hl7.org/fhir" ];
         fhir:Coding.code    [ fhir:value "FFP" ];
         fhir:Coding.display [ fhir:value "First Fill - Part Fill" ];
       ];
    ];
   fhir:MedicationDispense.quantity       [ 
      a fhir:Quantity;
      fhir:Quantity.value  [ fhir:value 60.0 ];
      fhir:Quantity.system [ fhir:value "http://unitsofmeasure.org" ];
      fhir:Quantity.code   [ fhir:value "tbl" ]
    ];
   fhir:MedicationDispense.whenHandedOver "2000-11-21T15:00:00"^^xsd:dateTime ;
.
_:med1 a fhir:Medication;
   fhir:Medication.code [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [ 
         a fhir:Coding;
         fhir:Coding.system  [ fhir:value "http://myorg.example/medications/" ];
         fhir:Coding.code    [ fhir:value "8252-50580049660" ];
         fhir:Coding.display [ fhir:value "ACETAMINOPHEN" ]
       ]
    ];
   fhir:Medication.code [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [
         a fhir:Coding;
         fhir:Coding.system  [ fhir:value "http://hl7.org/fhir/sid/ndc" ];
         fhir:Coding.code    [ fhir:value "50580049660" ];
         fhir:Coding.display [ fhir:value "TYLENOL 325 MG TABLET" ]
      ]
     ]
.
<Patient/12345> a fhir:Patient;
   fhir:Patient.identifier      [ 
      a fhir:Identifier;
      fhir:Identifier.system    [ fhir:value "http://myorg.example/patients/" ];
      fhir:Identifier.value     [ fhir:value "12345" ];
    ];
   fhir:Patient.name            [ 
      a fhir:HumanName;
      fhir:HumanName.family     [ fhir:value "Patient" ];
      fhir:HumanName.given      [ fhir:value "Peter" ];
    ];
   fhir:Patient.gender          [ fhir:value "male" ];
   fhir:Patient.birthDate       [ fhir:value "1966-11-08" ];
   fhir:Patient.active          [ fhir:value true ];
.
<Practitioner/98765> a fhir:Practitioner;
   fhir:Practitioner.identifier [ 
      a fhir:Identifier;
      fhir:Identifier.use       [ fhir:value "usual" ];
      fhir:Identifier.type      [
         a fhir:CodeableConcept;
         fhir:CodeableConcept.coding [ 
            a fhir:Coding;
            fhir:Coding.system  [ fhir:value "http://hl7.org/fhir/v2/0203" ];
            fhir:Coding.code    [ fhir:value "MR" ]; # medical record number
         ]
      ];
      fhir:Identifier.system    [ fhir:value "http://myorg.example/staff/" ];
      fhir:Identifier.value     [ fhir:value "98765" ];
   ];
   fhir:Practitioner.name       [ 
      a fhir:HumanName;
      fhir:HumanName.family     [ fhir:value "Whitman" ];
      fhir:HumanName.given      [ fhir:value "Walt" ];
  ];
.

Lab Structures

Turtle Example

<DiagnosticOrder/12345-68> a fhir:DiagnosticOrder;
   fhir:DiagnosticOrder.identifier  [ 
      a fhir:Identifier;
      fhir:Identifier.use [
          fhir:value "usual" ];
      fhir:Identifier.system [
          fhir:value "http://myorg.example/LabOrders/" ];
      fhir:Identifier.value [
          fhir:value "12345-68" ];
    ];
   fhir:DiagnosticOrder.subject     [ fhir:reference <Patient/12345> ];
   fhir:DiagnosticOrder.orderer     [ fhir:reference <Practitioner/98765> ];
   fhir:DiagnosticOrder.specimen    [ fhir:reference 
[
   a fhir:Specimen;
   fhir:Specimen.status       [ fhir:value "available" ];
   fhir:Specimen.type         [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://hl7.org/fhir/ValueSet/v2-0487"
         ];
         fhir:Coding.code     [ fhir:value "SER" ];
         fhir:Coding.display  [ fhir:value "Serum" ]
      ], [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://snomed.info/sct"
         ];
         fhir:Coding.code     [ fhir:value "119364003" ];
         fhir:Coding.display  [ fhir:value "Serum specimen" ]
      ]
   ];
   fhir:Specimen.subject      [ fhir:reference <Patient/12345> ];
   fhir:Specimen.receivedTime [ fhir:value "1988-11-01T14:15:00" ];
   fhir:Specimen.container [
      fhir:Specimen.container.type [ 
         a fhir:CodeableConcept;
         fhir:CodeableConcept.coding [
            a fhir:Coding;
            fhir:Coding.system  [ fhir:value "http://cmumps.example/" ];
            fhir:Coding.code    [ fhir:value "62-319" ];
            fhir:Coding.display [ fhir:value "HIV TUBE" ]
         ]
      ]
   ]
]
   ];
   fhir:DiagnosticOrder.item [
      fhir:DiagnosticOrder.item.code [ 
         a fhir:CodeableConcept;
         fhir:CodeableConcept.coding [
            a fhir:Coding;
            fhir:Coding.system [
               fhir:value "http://myorg.example/LabTests/"
            ];
            fhir:Coding.code        [ fhir:value "60-4220" ];
            fhir:Coding.display     [ fhir:value "HIV-1 AB" ]
         ], [
            a fhir:Coding;
            fhir:Coding.system [
               fhir:value "http://myorg.example/LabMethods/"
            ];
            fhir:Coding.code        [ fhir:value "8710-2972" ];
            fhir:Coding.display [
               fhir:value "HIV INTEROPERABILITY (01JAN90)"
            ]
         ]
      ]
   ]
.
<DiagnosticReport/12345-68-001> a fhir:DiagnosticReport;
   fhir:DiagnosticReport.identifier [ 
      a fhir:Identifier;
      fhir:Identifier.use [
          fhir:value "usual" ];
      fhir:Identifier.system [
          fhir:value "http://myorg.example/LabReports/" ];
      fhir:Identifier.value [
          fhir:value "12345-68-001" ];
    ];
   fhir:DiagnosticReport.status     [ fhir:value "final" ];
   fhir:DiagnosticReport.code       [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://myorg.example/LabTests/"
         ];
         fhir:Coding.code [ fhir:value "60-4220" ];
         fhir:Coding.display [ fhir:value "HIV-1 AB" ]
      ], [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://myorg.example/LabMethods/"
         ];
         fhir:Coding.code [ fhir:value "8710-2972" ];
         fhir:Coding.display [
            fhir:value "HIV INTEROPERABILITY (01JAN90)"
         ]
      ]
   ];
   fhir:DiagnosticReport.subject    [ fhir:reference <Patient/12345> ];
   fhir:DiagnosticReport.effectiveDateTime
                                    [ fhir:value "1988-11-08T09:00:00Z" ];
   fhir:DiagnosticReport.issued     [ fhir:value "1988-11-08T09:00:00Z" ];
   fhir:DiagnosticReport.request    [ fhir:reference <DiagnosticOrder/12345-68> ];
   fhir:DiagnosticReport.result     [ fhir:reference 
[
   a fhir:Observation;
   fhir:Observation.code [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [ 
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://myorg.example/LabResults/"
         ];
         fhir:Coding.code [ fhir:value "Negative" ]
       ]
    ]
]
   ]
.
<Condition/12345-68-001> a fhir:Condition;
   fhir:Condition.subject    [ fhir:reference <Patient/12345> ];
   fhir:Condition.code       [ 
      a fhir:CodeableConcept;
      fhir:CodeableConcept.coding [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://myorg.example/LabTests/"
         ];
         fhir:Coding.code [ fhir:value "60-4220" ];
         fhir:Coding.display [ fhir:value "HIV-1 AB" ]
      ], [
         a fhir:Coding;
         fhir:Coding.system [
            fhir:value "http://myorg.example/LabMethods/"
         ];
         fhir:Coding.code [ fhir:value "8710-2972" ];
         fhir:Coding.display [
            fhir:value "HIV INTEROPERABILITY (01JAN90)"
         ]
      ]
   ];
   fhir:Condition.verificationStatus 
                             [ fhir:value "refuted" ];
   fhir:Condition.evidence [
      fhir:Condition.evidence.detail
                             [ fhir:reference <DiagnosticReport/12345-68-001> ]
   ]
.