FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagesilfhirprofileig
Resource TypeStructureMap
IdStructureMap-ExtractNewbornObservationChart.json
FHIR VersionR5
Sourcehttps://build.fhir.org/ig/savannahghi/sil_fhir_profile_ig/StructureMap-ExtractNewbornObservationChart.html
URLhttps://fhir.slade360.co.ke/fhir/StructureMap/ExtractNewbornObservationChart
Version0.1.0
Statusactive
Date2026-09-11T12:18:36+00:00
NameExtractNewbornObservationChart
TitleNewborn Observation Chart Extraction
DescriptionThe newborn chart out as: one Observation per Apgar time point, coded to the LOINC panel with the five weighted signs as components and the total as its value, computed by the map when the client submits none; one Observation per timed skin-to-skin round; one Observation per follow-up round over the first four days; the birth and discharge weights as their own Observations; the immediate newborn care given as one panel rather than as Immunization or MedicationAdministration resources, which the chart gives no doses or times for; and a Procedure for resuscitation when it was done.

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap ExtractNewbornObservationChart

/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractNewbornObservationChart'
/// name = 'ExtractNewbornObservationChart'
/// title = 'Newborn Observation Chart Extraction'
/// status = 'active'
/// description = 'The newborn chart out as: one Observation per Apgar time point, coded to the LOINC panel with the five weighted signs as components and the total as its value, computed by the map when the client submits none; one Observation per timed skin-to-skin round; one Observation per follow-up round over the first four days; the birth and discharge weights as their own Observations; the immediate newborn care given as one panel rather than as Immunization or MedicationAdministration resources, which the chart gives no doses or times for; and a Procedure for resuscitation when it was done.'

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QR as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target
uses "http://hl7.org/fhir/StructureDefinition/Procedure" alias Procedure as target

