<?xml version="1.0" encoding="UTF-8"?>

<Observation xmlns="http://hl7.org/fhir">
  <id value="2minute-apgar-score"/>
  <contained>
    <Patient>
      <id value="newborn"/>
      <!--    MRN assigned by ACME healthcare on    -->
      <identifier>
        <system value="http://acmehealthcare/org/mrns"/>
        <value value="12345"/>
      </identifier>
      <active value="true"/>
      <!--    Peter James Chalmers    -->
      <name>
        <family value="Chalmers"/>
        <given value="Peter"/>
        <given value="James"/>
      </name>
      <!--    use FHIR code system for male / female    -->
      <gender value="male"/>
      <birthDate value="2016-05-18">
        <extension url="http://hl7.org/fhir/StructureDefinition/patient-birthTime">
          <valueDateTime value="2016-05-18T10:28:45Z"/>
        </extension>
      </birthDate>
    </Patient>
  </contained>
  <status value="final"/>
  <category>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/observation-category"/>
      <code value="survey"/>
      <display value="Survey"/>
    </coding>
    <text value="Survey"/>
  </category>
  <code>
    <coding>
      <system value="http://loinc.org"/>
      <code value="9273-4"/>
      <display value="2 minute Apgar Score"/>
    </coding>
    <text value="2 minute Apgar Score"/>
  </code>
  <subject>
    <reference value="#newborn"/>
  </subject>
  <effectiveDateTime value="2016-05-18T22:33:22Z"/>
  <performer>
    <reference value="Practitioner/example"/>
  </performer>
  <valueQuantity>
    <value value="5"/>
    <system value="http://unitsofmeasure.org"/>
    <code value="{score}"/>
  </valueQuantity>
  <component>
    <code>
      <coding>
        <system value="http://snomed.info/sct"/>
        <code value="249227004"/>
        <display value="Apgar color score"/>
      </coding>
      <text value="Apgar color score"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <!-- this  extension  maps a numeric score to the code this may already be known and unecessary -->
        <extension url="http://hl7.org/fhir/StructureDefinition/itemWeight">
          <valueDecimal value="1"/>
        </extension>
        <system value="http://loinc.org"/>
        <code value="LA6723-6"/>
        <display value="Good color in body with bluish hands or feet"/>
      </coding>
      <coding>
        <system value="http://acme.ped/apgarcolor"/>
        <code value="1"/>
      </coding>
      <text value="1. Good color in body with bluish hands or feet"/>
    </valueCodeableConcept>
  </component>
  <component>
    <code>
      <coding>
        <system value="http://snomed.info/sct"/>
        <code value="249223000"/>
        <display value="Apgar heart rate score"/>
      </coding>
      <text value="Apgar heart rate score"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <!-- this  extension  maps a numeric score to the code this may already be known and unecessary -->
        <extension url="http://hl7.org/fhir/StructureDefinition/itemWeight">
          <valueDecimal value="1"/>
        </extension>
        <system value="http://loinc.org"/>
        <code value="LA6717-8"/>
        <display value="Fewer than 100 beats per minute"/>
      </coding>
      <coding>
        <system value="http://acme.ped/apgarheartrate"/>
        <code value="1"/>
      </coding>
      <text value="1. Fewer than 100 beats per minute"/>
    </valueCodeableConcept>
  </component>
  <component>
    <code>
      <coding>
        <system value="http://snomed.info/sct"/>
        <code value="249226008"/>
        <display value="Apgar response to stimulus score"/>
      </coding>
      <text value="Apgar response to stimulus score"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <!-- this  extension  maps a numeric score to the code this may already be known and unecessary -->
        <extension url="http://hl7.org/fhir/StructureDefinition/itemWeight">
          <valueDecimal value="1"/>
        </extension>
        <system value="http://loinc.org"/>
        <code value="LA6721-0"/>
        <display value="Grimace and pulling away, cough, or sneeze during suctioning"/>
      </coding>
      <coding>
        <system value="http://acme.ped/apgarreflexirritability"/>
        <code value="1"/>
      </coding>
      <text value="1. Grimace during suctioning"/>
    </valueCodeableConcept>
  </component>
  <component>
    <code>
      <coding>
        <system value="http://snomed.info/sct"/>
        <code value="249225007"/>
        <display value="Apgar muscle tone score"/>
      </coding>
      <text value="Apgar muscle tone score"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <!-- this  extension  maps a numeric score to the code this may already be known and unecessary -->
        <extension url="http://hl7.org/fhir/StructureDefinition/itemWeight">
          <valueDecimal value="1"/>
        </extension>
        <system value="http://loinc.org"/>
        <code value="LA6714-5"/>
        <display value="Some flexion of arms and legs"/>
      </coding>
      <coding>
        <system value="http://acme.ped/apgarmuscletone"/>
        <code value="1"/>
      </coding>
      <text value="1. Some flexion of arms and legs"/>
    </valueCodeableConcept>
  </component>
  <component>
    <code>
      <coding>
        <system value="http://snomed.info/sct"/>
        <code value="249224006"/>
        <display value="Apgar respiratory effort score"/>
      </coding>
      <text value="Apgar respiratory effort score"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <!-- this  extension  maps a numeric score to the code this may already be known and unecessary -->
        <extension url="http://hl7.org/fhir/StructureDefinition/itemWeight">
          <valueDecimal value="1"/>
        </extension>
        <system value="http://loinc.org"/>
        <code value="LA6726-9"/>
        <display value="Weak cry; may sound like whimpering, slow or irregular breathing"/>
      </coding>
      <coding>
        <system value="http://acme.ped/apgarrespiratoryeffort"/>
        <code value="1"/>
      </coding>
      <text value="1. Weak cry; may sound like whimpering, slow or irregular breathing"/>
    </valueCodeableConcept>
  </component>
</Observation>