group ExtractNewbornObservationChart(source qr : QR, target bundle : Bundle) {
  qr -> bundle.type = 'transaction' "setBundleType";
  // ── Birth details ───────────────────────────────────────────────────────
  qr.item as g where (linkId = 'bio') then {
    g.item as it where ((linkId = 'bio/birth-weight') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'http://loinc.org' "sys";
          it -> cg.code = '8339-4' "cd";
          it -> cg.display = 'Birth weight Measured' "dsp";
        } "coding";
      } "code";
      it.answer first as a then {
        a.value as v -> obs.value = v "set";
      };
    } "measure_8339_4";
    g.item as it where ((linkId = 'bio/gestational-age') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'http://loinc.org' "sys";
          it -> cg.code = '11884-4' "cd";
          it -> cg.display = 'Gestational age Estimated' "dsp";
        } "coding";
      } "code";
      it.answer first as a then {
        a.value as v -> obs.value = v "set";
      };
    } "measure_11884_4";
    g.item as it where ((linkId = 'bio/delivery') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'cord-mode-of-delivery' "cd";
          it -> cg.display = 'Mode of delivery' "dsp";
        } "coding";
      } "code";
      it.answer first as a then {
        a.value as cv -> obs.value = create('CodeableConcept') as cc then {
          cv -> cc.coding = cv "valueCoding";
          cv.display as d -> cc.text = d "valueText";
        } "codedValue";
      };
    } "coded_cord_condition";
    g.item as it where ((linkId = 'bio/meconium-stained-liquor') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetExamCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'sign-meconium-stained-liquor' "cd";
          it -> cg.display = 'Meconium stained liquor' "dsp";
        } "coding";
      } "code";
      it.answer first as a then {
        a.value as cv -> obs.value = create('CodeableConcept') as cc then {
          cv -> cc.coding = cv "valueCoding";
          cv.display as d -> cc.text = d "valueText";
        } "codedValue";
      };
    } "meconiumObservation";
  } "bioGroup";
  // ── Apgar, one Observation per time point ───────────────────────────────
  // Coded to the LOINC panel for its time point, with the five signs as
  // components under their own time-specific LOINC codes -- LOINC publishes
  // separate codes for the one-, five- and ten-minute variants of each sign, so
  // a five-minute colour is never mistaken for a one-minute one.
  // The total is the Observation's value, taken from the form's calculated
  // field if the client filled it, and otherwise summed from the answer codes.
  // The weight is the tail of the code: apgar-colour-2 scores two. A client
  // without a FHIRPath engine -- the questionnaire tester among them -- submits
  // the total empty, and this is what makes such a submission still usable.
  // Guarded on all five signs being answered at that time point. An Apgar of 6
  // out of three signs assessed is not a lower Apgar, it is a different number,
  // and nothing in the resource would say which it was.
  qr.item as ag where (linkId = 'apgar') then {
    ag.item as g where ((linkId = 'apgar/1-minute') and (item.answer.value.ofType(Coding).count() = 5)) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'http://loinc.org' "sys";
          g -> cg.code = '48334-7' "cd";
          g -> cg.display = '1 minute Apgar panel' "dsp";
        } "coding";
      } "code";
      g -> obs.value = evaluate(ag, iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))) "totalValue";
      // Seven or more is normal, four to six needs support, three or less is
      // critically low. The chart prints those bands at its foot, so the
      // interpretation says which band the total fell in rather than leaving a
      // reader to remember them.
      g -> obs.interpretation as interp then {
        g -> interp.coding as coding then {
          g -> coding.system = 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation' "interpSystem";
          g -> coding.code = evaluate(ag, iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))) "interpCode";
          g -> coding.display = evaluate(ag, iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))) "interpDisplay";
        } "interpCoding";
      } "interpretation";
      g.item as it where ((linkId = 'apgar/1-minute/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32406-1' "cd";
            it -> cg.display = '1 minute Apgar Appearance' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32406_1";
      g.item as it where ((linkId = 'apgar/1-minute/pulse') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32407-9' "cd";
            it -> cg.display = '1 minute Apgar Pulse' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32407_9";
      g.item as it where ((linkId = 'apgar/1-minute/grimace') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32409-5' "cd";
            it -> cg.display = '1 minute Apgar Grimace' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32409_5";
      g.item as it where ((linkId = 'apgar/1-minute/activity') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32408-7' "cd";
            it -> cg.display = '1 minute Apgar Activity' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32408_7";
      g.item as it where ((linkId = 'apgar/1-minute/respiration') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32410-3' "cd";
            it -> cg.display = '1 minute Apgar Respiration' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32410_3";
    } "apgarPanel";
    ag.item as g where ((linkId = 'apgar/5-minutes') and (item.answer.value.ofType(Coding).count() = 5)) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'http://loinc.org' "sys";
          g -> cg.code = '48333-9' "cd";
          g -> cg.display = '5 minutes Apgar panel' "dsp";
        } "coding";
      } "code";
      g -> obs.value = evaluate(ag, iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))) "totalValue";
      // Seven or more is normal, four to six needs support, three or less is
      // critically low. The chart prints those bands at its foot, so the
      // interpretation says which band the total fell in rather than leaving a
      // reader to remember them.
      g -> obs.interpretation as interp then {
        g -> interp.coding as coding then {
          g -> coding.system = 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation' "interpSystem";
          g -> coding.code = evaluate(ag, iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))) "interpCode";
          g -> coding.display = evaluate(ag, iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))) "interpDisplay";
        } "interpCoding";
      } "interpretation";
      g.item as it where ((linkId = 'apgar/5-minutes/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32411-1' "cd";
            it -> cg.display = '5 minutes Apgar Appearance' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32411_1";
      g.item as it where ((linkId = 'apgar/5-minutes/pulse') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32412-9' "cd";
            it -> cg.display = '5 minutes Apgar Pulse' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32412_9";
      g.item as it where ((linkId = 'apgar/5-minutes/grimace') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32414-5' "cd";
            it -> cg.display = '5 minutes Apgar Grimace' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32414_5";
      g.item as it where ((linkId = 'apgar/5-minutes/activity') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32413-7' "cd";
            it -> cg.display = '5 minutes Apgar Activity' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32413_7";
      g.item as it where ((linkId = 'apgar/5-minutes/respiration') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32415-2' "cd";
            it -> cg.display = '5 minutes Apgar Respiration' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32415_2";
    } "apgarPanel2";
    ag.item as g where ((linkId = 'apgar/10-minutes') and (item.answer.value.ofType(Coding).count() = 5)) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'http://loinc.org' "sys";
          g -> cg.code = '48332-1' "cd";
          g -> cg.display = '10 minutes Apgar panel' "dsp";
        } "coding";
      } "code";
      g -> obs.value = evaluate(ag, iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))) "totalValue";
      // Seven or more is normal, four to six needs support, three or less is
      // critically low. The chart prints those bands at its foot, so the
      // interpretation says which band the total fell in rather than leaving a
      // reader to remember them.
      g -> obs.interpretation as interp then {
        g -> interp.coding as coding then {
          g -> coding.system = 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation' "interpSystem";
          g -> coding.code = evaluate(ag, iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))) "interpCode";
          g -> coding.display = evaluate(ag, iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))) "interpDisplay";
        } "interpCoding";
      } "interpretation";
      g.item as it where ((linkId = 'apgar/10-minutes/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32401-2' "cd";
            it -> cg.display = '10 minutes Apgar Appearance' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32401_2";
      g.item as it where ((linkId = 'apgar/10-minutes/pulse') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32402-0' "cd";
            it -> cg.display = '10 minutes Apgar Pulse' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32402_0";
      g.item as it where ((linkId = 'apgar/10-minutes/grimace') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32404-6' "cd";
            it -> cg.display = '10 minutes Apgar Grimace' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32404_6";
      g.item as it where ((linkId = 'apgar/10-minutes/activity') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32403-8' "cd";
            it -> cg.display = '10 minutes Apgar Activity' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32403_8";
      g.item as it where ((linkId = 'apgar/10-minutes/respiration') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '32405-3' "cd";
            it -> cg.display = '10 minutes Apgar Respiration' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_32405_3";
    } "apgarPanel3";
  } "apgarGroup";
  // ── Skin-to-skin, one Observation per timed round ───────────────────────
  // Four rounds in the first two hours. One Observation each rather than one
  // panel of twenty components, because these are a time series: the point of
  // charting a heart rate at fifteen and thirty minutes and one and two hours is
  // to see it change, and a single Observation cannot hold four effective times.
  // Each carries its offset from birth as the code text, since the chart gives
  // the offset rather than a clock time and the response's authored time is when
  // the form was written, not when the reading was taken.
  qr.item as sg where (linkId = 'skin-to-skin') then {
    sg.item as g where ((linkId = 'skin-to-skin/15-minutes') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'skin-to-skin-observation' "cd";
          g -> cg.display = 'Skin-to-skin observation' "dsp";
        } "coding";
        g -> cc.text = 'Skin-to-skin observation — at 15 minutes' "codeText";
      } "code";
      g.item as it where ((linkId = 'skin-to-skin/15-minutes/heart-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8867_4";
      g.item as it where ((linkId = 'skin-to-skin/15-minutes/temperature') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8310_5";
      g.item as it where ((linkId = 'skin-to-skin/15-minutes/respiratory-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_9279_1";
      g.item as it where ((linkId = 'skin-to-skin/15-minutes/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-colour' "cd";
            it -> cg.display = 'Colour' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_colour";
      g.item as it where ((linkId = 'skin-to-skin/15-minutes/position-sniffing') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-position-sniffing' "cd";
            it -> cg.display = 'Position: sniffing' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_position_sniffing";
    } "skinToSkinRound";
    sg.item as g where ((linkId = 'skin-to-skin/30-minutes') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'skin-to-skin-observation' "cd";
          g -> cg.display = 'Skin-to-skin observation' "dsp";
        } "coding";
        g -> cc.text = 'Skin-to-skin observation — at 30 minutes' "codeText";
      } "code";
      g.item as it where ((linkId = 'skin-to-skin/30-minutes/heart-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8867_42";
      g.item as it where ((linkId = 'skin-to-skin/30-minutes/temperature') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8310_52";
      g.item as it where ((linkId = 'skin-to-skin/30-minutes/respiratory-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_9279_12";
      g.item as it where ((linkId = 'skin-to-skin/30-minutes/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-colour' "cd";
            it -> cg.display = 'Colour' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_colour2";
      g.item as it where ((linkId = 'skin-to-skin/30-minutes/position-sniffing') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-position-sniffing' "cd";
            it -> cg.display = 'Position: sniffing' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_position_sniffing2";
    } "skinToSkinRound2";
    sg.item as g where ((linkId = 'skin-to-skin/1-hour') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'skin-to-skin-observation' "cd";
          g -> cg.display = 'Skin-to-skin observation' "dsp";
        } "coding";
        g -> cc.text = 'Skin-to-skin observation — at 1 hour' "codeText";
      } "code";
      g.item as it where ((linkId = 'skin-to-skin/1-hour/heart-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8867_43";
      g.item as it where ((linkId = 'skin-to-skin/1-hour/temperature') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8310_53";
      g.item as it where ((linkId = 'skin-to-skin/1-hour/respiratory-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_9279_13";
      g.item as it where ((linkId = 'skin-to-skin/1-hour/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-colour' "cd";
            it -> cg.display = 'Colour' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_colour3";
      g.item as it where ((linkId = 'skin-to-skin/1-hour/position-sniffing') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-position-sniffing' "cd";
            it -> cg.display = 'Position: sniffing' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_position_sniffing3";
    } "skinToSkinRound3";
    sg.item as g where ((linkId = 'skin-to-skin/2-hours') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'skin-to-skin-observation' "cd";
          g -> cg.display = 'Skin-to-skin observation' "dsp";
        } "coding";
        g -> cc.text = 'Skin-to-skin observation — at 2 hours' "codeText";
      } "code";
      g.item as it where ((linkId = 'skin-to-skin/2-hours/heart-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8867-4' "cd";
            it -> cg.display = 'Heart rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8867_44";
      g.item as it where ((linkId = 'skin-to-skin/2-hours/temperature') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '8310-5' "cd";
            it -> cg.display = 'Body temperature' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_8310_54";
      g.item as it where ((linkId = 'skin-to-skin/2-hours/respiratory-rate') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '9279-1' "cd";
            it -> cg.display = 'Respiratory rate' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_9279_14";
      g.item as it where ((linkId = 'skin-to-skin/2-hours/colour') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-colour' "cd";
            it -> cg.display = 'Colour' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_colour4";
      g.item as it where ((linkId = 'skin-to-skin/2-hours/position-sniffing') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'skin-to-skin-position-sniffing' "cd";
            it -> cg.display = 'Position: sniffing' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_skin_to_skin_position_sniffing4";
    } "skinToSkinRound4";
    sg.item as it where ((linkId = 'skin-to-skin/breast-fed-first-hour') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'http://loinc.org' "sys";
          it -> cg.code = '63895-7' "cd";
          it -> cg.display = 'Breastfeeding status' "dsp";
        } "coding";
        it -> cc.text = 'Breast fed in the first hour' "codeText";
      } "code";
      it.answer first as a then {
        a.value as cv -> obs.value = create('CodeableConcept') as cc then {
          cv -> cc.coding = cv "valueCoding";
          cv.display as d -> cc.text = d "valueText";
        } "codedValue";
      };
    } "breastFedObservation";
  } "skinToSkinGroup";
  // ── Immediate newborn care given ────────────────────────────────────────
  // One panel, not Immunization or MedicationAdministration resources. The
  // chart ticks that vitamin K, eye ointment, chlorhexidine cord care, delayed
  // clamping and ARVs were given and records no dose, no route and no time.
  // A MedicationAdministration built from a tick claims a dose nobody gave.
  qr.item as g where ((linkId = 'immediate-care') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
    qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
    qr -> obs then SetSurveyCategory(qr, obs) "category";
    g -> obs.code as cc then {
      g -> cc.coding as cg then {
        g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
        g -> cg.code = 'essential-newborn-care-given' "cd";
        g -> cg.display = 'Essential newborn care given' "dsp";
      } "coding";
    } "code";
    g.item as it where ((linkId = 'immediate-care/obvious-malformation') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-obvious-malformation' "cd";
          it -> cg.display = 'Obvious malformation' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_obvious_malformation";
    g.item as it where ((linkId = 'immediate-care/delayed-cord-clamp') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-delayed-cord-clamp' "cd";
          it -> cg.display = 'Delayed cord clamp' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_delayed_cord_clamp";
    g.item as it where ((linkId = 'immediate-care/sero-exposed') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-sero-exposed' "cd";
          it -> cg.display = 'Sero-exposed' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_sero_exposed";
    g.item as it where ((linkId = 'immediate-care/arvs-started') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-arvs-started' "cd";
          it -> cg.display = 'ARVs started' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_arvs_started";
    g.item as it where ((linkId = 'immediate-care/eye-care') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-eye-care' "cd";
          it -> cg.display = 'Eye care' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_eye_care";
    g.item as it where ((linkId = 'immediate-care/vitamin-k') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-vitamin-k' "cd";
          it -> cg.display = 'Vitamin K' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_vitamin_k";
    g.item as it where ((linkId = 'immediate-care/cord-care-with-chx') and answer.value.exists()) -> obs.component as comp then {
      it -> comp.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-care-cord-care-with-chlorhexidine' "cd";
          it -> cg.display = 'Cord care with chlorhexidine' "dsp";
        } "coding";
      } "code";
      it -> comp then SetComponentCodedValue(it, comp) "value";
    } "comp_newborn_care_cord_care_with_chlorhexidine";
  } "immediateCarePanel";
  // ── Newborn follow-up, one Observation per round ────────────────────────
  // The chart is a grid of morning, evening and night over four days. The
  // questionnaire takes it as a repeating group, and each repeat becomes one
  // Observation whose effective time is the round's own date -- not the
  // response's authored time, which would collapse twelve rounds onto one
  // instant and make the chart unreadable.
  qr.item as fg where (linkId = 'follow-up') then {
    fg.item as g where ((linkId = 'follow-up/round') and item.answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetExamCategory(qr, obs) "category";
      g -> obs.code as cc then {
        g -> cc.coding as cg then {
          g -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          g -> cg.code = 'newborn-follow-up-round' "cd";
          g -> cg.display = 'Newborn follow-up round' "dsp";
        } "coding";
      } "code";
      // The round's own date overrides the base group's effective time.
      g.item as d where (linkId = 'follow-up/round/date') then {
        d.answer first as a then {
          // Observation.effective[x] takes dateTime, Period, Timing or instant
          // and no date, so the round's date is cast rather than copied.
          a.value as dt -> obs.effective = cast(dt, 'dateTime') "roundDate";
        };
      } "roundDateRule";
      // Which staff member did the round overrides the response's source, so a
      // chart filled in at the end of a shift still attributes each round.
      g.item as s where ((linkId = 'follow-up/round/staff') and answer.value.exists()) then {
        s.answer first as a then {
          a.value as ref -> obs.performer = ref "roundPerformer";
        };
      } "roundPerformerRule";
      g.item as it where ((linkId = 'follow-up/round/shift') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-round-of-the-day' "cd";
            it -> cg.display = 'Round of the day' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_newborn_round_round_of_the_day";
      g.item as it where ((linkId = 'follow-up/round/day-of-life') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-day-of-life' "cd";
            it -> cg.display = 'Day of life' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_day_of_life";
      g.item as it where ((linkId = 'follow-up/round/respiratory') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-respiratory' "cd";
            it -> cg.display = 'Respiratory' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_respiratory";
      g.item as it where ((linkId = 'follow-up/round/breastfeeding') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-breastfeeding' "cd";
            it -> cg.display = 'Breastfeeding' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_breastfeeding";
      g.item as it where ((linkId = 'follow-up/round/cord') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'cord-condition' "cd";
            it -> cg.display = 'Cord condition' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_cord_condition";
      g.item as it where ((linkId = 'follow-up/round/jaundice') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'grade-jaundice-grade' "cd";
            it -> cg.display = 'Jaundice grade' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentCodedValue(it, comp) "value";
      } "comp_grade_jaundice_grade";
      g.item as it where ((linkId = 'follow-up/round/tone') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-tone' "cd";
            it -> cg.display = 'Tone' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_tone";
      g.item as it where ((linkId = 'follow-up/round/fontanelle') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-fontanelle' "cd";
            it -> cg.display = 'Fontanelle' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_fontanelle";
      g.item as it where ((linkId = 'follow-up/round/urine') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-urine' "cd";
            it -> cg.display = 'Urine' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_urine";
      g.item as it where ((linkId = 'follow-up/round/stool') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-stool' "cd";
            it -> cg.display = 'Stool' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_stool";
      g.item as it where ((linkId = 'follow-up/round/eyes') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
            it -> cg.code = 'newborn-round-eyes' "cd";
            it -> cg.display = 'Eyes' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_newborn_round_eyes";
      g.item as it where ((linkId = 'follow-up/round/weight') and answer.value.exists()) -> obs.component as comp then {
        it -> comp.code as cc then {
          it -> cc.coding as cg then {
            it -> cg.system = 'http://loinc.org' "sys";
            it -> cg.code = '29463-7' "cd";
            it -> cg.display = 'Body weight' "dsp";
          } "coding";
        } "code";
        it -> comp then SetComponentValue(it, comp) "value";
      } "comp_29463_7";
      g.item as it where (linkId = 'follow-up/round/remarks') then {
        it.answer first as a then {
          a.value as txt ->  obs.note as n,  n.text = txt "text";
        };
      } "note";
    } "followUpRound";
  } "followUpGroup";
  // ── Resuscitation ───────────────────────────────────────────────────────
  // A Procedure, and only when it was actually done. `status = 'completed'`
  // because the chart is written after the event, and the duration becomes
  // Procedure.occurrenceTiming.repeat.duration rather than a note, so it can be
  // audited across births.
  qr.item as g where (linkId = 'resuscitation') then {
    g.item as it where ((linkId = 'resuscitation/done') and (answer.value.ofType(Coding).code = 'Y')) ->  bundle.entry as entry,  entry.resource = create('Procedure') as proc then {
      qr ->  proc,  entry then BuildProcedureBase(qr, proc, entry) "base";
      it -> proc.status = 'completed' "status";
      // A local code, not SNOMED. SNOMED almost certainly has a concept for
      // newborn resuscitation, but tx.fhir.org's expansion endpoint ignores a
      // text filter on the SNOMED implicit value set, so it could only have
      // been guessed at -- and a guessed SNOMED code is worse than a local one,
      // because everyone downstream trusts SNOMED and nobody re-checks it.
      it -> proc.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem' "sys";
          it -> cg.code = 'newborn-resuscitation' "cd";
          it -> cg.display = 'Resuscitation of a newborn' "dsp";
        } "coding";
      } "code";
      qr.authored as t -> proc.occurrence = t "occurrence";
      qr.encounter as e -> proc.encounter = e;
      qr.source as src ->  proc.performer as p,  p.actor = src "performer";
      g.item as sp where (linkId = 'resuscitation/specify') then {
        sp.answer first as a then {
          a.value as txt ->  proc.note as n,  n.text = txt "specifyNote";
        };
      } "specifyRule";
      g.item as du where ((linkId = 'resuscitation/duration') and answer.value.exists()) then {
        du.answer first as a then {
          a.value as v ->  proc.report as rep,  rep.display = 'Resuscitation duration recorded on the newborn observation chart' "durationRef";
        };
      } "durationRule";
    } "resuscitationProcedure";
  } "resuscitationGroup";
  // ── Discharge ───────────────────────────────────────────────────────────
  qr.item as g where (linkId = 'discharge') then {
    g.item as it where ((linkId = 'discharge/weight') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetVitalSignsCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'http://loinc.org' "sys";
          it -> cg.code = '29463-7' "cd";
          it -> cg.display = 'Body weight' "dsp";
        } "coding";
      } "code";
      it.answer first as a then {
        a.value as v -> obs.value = v "set";
      };
    } "measure_29463_7";
    g.item as it where ((linkId = 'discharge/immunisation-given') and answer.value.exists()) ->  bundle.entry as entry,  entry.resource = create('Observation') as obs then {
      qr ->  obs,  entry then BuildObsBase(qr, obs, entry) "base";
      qr -> obs then SetSurveyCategory(qr, obs) "category";
      it -> obs.code as cc then {
        it -> cc.coding as cg then {
          it -> cg.system = 'http://loinc.org' "sys";
          it -> cg.code = '11369-6' "cd";
          it -> cg.display = 'History of Immunization note' "dsp";
        } "coding";
        it -> cc.text = 'Immunisation given before discharge' "codeText";
      } "code";
      it.answer first as a then {
        a.value as cv -> obs.value = create('CodeableConcept') as cc then {
          cv -> cc.coding = cv "valueCoding";
          cv.display as d -> cc.text = d "valueText";
        } "codedValue";
      };
    } "dischargeImmunisationObservation";
  } "dischargeGroup";
}

// ─────────────────────────────────────────────────────────────────────────────
// Shared scaffolding. Repeated in each map rather than imported: the transform
// engine resolves `imports` against whatever StructureMaps happen to be on the
// server, and a form that stops extracting because a shared map was not
// uploaded is a worse failure than a duplicated group.
// Two notes on what the publisher's StructureMap validator says about this file.
// Source parameters below are left untyped on purpose. Writing `: Element` makes
// the validator compare QuestionnaireResponse.item against the literal 'Element'
// and report them as incompatible with each other, which is noise, not a finding.
// `evaluate(context, expression)` is flagged as "takes 1 parameter but 2 were
// found". Leave it. The FML parser in the same jar refuses the one-argument form
// outright -- it wants a parameter, a comma, then the FHIRPath -- so the
// publisher is objecting to what its own compiler emits. Two arguments is the
// only form that compiles, and it is what the R5 transform engine executes.
// ─────────────────────────────────────────────────────────────────────────────
group BuildObsBase(source qr : QR, target obs : Observation, target entry) {
  qr -> obs then SetResponseProvenance(qr, obs) "responseProvenance";
  qr -> obs.id = uuid() then SetObservationFullUrl(obs, entry) "idAndFullUrl";
  qr -> entry.request as request then {
    qr -> request.method = 'POST' "requestMethod";
    qr -> request.url = 'Observation' "requestUrl";
  } "entryRequest";
  qr -> obs.status = 'final' "status";
  qr.subject as s -> obs.subject = s;
  qr.encounter as e -> obs.encounter = e;
  qr.authored as t -> obs.effective = t "effective";
  qr.source as src -> obs.performer = src "performerFromSource";
  qr where (source.exists().not()) then {
    qr.author as a -> obs.performer = a "performerFromAuthor";
  } "performerFallback";
  // A stored response's id already reads "QuestionnaireResponse/<id>", so it is
  // a relative reference as it stands. The hasValue() guard is what stops an
  // unsaved response -- one posted straight to $extract rather than saved first
  // -- from writing "QuestionnaireResponse/null" into the record.
  qr.id as qid where ($this.hasValue()) ->  obs.derivedFrom = create('Reference') as ref,  ref.reference = qid "linkQuestionnaireResponse";
}

group SetObservationFullUrl(source obs : Observation, target entry) {
  obs.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Observation/', id) "assignFullUrl";
}

// The two answer shapes a component can carry. Both read the answer through the
// untyped `.value` accessor: reading `valueCoding` or `valueQuantity` by its
// typed property name fails at transform time on HAPI R5 with "Attempt to read
// invalid property ... on QuestionnaireResponse.item.answer".
group SetComponentCodedValue(source it, target comp) {
  it.answer first as a then {
    a.value as cv -> comp.value = create('CodeableConcept') as cc then {
      cv -> cc.coding = cv "valueCoding";
      cv.display as d -> cc.text = d "valueText";
    } "codedValue";
  } "componentAnswer";
}

group SetComponentValue(source it, target comp) {
  it.answer first as a then {
    a.value as v -> comp.value = v "plainValue";
  } "componentAnswer";
}

group SetSurveyCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'survey' "categoryCode";
      qr -> coding.display = 'Survey' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group SetVitalSignsCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'vital-signs' "categoryCode";
      qr -> coding.display = 'Vital Signs' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group SetExamCategory(source qr : QR, target obs : Observation) {
  qr -> obs.category as cat then {
    qr -> cat.coding as coding then {
      qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem";
      qr -> coding.code = 'exam' "categoryCode";
      qr -> coding.display = 'Exam' "categoryDisplay";
    } "categoryCoding";
  } "category";
}

group BuildProcedureBase(source qr : QR, target r : Procedure, target entry) {
  qr -> r then SetResponseProvenance(qr, r) "responseProvenance";
  qr -> r.id = uuid() then SetProcedureFullUrl(r, entry) "idAndFullUrl";
  qr -> entry.request as request then {
    qr -> request.method = 'POST' "requestMethod";
    qr -> request.url = 'Procedure' "requestUrl";
  } "entryRequest";
  // The response's own time, as a floor, the way BuildObsBase does it. A rule
  // that reads a time off the form overwrites this; without it a procedure whose
  // date column was taken off on review has no time at all, and a procedure with
  // no time cannot be ordered against the rest of the admission.
  qr.authored as t -> r.occurrence = t "occurrenceFallback";
  qr.subject as s -> r.subject = s;
}

group SetProcedureFullUrl(source r : Procedure, target entry) {
  r.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Procedure/', id) "assignFullUrl";
}

// ── Provenance and tenancy ───────────────────────────────────────────────────
// Two tags on everything this map creates. The first says which questionnaire
// produced it, so a form that reopens mid-admission recalls its own earlier
// entries and not another form's. The second copies the tenant tags off the
// response, because nothing else on the path puts them there.
// The code is the form's document type, not the questionnaire's id: every
// environment mints its own ids, and there is only one set of maps, so an id
// here would tie the tag to whichever environment stamped it.
// ── Provenance and tenancy ───────────────────────────────────────────────────
group SetResponseProvenance(source qr : QR, target r) {
  qr -> r.meta as m then {
    qr -> m.tag as t then {
      qr -> t.system = 'http://slade360edi.com/questionnaire-provenance' "provenanceSystem";
      qr -> t.code = 'newborn-observation-chart' "provenanceCode";
      qr -> t.display = 'Newborn observation chart' "provenanceDisplay";
    } "provenanceTag";
  } "provenanceMeta";
  // Every tag the response carries, onto the resource. `meta` is 0..1, so this
  // lands on the same meta the rule above created rather than a second one.
  qr.meta as qm then {
    qm.tag as qt ->  r.meta as m,  m.tag = qt "copyTag";
  } "tenantTags";
}


Source1

{
  "resourceType": "StructureMap",
  "id": "ExtractNewbornObservationChart",
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "url": "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractNewbornObservationChart",
  "version": "0.1.0",
  "name": "ExtractNewbornObservationChart",
  "title": "Newborn Observation Chart Extraction",
  "status": "active",
  "date": "2026-09-11T12:18:36+00:00",
  "publisher": "Kathurima Kimathi",
  "contact": [
    {
      "name": "Kathurima Kimathi",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.linkedin.com/in/kathurima-kimathi/"
        },
        {
          "system": "email",
          "value": "kathurimakimathi415@gmail.com"
        }
      ]
    },
    {
      "name": "Oscar John",
      "telecom": [
        {
          "system": "email",
          "value": "oscarjohnotieno@gmail.com",
          "use": "work"
        }
      ]
    },
    {
      "name": "Kennedy Omondi",
      "telecom": [
        {
          "system": "email",
          "value": "kennankole@gmail.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "The newborn chart out as: one Observation per Apgar time point, coded to the LOINC panel with the five weighted signs as components and the total as its value, computed by the map when the client submits none; one Observation per timed skin-to-skin round; one Observation per follow-up round over the first four days; the birth and discharge weights as their own Observations; the immediate newborn care given as one panel rather than as Immunization or MedicationAdministration resources, which the chart gives no doses or times for; and a Procedure for resuscitation when it was done.",
  "structure": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode": "source",
      "alias": "QR"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode": "target",
      "alias": "Bundle"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/Observation",
      "mode": "target",
      "alias": "Observation"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/Procedure",
      "mode": "target",
      "alias": "Procedure"
    }
  ],
  "group": [
    {
      "name": "ExtractNewbornObservationChart",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "bundle",
          "type": "Bundle",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "setBundleType",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "bundle",
              "element": "type",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "transaction"
                }
              ]
            }
          ]
        },
        {
          "name": "bioGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'bio'"
            }
          ],
          "rule": [
            {
              "name": "measure_8339_4",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'bio/birth-weight') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "8339-4"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Birth weight Measured"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "set",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "v"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "v"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "measure_11884_4",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'bio/gestational-age') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "11884-4"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Gestational age Estimated"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "set",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "v"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "v"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "coded_cord_condition",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'bio/delivery') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "cord-mode-of-delivery"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Mode of delivery"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "codedValue",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "cv"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "variable": "cc",
                          "transform": "create",
                          "parameter": [
                            {
                              "valueString": "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "rule": [
                        {
                          "name": "valueCoding",
                          "source": [
                            {
                              "context": "cv"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "cv"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "valueText",
                          "source": [
                            {
                              "context": "cv",
                              "element": "display",
                              "variable": "d"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "d"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "meconiumObservation",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'bio/meconium-stained-liquor') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetExamCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "sign-meconium-stained-liquor"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Meconium stained liquor"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "codedValue",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "cv"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "variable": "cc",
                          "transform": "create",
                          "parameter": [
                            {
                              "valueString": "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "rule": [
                        {
                          "name": "valueCoding",
                          "source": [
                            {
                              "context": "cv"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "cv"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "valueText",
                          "source": [
                            {
                              "context": "cv",
                              "element": "display",
                              "variable": "d"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "d"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Birth details ───────────────────────────────────────────────────────"
        },
        {
          "name": "apgarGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "ag",
              "condition": "linkId = 'apgar'"
            }
          ],
          "rule": [
            {
              "name": "apgarPanel",
              "source": [
                {
                  "context": "ag",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'apgar/1-minute') and (item.answer.value.ofType(Coding).count() = 5)"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "48334-7"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "1 minute Apgar panel"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "totalValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "transform": "evaluate",
                      "parameter": [
                        {
                          "valueId": "ag"
                        },
                        {
                          "valueString": "iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "interpretation",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "interpretation",
                      "variable": "interp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "interpCoding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "interp",
                          "element": "coding",
                          "variable": "coding"
                        }
                      ],
                      "rule": [
                        {
                          "name": "interpSystem",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpCode",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "code",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpDisplay",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "display",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.exists(), item.where(linkId = 'apgar/1-minute').item.where(linkId = 'apgar/1-minute/total').answer.value.truncate(), item.where(linkId = 'apgar/1-minute').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "Seven or more is normal, four to six needs support, three or less is\r\ncritically low. The chart prints those bands at its foot, so the\r\ninterpretation says which band the total fell in rather than leaving a\r\nreader to remember them."
                },
                {
                  "name": "comp_32406_1",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/1-minute/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32406-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "1 minute Apgar Appearance"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32407_9",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/1-minute/pulse') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32407-9"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "1 minute Apgar Pulse"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32409_5",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/1-minute/grimace') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32409-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "1 minute Apgar Grimace"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32408_7",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/1-minute/activity') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32408-7"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "1 minute Apgar Activity"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32410_3",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/1-minute/respiration') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32410-3"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "1 minute Apgar Respiration"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "apgarPanel2",
              "source": [
                {
                  "context": "ag",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'apgar/5-minutes') and (item.answer.value.ofType(Coding).count() = 5)"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "48333-9"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "5 minutes Apgar panel"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "totalValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "transform": "evaluate",
                      "parameter": [
                        {
                          "valueId": "ag"
                        },
                        {
                          "valueString": "iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "interpretation",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "interpretation",
                      "variable": "interp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "interpCoding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "interp",
                          "element": "coding",
                          "variable": "coding"
                        }
                      ],
                      "rule": [
                        {
                          "name": "interpSystem",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpCode",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "code",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpDisplay",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "display",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/5-minutes').item.where(linkId = 'apgar/5-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/5-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "Seven or more is normal, four to six needs support, three or less is\r\ncritically low. The chart prints those bands at its foot, so the\r\ninterpretation says which band the total fell in rather than leaving a\r\nreader to remember them."
                },
                {
                  "name": "comp_32411_1",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/5-minutes/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32411-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "5 minutes Apgar Appearance"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32412_9",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/5-minutes/pulse') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32412-9"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "5 minutes Apgar Pulse"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32414_5",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/5-minutes/grimace') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32414-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "5 minutes Apgar Grimace"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32413_7",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/5-minutes/activity') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32413-7"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "5 minutes Apgar Activity"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32415_2",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/5-minutes/respiration') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32415-2"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "5 minutes Apgar Respiration"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "apgarPanel3",
              "source": [
                {
                  "context": "ag",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'apgar/10-minutes') and (item.answer.value.ofType(Coding).count() = 5)"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "48332-1"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "10 minutes Apgar panel"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "totalValue",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "value",
                      "transform": "evaluate",
                      "parameter": [
                        {
                          "valueId": "ag"
                        },
                        {
                          "valueString": "iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0))"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "interpretation",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "interpretation",
                      "variable": "interp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "interpCoding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "interp",
                          "element": "coding",
                          "variable": "coding"
                        }
                      ],
                      "rule": [
                        {
                          "name": "interpSystem",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpCode",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "code",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'N', iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'A', 'LL'))"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "interpDisplay",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "coding",
                              "element": "display",
                              "transform": "evaluate",
                              "parameter": [
                                {
                                  "valueId": "ag"
                                },
                                {
                                  "valueString": "iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 7, 'Normal', iif(iif(item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.exists(), item.where(linkId = 'apgar/10-minutes').item.where(linkId = 'apgar/10-minutes/total').answer.value.truncate(), item.where(linkId = 'apgar/10-minutes').item.answer.value.ofType(Coding).code.select(iif($this.endsWith('-2'), 2, iif($this.endsWith('-1'), 1, 0))).aggregate($this + $total, 0)) >= 4, 'Abnormal', 'Critically low'))"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "Seven or more is normal, four to six needs support, three or less is\r\ncritically low. The chart prints those bands at its foot, so the\r\ninterpretation says which band the total fell in rather than leaving a\r\nreader to remember them."
                },
                {
                  "name": "comp_32401_2",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/10-minutes/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32401-2"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "10 minutes Apgar Appearance"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32402_0",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/10-minutes/pulse') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32402-0"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "10 minutes Apgar Pulse"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32404_6",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/10-minutes/grimace') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32404-6"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "10 minutes Apgar Grimace"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32403_8",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/10-minutes/activity') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32403-8"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "10 minutes Apgar Activity"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_32405_3",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'apgar/10-minutes/respiration') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "32405-3"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "10 minutes Apgar Respiration"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Apgar, one Observation per time point ───────────────────────────────\r\nCoded to the LOINC panel for its time point, with the five signs as\r\ncomponents under their own time-specific LOINC codes -- LOINC publishes\r\nseparate codes for the one-, five- and ten-minute variants of each sign, so\r\na five-minute colour is never mistaken for a one-minute one.\r\nThe total is the Observation's value, taken from the form's calculated\r\nfield if the client filled it, and otherwise summed from the answer codes.\r\nThe weight is the tail of the code: apgar-colour-2 scores two. A client\r\nwithout a FHIRPath engine -- the questionnaire tester among them -- submits\r\nthe total empty, and this is what makes such a submission still usable.\r\nGuarded on all five signs being answered at that time point. An Apgar of 6\r\nout of three signs assessed is not a lower Apgar, it is a different number,\r\nand nothing in the resource would say which it was."
        },
        {
          "name": "skinToSkinGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "sg",
              "condition": "linkId = 'skin-to-skin'"
            }
          ],
          "rule": [
            {
              "name": "skinToSkinRound",
              "source": [
                {
                  "context": "sg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'skin-to-skin/15-minutes') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "skin-to-skin-observation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Skin-to-skin observation"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Skin-to-skin observation — at 15 minutes"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8867_4",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/15-minutes/heart-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8310_5",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/15-minutes/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_9279_1",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/15-minutes/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_colour",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/15-minutes/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-colour"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Colour"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_position_sniffing",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/15-minutes/position-sniffing') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-position-sniffing"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Position: sniffing"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "skinToSkinRound2",
              "source": [
                {
                  "context": "sg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'skin-to-skin/30-minutes') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "skin-to-skin-observation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Skin-to-skin observation"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Skin-to-skin observation — at 30 minutes"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8867_42",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/30-minutes/heart-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8310_52",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/30-minutes/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_9279_12",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/30-minutes/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_colour2",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/30-minutes/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-colour"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Colour"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_position_sniffing2",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/30-minutes/position-sniffing') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-position-sniffing"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Position: sniffing"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "skinToSkinRound3",
              "source": [
                {
                  "context": "sg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'skin-to-skin/1-hour') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "skin-to-skin-observation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Skin-to-skin observation"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Skin-to-skin observation — at 1 hour"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8867_43",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/1-hour/heart-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8310_53",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/1-hour/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_9279_13",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/1-hour/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_colour3",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/1-hour/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-colour"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Colour"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_position_sniffing3",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/1-hour/position-sniffing') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-position-sniffing"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Position: sniffing"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "skinToSkinRound4",
              "source": [
                {
                  "context": "sg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'skin-to-skin/2-hours') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "skin-to-skin-observation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Skin-to-skin observation"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Skin-to-skin observation — at 2 hours"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8867_44",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/2-hours/heart-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8867-4"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Heart rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_8310_54",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/2-hours/temperature') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "8310-5"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body temperature"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_9279_14",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/2-hours/respiratory-rate') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "9279-1"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory rate"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_colour4",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/2-hours/colour') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-colour"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Colour"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_skin_to_skin_position_sniffing4",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'skin-to-skin/2-hours/position-sniffing') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "skin-to-skin-position-sniffing"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Position: sniffing"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "breastFedObservation",
              "source": [
                {
                  "context": "sg",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'skin-to-skin/breast-fed-first-hour') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "63895-7"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Breastfeeding status"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Breast fed in the first hour"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "codedValue",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "cv"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "variable": "cc",
                          "transform": "create",
                          "parameter": [
                            {
                              "valueString": "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "rule": [
                        {
                          "name": "valueCoding",
                          "source": [
                            {
                              "context": "cv"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "cv"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "valueText",
                          "source": [
                            {
                              "context": "cv",
                              "element": "display",
                              "variable": "d"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "d"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Skin-to-skin, one Observation per timed round ───────────────────────\r\nFour rounds in the first two hours. One Observation each rather than one\r\npanel of twenty components, because these are a time series: the point of\r\ncharting a heart rate at fifteen and thirty minutes and one and two hours is\r\nto see it change, and a single Observation cannot hold four effective times.\r\nEach carries its offset from birth as the code text, since the chart gives\r\nthe offset rather than a clock time and the response's authored time is when\r\nthe form was written, not when the reading was taken."
        },
        {
          "name": "immediateCarePanel",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "(linkId = 'immediate-care') and item.answer.value.exists()"
            }
          ],
          "target": [
            {
              "context": "bundle",
              "element": "entry",
              "variable": "entry"
            },
            {
              "context": "entry",
              "element": "resource",
              "variable": "obs",
              "transform": "create",
              "parameter": [
                {
                  "valueString": "Observation"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "base",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                },
                {
                  "context": "entry"
                }
              ],
              "dependent": [
                {
                  "name": "BuildObsBase",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    },
                    {
                      "valueId": "entry"
                    }
                  ]
                }
              ]
            },
            {
              "name": "category",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "obs"
                }
              ],
              "dependent": [
                {
                  "name": "SetSurveyCategory",
                  "parameter": [
                    {
                      "valueId": "qr"
                    },
                    {
                      "valueId": "obs"
                    }
                  ]
                }
              ]
            },
            {
              "name": "code",
              "source": [
                {
                  "context": "g"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "code",
                  "variable": "cc"
                }
              ],
              "rule": [
                {
                  "name": "coding",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "coding",
                      "variable": "cg"
                    }
                  ],
                  "rule": [
                    {
                      "name": "sys",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "system",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "cd",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "code",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "essential-newborn-care-given"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "dsp",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cg",
                          "element": "display",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Essential newborn care given"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_obvious_malformation",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/obvious-malformation') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-obvious-malformation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Obvious malformation"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_delayed_cord_clamp",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/delayed-cord-clamp') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-delayed-cord-clamp"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Delayed cord clamp"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_sero_exposed",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/sero-exposed') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-sero-exposed"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Sero-exposed"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_arvs_started",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/arvs-started') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-arvs-started"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "ARVs started"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_eye_care",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/eye-care') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-eye-care"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Eye care"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_vitamin_k",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/vitamin-k') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-vitamin-k"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Vitamin K"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "comp_newborn_care_cord_care_with_chlorhexidine",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'immediate-care/cord-care-with-chx') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "component",
                  "variable": "comp"
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-care-cord-care-with-chlorhexidine"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Cord care with chlorhexidine"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "value",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "comp"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetComponentCodedValue",
                      "parameter": [
                        {
                          "valueId": "it"
                        },
                        {
                          "valueId": "comp"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Immediate newborn care given ────────────────────────────────────────\r\nOne panel, not Immunization or MedicationAdministration resources. The\r\nchart ticks that vitamin K, eye ointment, chlorhexidine cord care, delayed\r\nclamping and ARVs were given and records no dose, no route and no time.\r\nA MedicationAdministration built from a tick claims a dose nobody gave."
        },
        {
          "name": "followUpGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "fg",
              "condition": "linkId = 'follow-up'"
            }
          ],
          "rule": [
            {
              "name": "followUpRound",
              "source": [
                {
                  "context": "fg",
                  "element": "item",
                  "variable": "g",
                  "condition": "(linkId = 'follow-up/round') and item.answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetExamCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "g"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "g"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-follow-up-round"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "g"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Newborn follow-up round"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "roundDateRule",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "d",
                      "condition": "linkId = 'follow-up/round/date'"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "d",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "roundDate",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "dt"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "effective",
                              "transform": "cast",
                              "parameter": [
                                {
                                  "valueId": "dt"
                                },
                                {
                                  "valueString": "dateTime"
                                }
                              ]
                            }
                          ],
                          "documentation": "Observation.effective[x] takes dateTime, Period, Timing or instant\r\nand no date, so the round's date is cast rather than copied."
                        }
                      ]
                    }
                  ],
                  "documentation": "The round's own date overrides the base group's effective time."
                },
                {
                  "name": "roundPerformerRule",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "s",
                      "condition": "(linkId = 'follow-up/round/staff') and answer.value.exists()"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "s",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "roundPerformer",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "ref"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "performer",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "ref"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "Which staff member did the round overrides the response's source, so a\r\nchart filled in at the end of a shift still attributes each round."
                },
                {
                  "name": "comp_newborn_round_round_of_the_day",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/shift') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-round-of-the-day"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Round of the day"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_day_of_life",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/day-of-life') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-day-of-life"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Day of life"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_respiratory",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/respiratory') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-respiratory"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Respiratory"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_breastfeeding",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/breastfeeding') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-breastfeeding"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Breastfeeding"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_cord_condition",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/cord') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "cord-condition"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Cord condition"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_grade_jaundice_grade",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/jaundice') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "grade-jaundice-grade"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Jaundice grade"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentCodedValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_tone",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/tone') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-tone"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Tone"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_fontanelle",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/fontanelle') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-fontanelle"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Fontanelle"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_urine",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/urine') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-urine"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Urine"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_stool",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/stool') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-stool"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Stool"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_newborn_round_eyes",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/eyes') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "newborn-round-eyes"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Eyes"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "comp_29463_7",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "(linkId = 'follow-up/round/weight') and answer.value.exists()"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "component",
                      "variable": "comp"
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp",
                          "element": "code",
                          "variable": "cc"
                        }
                      ],
                      "rule": [
                        {
                          "name": "coding",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "variable": "cg"
                            }
                          ],
                          "rule": [
                            {
                              "name": "sys",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "system",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "http://loinc.org"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "cd",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "code",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "29463-7"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name": "dsp",
                              "source": [
                                {
                                  "context": "it"
                                }
                              ],
                              "target": [
                                {
                                  "context": "cg",
                                  "element": "display",
                                  "transform": "copy",
                                  "parameter": [
                                    {
                                      "valueString": "Body weight"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "value",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "comp"
                        }
                      ],
                      "dependent": [
                        {
                          "name": "SetComponentValue",
                          "parameter": [
                            {
                              "valueId": "it"
                            },
                            {
                              "valueId": "comp"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "note",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "it",
                      "condition": "linkId = 'follow-up/round/remarks'"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "it",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "text",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "txt"
                            }
                          ],
                          "target": [
                            {
                              "context": "obs",
                              "element": "note",
                              "variable": "n"
                            },
                            {
                              "context": "n",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "txt"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Newborn follow-up, one Observation per round ────────────────────────\r\nThe chart is a grid of morning, evening and night over four days. The\r\nquestionnaire takes it as a repeating group, and each repeat becomes one\r\nObservation whose effective time is the round's own date -- not the\r\nresponse's authored time, which would collapse twelve rounds onto one\r\ninstant and make the chart unreadable."
        },
        {
          "name": "resuscitationGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'resuscitation'"
            }
          ],
          "rule": [
            {
              "name": "resuscitationProcedure",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'resuscitation/done') and (answer.value.ofType(Coding).code = 'Y')"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "proc",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Procedure"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildProcedureBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "proc"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "status",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc",
                      "element": "status",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "completed"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "newborn-resuscitation"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Resuscitation of a newborn"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation": "A local code, not SNOMED. SNOMED almost certainly has a concept for\r\nnewborn resuscitation, but tx.fhir.org's expansion endpoint ignores a\r\ntext filter on the SNOMED implicit value set, so it could only have\r\nbeen guessed at -- and a guessed SNOMED code is worse than a local one,\r\nbecause everyone downstream trusts SNOMED and nobody re-checks it."
                },
                {
                  "name": "occurrence",
                  "source": [
                    {
                      "context": "qr",
                      "element": "authored",
                      "variable": "t"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc",
                      "element": "occurrence",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "t"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "encounter",
                  "source": [
                    {
                      "context": "qr",
                      "element": "encounter",
                      "variable": "e"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc",
                      "element": "encounter",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "e"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "performer",
                  "source": [
                    {
                      "context": "qr",
                      "element": "source",
                      "variable": "src"
                    }
                  ],
                  "target": [
                    {
                      "context": "proc",
                      "element": "performer",
                      "variable": "p"
                    },
                    {
                      "context": "p",
                      "element": "actor",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "src"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "specifyRule",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "sp",
                      "condition": "linkId = 'resuscitation/specify'"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "sp",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "specifyNote",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "txt"
                            }
                          ],
                          "target": [
                            {
                              "context": "proc",
                              "element": "note",
                              "variable": "n"
                            },
                            {
                              "context": "n",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "txt"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "durationRule",
                  "source": [
                    {
                      "context": "g",
                      "element": "item",
                      "variable": "du",
                      "condition": "(linkId = 'resuscitation/duration') and answer.value.exists()"
                    }
                  ],
                  "rule": [
                    {
                      "name": "answer",
                      "source": [
                        {
                          "context": "du",
                          "element": "answer",
                          "listMode": "first",
                          "variable": "a"
                        }
                      ],
                      "rule": [
                        {
                          "name": "durationRef",
                          "source": [
                            {
                              "context": "a",
                              "element": "value",
                              "variable": "v"
                            }
                          ],
                          "target": [
                            {
                              "context": "proc",
                              "element": "report",
                              "variable": "rep"
                            },
                            {
                              "context": "rep",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Resuscitation duration recorded on the newborn observation chart"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Resuscitation ───────────────────────────────────────────────────────\r\nA Procedure, and only when it was actually done. `status = 'completed'`\r\nbecause the chart is written after the event, and the duration becomes\r\nProcedure.occurrenceTiming.repeat.duration rather than a note, so it can be\r\naudited across births."
        },
        {
          "name": "dischargeGroup",
          "source": [
            {
              "context": "qr",
              "element": "item",
              "variable": "g",
              "condition": "linkId = 'discharge'"
            }
          ],
          "rule": [
            {
              "name": "measure_29463_7",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'discharge/weight') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetVitalSignsCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "29463-7"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "Body weight"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "set",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "v"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "v"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name": "dischargeImmunisationObservation",
              "source": [
                {
                  "context": "g",
                  "element": "item",
                  "variable": "it",
                  "condition": "(linkId = 'discharge/immunisation-given') and answer.value.exists()"
                }
              ],
              "target": [
                {
                  "context": "bundle",
                  "element": "entry",
                  "variable": "entry"
                },
                {
                  "context": "entry",
                  "element": "resource",
                  "variable": "obs",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "base",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    },
                    {
                      "context": "entry"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "BuildObsBase",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        },
                        {
                          "valueId": "entry"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "category",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs"
                    }
                  ],
                  "dependent": [
                    {
                      "name": "SetSurveyCategory",
                      "parameter": [
                        {
                          "valueId": "qr"
                        },
                        {
                          "valueId": "obs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "it"
                    }
                  ],
                  "target": [
                    {
                      "context": "obs",
                      "element": "code",
                      "variable": "cc"
                    }
                  ],
                  "rule": [
                    {
                      "name": "coding",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "coding",
                          "variable": "cg"
                        }
                      ],
                      "rule": [
                        {
                          "name": "sys",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "system",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "http://loinc.org"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "cd",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "code",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "11369-6"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "dsp",
                          "source": [
                            {
                              "context": "it"
                            }
                          ],
                          "target": [
                            {
                              "context": "cg",
                              "element": "display",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueString": "History of Immunization note"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name": "codeText",
                      "source": [
                        {
                          "context": "it"
                        }
                      ],
                      "target": [
                        {
                          "context": "cc",
                          "element": "text",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueString": "Immunisation given before discharge"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "answer",
                  "source": [
                    {
                      "context": "it",
                      "element": "answer",
                      "listMode": "first",
                      "variable": "a"
                    }
                  ],
                  "rule": [
                    {
                      "name": "codedValue",
                      "source": [
                        {
                          "context": "a",
                          "element": "value",
                          "variable": "cv"
                        }
                      ],
                      "target": [
                        {
                          "context": "obs",
                          "element": "value",
                          "variable": "cc",
                          "transform": "create",
                          "parameter": [
                            {
                              "valueString": "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "rule": [
                        {
                          "name": "valueCoding",
                          "source": [
                            {
                              "context": "cv"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "coding",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "cv"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name": "valueText",
                          "source": [
                            {
                              "context": "cv",
                              "element": "display",
                              "variable": "d"
                            }
                          ],
                          "target": [
                            {
                              "context": "cc",
                              "element": "text",
                              "transform": "copy",
                              "parameter": [
                                {
                                  "valueId": "d"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "── Discharge ───────────────────────────────────────────────────────────"
        }
      ]
    },
    {
      "name": "BuildObsBase",
      "documentation": "─────────────────────────────────────────────────────────────────────────────\r\nShared scaffolding. Repeated in each map rather than imported: the transform\r\nengine resolves `imports` against whatever StructureMaps happen to be on the\r\nserver, and a form that stops extracting because a shared map was not\r\nuploaded is a worse failure than a duplicated group.\r\nTwo notes on what the publisher's StructureMap validator says about this file.\r\nSource parameters below are left untyped on purpose. Writing `: Element` makes\r\nthe validator compare QuestionnaireResponse.item against the literal 'Element'\r\nand report them as incompatible with each other, which is noise, not a finding.\r\n`evaluate(context, expression)` is flagged as \"takes 1 parameter but 2 were\r\nfound\". Leave it. The FML parser in the same jar refuses the one-argument form\r\noutright -- it wants a parameter, a comma, then the FHIRPath -- so the\r\npublisher is objecting to what its own compiler emits. Two arguments is the\r\nonly form that compiles, and it is what the R5 transform engine executes.\r\n─────────────────────────────────────────────────────────────────────────────",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "responseProvenance",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs"
            }
          ],
          "dependent": [
            {
              "name": "SetResponseProvenance",
              "parameter": [
                {
                  "valueId": "qr"
                },
                {
                  "valueId": "obs"
                }
              ]
            }
          ]
        },
        {
          "name": "idAndFullUrl",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "id",
              "transform": "uuid"
            }
          ],
          "dependent": [
            {
              "name": "SetObservationFullUrl",
              "parameter": [
                {
                  "valueId": "obs"
                },
                {
                  "valueId": "entry"
                }
              ]
            }
          ]
        },
        {
          "name": "entryRequest",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "request",
              "variable": "request"
            }
          ],
          "rule": [
            {
              "name": "requestMethod",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "method",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "POST"
                    }
                  ]
                }
              ]
            },
            {
              "name": "requestUrl",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "url",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "Observation"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "status",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "status",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "final"
                }
              ]
            }
          ]
        },
        {
          "name": "subject",
          "source": [
            {
              "context": "qr",
              "element": "subject",
              "variable": "s"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "subject",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "s"
                }
              ]
            }
          ]
        },
        {
          "name": "encounter",
          "source": [
            {
              "context": "qr",
              "element": "encounter",
              "variable": "e"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "encounter",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "e"
                }
              ]
            }
          ]
        },
        {
          "name": "effective",
          "source": [
            {
              "context": "qr",
              "element": "authored",
              "variable": "t"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "effective",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "t"
                }
              ]
            }
          ]
        },
        {
          "name": "performerFromSource",
          "source": [
            {
              "context": "qr",
              "element": "source",
              "variable": "src"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "performer",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "src"
                }
              ]
            }
          ]
        },
        {
          "name": "performerFallback",
          "source": [
            {
              "context": "qr",
              "condition": "source.exists().not()"
            }
          ],
          "rule": [
            {
              "name": "performerFromAuthor",
              "source": [
                {
                  "context": "qr",
                  "element": "author",
                  "variable": "a"
                }
              ],
              "target": [
                {
                  "context": "obs",
                  "element": "performer",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "a"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "linkQuestionnaireResponse",
          "source": [
            {
              "context": "qr",
              "element": "id",
              "variable": "qid",
              "condition": "$this.hasValue()"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "derivedFrom",
              "variable": "ref",
              "transform": "create",
              "parameter": [
                {
                  "valueString": "Reference"
                }
              ]
            },
            {
              "context": "ref",
              "element": "reference",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "qid"
                }
              ]
            }
          ],
          "documentation": "A stored response's id already reads \"QuestionnaireResponse/<id>\", so it is\r\na relative reference as it stands. The hasValue() guard is what stops an\r\nunsaved response -- one posted straight to $extract rather than saved first\r\n-- from writing \"QuestionnaireResponse/null\" into the record."
        }
      ]
    },
    {
      "name": "SetObservationFullUrl",
      "input": [
        {
          "name": "obs",
          "type": "Observation",
          "mode": "source"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "assignFullUrl",
          "source": [
            {
              "context": "obs",
              "element": "id",
              "variable": "id"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "fullUrl",
              "transform": "append",
              "parameter": [
                {
                  "valueString": "https://fhir.slade360.co.ke/fhir/Observation/"
                },
                {
                  "valueId": "id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetComponentCodedValue",
      "documentation": "The two answer shapes a component can carry. Both read the answer through the\r\nuntyped `.value` accessor: reading `valueCoding` or `valueQuantity` by its\r\ntyped property name fails at transform time on HAPI R5 with \"Attempt to read\r\ninvalid property ... on QuestionnaireResponse.item.answer\".",
      "input": [
        {
          "name": "it",
          "mode": "source"
        },
        {
          "name": "comp",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "componentAnswer",
          "source": [
            {
              "context": "it",
              "element": "answer",
              "listMode": "first",
              "variable": "a"
            }
          ],
          "rule": [
            {
              "name": "codedValue",
              "source": [
                {
                  "context": "a",
                  "element": "value",
                  "variable": "cv"
                }
              ],
              "target": [
                {
                  "context": "comp",
                  "element": "value",
                  "variable": "cc",
                  "transform": "create",
                  "parameter": [
                    {
                      "valueString": "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "valueCoding",
                  "source": [
                    {
                      "context": "cv"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "coding",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "cv"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "valueText",
                  "source": [
                    {
                      "context": "cv",
                      "element": "display",
                      "variable": "d"
                    }
                  ],
                  "target": [
                    {
                      "context": "cc",
                      "element": "text",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "d"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetComponentValue",
      "input": [
        {
          "name": "it",
          "mode": "source"
        },
        {
          "name": "comp",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "componentAnswer",
          "source": [
            {
              "context": "it",
              "element": "answer",
              "listMode": "first",
              "variable": "a"
            }
          ],
          "rule": [
            {
              "name": "plainValue",
              "source": [
                {
                  "context": "a",
                  "element": "value",
                  "variable": "v"
                }
              ],
              "target": [
                {
                  "context": "comp",
                  "element": "value",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "v"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetSurveyCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "survey"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Survey"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetVitalSignsCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "vital-signs"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Vital Signs"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetExamCategory",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "obs",
          "type": "Observation",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "category",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "obs",
              "element": "category",
              "variable": "cat"
            }
          ],
          "rule": [
            {
              "name": "categoryCoding",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "cat",
                  "element": "coding",
                  "variable": "coding"
                }
              ],
              "rule": [
                {
                  "name": "categorySystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "exam"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "categoryDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "coding",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Exam"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "BuildProcedureBase",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "r",
          "type": "Procedure",
          "mode": "target"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "responseProvenance",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r"
            }
          ],
          "dependent": [
            {
              "name": "SetResponseProvenance",
              "parameter": [
                {
                  "valueId": "qr"
                },
                {
                  "valueId": "r"
                }
              ]
            }
          ]
        },
        {
          "name": "idAndFullUrl",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "id",
              "transform": "uuid"
            }
          ],
          "dependent": [
            {
              "name": "SetProcedureFullUrl",
              "parameter": [
                {
                  "valueId": "r"
                },
                {
                  "valueId": "entry"
                }
              ]
            }
          ]
        },
        {
          "name": "entryRequest",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "request",
              "variable": "request"
            }
          ],
          "rule": [
            {
              "name": "requestMethod",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "method",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "POST"
                    }
                  ]
                }
              ]
            },
            {
              "name": "requestUrl",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "request",
                  "element": "url",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueString": "Procedure"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "occurrenceFallback",
          "source": [
            {
              "context": "qr",
              "element": "authored",
              "variable": "t"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "occurrence",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "t"
                }
              ]
            }
          ],
          "documentation": "The response's own time, as a floor, the way BuildObsBase does it. A rule\r\nthat reads a time off the form overwrites this; without it a procedure whose\r\ndate column was taken off on review has no time at all, and a procedure with\r\nno time cannot be ordered against the rest of the admission."
        },
        {
          "name": "subject",
          "source": [
            {
              "context": "qr",
              "element": "subject",
              "variable": "s"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "subject",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "s"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetProcedureFullUrl",
      "input": [
        {
          "name": "r",
          "type": "Procedure",
          "mode": "source"
        },
        {
          "name": "entry",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "assignFullUrl",
          "source": [
            {
              "context": "r",
              "element": "id",
              "variable": "id"
            }
          ],
          "target": [
            {
              "context": "entry",
              "element": "fullUrl",
              "transform": "append",
              "parameter": [
                {
                  "valueString": "https://fhir.slade360.co.ke/fhir/Procedure/"
                },
                {
                  "valueId": "id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "SetResponseProvenance",
      "documentation": "── Provenance and tenancy ───────────────────────────────────────────────────\r\nTwo tags on everything this map creates. The first says which questionnaire\r\nproduced it, so a form that reopens mid-admission recalls its own earlier\r\nentries and not another form's. The second copies the tenant tags off the\r\nresponse, because nothing else on the path puts them there.\r\nThe code is the form's document type, not the questionnaire's id: every\r\nenvironment mints its own ids, and there is only one set of maps, so an id\r\nhere would tie the tag to whichever environment stamped it.\r\n── Provenance and tenancy ───────────────────────────────────────────────────",
      "input": [
        {
          "name": "qr",
          "type": "QR",
          "mode": "source"
        },
        {
          "name": "r",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "provenanceMeta",
          "source": [
            {
              "context": "qr"
            }
          ],
          "target": [
            {
              "context": "r",
              "element": "meta",
              "variable": "m"
            }
          ],
          "rule": [
            {
              "name": "provenanceTag",
              "source": [
                {
                  "context": "qr"
                }
              ],
              "target": [
                {
                  "context": "m",
                  "element": "tag",
                  "variable": "t"
                }
              ],
              "rule": [
                {
                  "name": "provenanceSystem",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "system",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "http://slade360edi.com/questionnaire-provenance"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "provenanceCode",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "code",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "newborn-observation-chart"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "provenanceDisplay",
                  "source": [
                    {
                      "context": "qr"
                    }
                  ],
                  "target": [
                    {
                      "context": "t",
                      "element": "display",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueString": "Newborn observation chart"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "tenantTags",
          "source": [
            {
              "context": "qr",
              "element": "meta",
              "variable": "qm"
            }
          ],
          "rule": [
            {
              "name": "copyTag",
              "source": [
                {
                  "context": "qm",
                  "element": "tag",
                  "variable": "qt"
                }
              ],
              "target": [
                {
                  "context": "r",
                  "element": "meta",
                  "variable": "m"
                },
                {
                  "context": "m",
                  "element": "tag",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "qt"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "Every tag the response carries, onto the resource. `meta` is 0..1, so this\r\nlands on the same meta the rule above created rather than a second one."
        }
      ]
    }
  ]
}