SGHI FHIR Profile Implementation Guide
0.1.0 - ci-build
SGHI FHIR Profile Implementation Guide, published by Kathurima Kimathi. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/savannahghi/sil_fhir_profile_ig/ and changes regularly. See the Directory of published versions
| Active as of 2026-09-14 |
<StructureMap xmlns="http://hl7.org/fhir">
<id value="ExtractNewbornAdmissionRecord"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap ExtractNewbornAdmissionRecord</b></p><a name="ExtractNewbornAdmissionRecord"> </a><a name="hcExtractNewbornAdmissionRecord"> </a><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractNewbornAdmissionRecord'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'ExtractNewbornAdmissionRecord'</span>
<span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'Newborn Admission Record Extraction'</span>
<span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>
<span style="color: #cc00cc">/// <b>description</b> = </span><span style="color: blue">'The newborn unit\'s admission record out as: the birth and current measurements each as their own Observation, so a weight chart can graph them from the first day; the intranatal and newborn history as one panel; the newborn examination as a second panel with its graded findings coded and its rates as quantities; the Apgar carried over from the delivery record as two Observations under the LOINC score codes; a Condition per admission diagnosis; a CarePlan for the supportive care planned; and a Consent from the parent\'s signature.'</span>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/questionnaireresponse.html" title="QuestionnaireResponse">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style="color: navy">" </span><b>alias </b>QR <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/bundle.html" title="Bundle">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style="color: navy">" </span><b>alias </b>Bundle <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/observation.html" title="Observation">http://hl7.org/fhir/StructureDefinition/Observation</a><span style="color: navy">" </span><b>alias </b>Observation <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/condition.html" title="Condition">http://hl7.org/fhir/StructureDefinition/Condition</a><span style="color: navy">" </span><b>alias </b>Condition <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/careplan.html" title="CarePlan">http://hl7.org/fhir/StructureDefinition/CarePlan</a><span style="color: navy">" </span><b>alias </b>CarePlan <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> "</span><a href="http://hl7.org/fhir/R5/consent.html" title="Consent">http://hl7.org/fhir/StructureDefinition/Consent</a><span style="color: navy">" </span><b>alias </b>Consent <b>as </b><b>target</b>
<b>group </b>ExtractNewbornAdmissionRecord<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle<span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>bundle.type = <span style="color: blue">'transaction'</span> <i>"setBundleType"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── The measurements ────────────────────────────────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">Birth weight and weight now are both LOINC-coded and both extracted: they</span>
<span style="color: navy">// </span><span style="color: green">are different facts, and the difference between them on day three is what</span>
<span style="color: navy">// </span><span style="color: green">tells physiological weight loss from failure to feed.</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>linkId = 'bio'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/birth-weight') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetVitalSignsCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'8339-4'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Birth weight Measured'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_8339_4"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/weight-now') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetVitalSignsCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'29463-7'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Body weight'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_29463_7"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/gestation') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetVitalSignsCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'11884-4'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Gestational age Estimated'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_11884_4"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/temperature') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetVitalSignsCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'8310-5'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Body temperature'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_8310_5"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/mode-of-delivery') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'cord-mode-of-delivery'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Mode of delivery'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">cv</span><span style="color: navy"><b> -> </b></span>obs.value = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CodeableConcept'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> cv<span style="color: navy"><b> -> </b></span>cc.coding = <span style="color: maroon">cv</span> <i>"valueCoding"</i><span style="color: navy">;</span>
cv.display<b> as </b><span style="color: maroon">d</span><span style="color: navy"><b> -> </b></span>cc.text = <span style="color: maroon">d</span> <i>"valueText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"codedValue"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coded_cord_condition"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'bio/place-of-birth') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'cord-place-of-birth'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Place of birth'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">cv</span><span style="color: navy"><b> -> </b></span>obs.value = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CodeableConcept'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> cv<span style="color: navy"><b> -> </b></span>cc.coding = <span style="color: maroon">cv</span> <i>"valueCoding"</i><span style="color: navy">;</span>
cv.display<b> as </b><span style="color: maroon">d</span><span style="color: navy"><b> -> </b></span>cc.text = <span style="color: maroon">d</span> <i>"valueText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"codedValue"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coded_cord_condition2"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"bioGroup"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Apgar carried over from the delivery record ─────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">Two Observations under the LOINC score codes, not components of anything.</span>
<span style="color: navy">// </span><span style="color: green">A five-minute Apgar is the single most-quoted number about a newborn and it</span>
<span style="color: navy">// </span><span style="color: green">has to be findable by its own code.</span>
<span style="color: navy">// </span><span style="color: green">No component breakdown here: this sheet copies the totals off the delivery</span>
<span style="color: navy">// </span><span style="color: green">record and does not ask for the five signs. The breakdown lives on the</span>
<span style="color: navy">// </span><span style="color: green">newborn observation chart, where it is actually assessed.</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>linkId = 'apgar-at-birth'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'apgar-at-birth/one-minute') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'9272-6'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'1 minute Apgar Score'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_9272_6"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'apgar-at-birth/five-minutes') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'9274-2'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'5 minute Apgar Score'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>obs.value = <span style="color: maroon">v</span> <i>"set"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"measure_9274_2"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"apgarGroup"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── The history, as one panel ───────────────────────────────────────────</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>(linkId = 'history') and item.answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'10164-2'</span> <i>"cd"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'History of Present illness Narrative'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cc.text = <span style="color: blue">'Newborn history on admission'</span> <i>"codeText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/prolonged-rom') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-prolonged-rupture-of-membranes-over-24-hours'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Prolonged rupture of membranes over 24 hours'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_prolonged_rupture_of_membranes_over_24_hours"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/fever') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-fever'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Fever'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_fever"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/difficulty-breathing') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-difficulty-breathing'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Difficulty breathing'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_difficulty_breathing"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/apnoeas') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-apnoeas'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Apnoeas'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_apnoeas"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/diarrhoea') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-diarrhoea'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Diarrhoea'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_diarrhoea"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/convulsions') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-convulsions'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Convulsions'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_convulsions"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/partial-focal-fits') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-partial-or-focal-fits'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Partial or focal fits'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_partial_or_focal_fits"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/high-pitched-cry') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-high-pitched-cry'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'High pitched cry'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_high_pitched_cry"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/difficulty-feeding') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-difficulty-feeding'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Difficulty feeding'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_difficulty_feeding"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/severe-vomiting') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-severe-vomiting'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Severe vomiting'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_severe_vomiting"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/length-of-illness') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-length-of-illness-in-days'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Length of illness in days'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_length_of_illness_in_days"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'history/maternal-hiv-status') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'maternal-hiv-status'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Maternal HIV status'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_maternal_hiv_status"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>linkId = 'history/maternal-and-infant-drugs'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">txt</span><span style="color: navy"><b> -> </b></span> obs.note<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.text = <span style="color: maroon">txt</span> <i>"text"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"note"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"panel_10164_2"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── The newborn examination, as one panel ───────────────────────────────</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination') and item.item.answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetExamCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'8716-3'</span> <i>"cd"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Vital signs note'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cc.text = <span style="color: blue">'Newborn examination on admission'</span> <i>"codeText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">g2</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/breathing'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/breathing/central-cyanosis') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-central-cyanosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Central cyanosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_central_cyanosis"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/breathing/severe-indrawing') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-severe-indrawing'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Severe indrawing'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_severe_indrawing"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/breathing/grunting') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-grunting'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Grunting'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_grunting"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/breathing/crackles') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-crackles'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Crackles'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_crackles"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/breathing/respiratory-rate') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'9279-1'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Respiratory rate'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_9279_1"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examSub"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">g2</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/circulation'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/circulation/heart-rate') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'8867-4'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Heart rate'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_8867_4"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/circulation/capillary-refill') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-capillary-refill-band'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Capillary refill band'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_capillary_refill_band"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/circulation/pallor') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'grade-pallor-or-anaemia-grade'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Pallor or anaemia grade'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_grade_pallor_or_anaemia_grade"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examSub2"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">g2</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/dehydration'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/dehydration/skin-pinch') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'skin-pinch-time'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Skin pinch return time'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_skin_pinch_time"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examSub3"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">g2</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/disability'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/disability/floppy-or-unable-to-suck') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-floppy-or-unable-to-suck'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Floppy, or unable to suck'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_floppy_or_unable_to_suck"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/disability/bulging-fontanelle') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-bulging-fontanelle'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Bulging fontanelle'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_bulging_fontanelle"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examSub4"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">g2</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/general'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/general/jaundice') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'grade-jaundice-grade'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Jaundice grade'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_grade_jaundice_grade"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/general/abdominal-distension') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-abdominal-distension'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Abdominal distension'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_abdominal_distension"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/general/umbilicus') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'umbilicus-appearance'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Umbilical stump appearance'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_umbilicus_appearance"</i><span style="color: navy">;</span>
g2.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'examination/general/severe-skin-pustules') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-severe-skin-pustules'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Severe skin pustules'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentCodedValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_severe_skin_pustules"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examSub5"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>linkId = 'examination/other'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">txt</span><span style="color: navy"><b> -> </b></span> obs.note<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.text = <span style="color: maroon">txt</span> <i>"text"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"note2"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"examinationPanel"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Admission diagnoses ─────────────────────────────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">The sheet prints eight named diagnoses as tick boxes plus two free-text</span>
<span style="color: navy">// </span><span style="color: green">lines. A ticked box becomes a Condition; the tick's own display is the</span>
<span style="color: navy">// </span><span style="color: green">diagnosis name, which is why the label travels in the rule rather than</span>
<span style="color: navy">// </span><span style="color: green">being read off the answer.</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>linkId = 'admission-diagnoses'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/birth-asphyxia') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Birth asphyxia'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_birth_asphyxia"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/meconium-aspiration') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Meconium aspiration'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_meconium_aspiration"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/premature-or-lbw') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Premature or low birth weight'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_premature_or_lbw"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/twin-delivery') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Twin delivery'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_twin_delivery"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/newborn-rds') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Newborn respiratory distress syndrome'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_newborn_rds"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/jaundice') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Jaundice'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_jaundice"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/neonatal-sepsis') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Neonatal sepsis'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_neonatal_sepsis"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'admission-diagnoses/meningitis') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: blue">'Meningitis'</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"dx_meningitis"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>linkId = 'admission-diagnoses/other'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> it.answer<b> as </b><span style="color: maroon">a</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Condition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cond</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> cond<span style="color: navy">, </span> entry<b> then </b>BuildConditionBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">cond</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cond.clinicalStatus<b> as </b><span style="color: maroon">cs</span><b> then</b><span style="color: navy"> {
</span> a<span style="color: navy"><b> -> </b></span>cs.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> a<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-clinical'</span> <i>"sys"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'active'</span> <i>"cd"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Active'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"clinicalStatus"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cond.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> a<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> a<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span> <i>"sys"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'encounter-diagnosis'</span> <i>"cd"</i><span style="color: navy">;</span>
a<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Encounter Diagnosis'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
a.value<b> as </b><span style="color: maroon">txt</span><span style="color: navy"><b> -> </b></span> cond.code<b> as </b><span style="color: maroon">cc</span><span style="color: navy">, </span> cc.text = <span style="color: maroon">txt</span> <i>"codeText"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>cond.recordedDate = <span style="color: maroon">t</span> <i>"recordedDate"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>cond.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"createOtherCondition"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"otherDiagnoses"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"admissionDiagnoses"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Investigations known and their results ──────────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">The sheet mixes orders and results on one block: it asks for the maternal</span>
<span style="color: navy">// </span><span style="color: green">VDRL *result*, not for a VDRL to be done. So these become laboratory</span>
<span style="color: navy">// </span><span style="color: green">Observations carrying what is known, not ServiceRequests -- ordering a test</span>
<span style="color: navy">// </span><span style="color: green">whose answer is already written on the sheet would be wrong twice over.</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations') and item.answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetLaboratoryCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'11502-2'</span> <i>"cd"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Laboratory report'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cc.text = <span style="color: blue">'Investigations known or ordered on admission'</span> <i>"codeText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/maternal-vdrl') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'maternal-vdrl-result'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Maternal VDRL result'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_maternal_vdrl_result"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/maternal-hiv') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'maternal-hiv-status'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Maternal HIV status'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_maternal_hiv_status2"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/hb-hct') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-haemoglobin-or-haematocrit'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Haemoglobin or haematocrit'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_haemoglobin_or_haematocrit"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/glucose') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'15074-8'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Glucose [Moles/volume] in Blood'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_15074_8"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/bilirubin') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-bilirubin'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Bilirubin'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_bilirubin"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'investigations/lumbar-puncture') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span>obs.component<b> as </b><span style="color: maroon">comp</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>comp.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'sign-lumbar-puncture'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Lumbar puncture'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>comp<b> then </b>SetComponentValue<span style="color: navy">(</span><span style="color: maroon">it</span><span style="color: navy">, </span><span style="color: maroon">comp</span><span style="color: navy">)</span> <i>"value"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"comp_sign_lumbar_puncture"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>linkId = 'investigations/other'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">txt</span><span style="color: navy"><b> -> </b></span> obs.note<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.text = <span style="color: maroon">txt</span> <i>"text"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"note3"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"investigationsPanel"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Supportive care planned ─────────────────────────────────────────────</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care') and item.answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CarePlan'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">plan</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> plan<span style="color: navy">, </span> entry<b> then </b>BuildCarePlanBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">plan</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>plan.status = <span style="color: blue">'active'</span> <i>"status"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>plan.intent = <span style="color: blue">'plan'</span> <i>"intent"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>plan.title = <span style="color: blue">'Supportive care on newborn admission'</span> <i>"title"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>plan.created = <span style="color: maroon">t</span> <i>"created"</i><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>plan.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
qr.source<b> as </b><span style="color: maroon">src</span><span style="color: navy"><b> -> </b></span>plan.custodian = <span style="color: maroon">src</span> <i>"custodian"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>plan.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> g<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/document-type-codesystem'</span> <i>"sys"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'newborn-admission-record'</span> <i>"cd"</i><span style="color: navy">;</span>
g<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Newborn admission record'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/vitamin-k-and-teo') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Vitamin K and tetracycline eye ointment'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_vitamin_k_and_teo"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/arvs-for-pmtct') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'ARVs for PMTCT'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_arvs_for_pmtct"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/nutrition-or-feeds') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Nutrition or feeds'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_nutrition_or_feeds"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/oxygen') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Oxygen'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_oxygen"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/iv-fluids') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'IV fluids'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_iv_fluids"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/blood-transfusion') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Blood transfusion'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_blood_transfusion"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/incubator-or-keep-warm') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Incubator or keep warm'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_incubator_or_keep_warm"</i><span style="color: navy">;</span>
g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'supportive-care/phototherapy') and (answer.value.ofType(Coding).code = 'Y')<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> plan.activity<b> as </b><span style="color: maroon">act</span><span style="color: navy">, </span> act.plannedActivityReference = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>ref.display = <span style="color: blue">'Phototherapy'</span> <i>"activityDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"care_phototherapy"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"supportiveCarePlan"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Presenting problems ─────────────────────────────────────────────────</span>
qr.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'presenting-problems') and answer.value.exists()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obs</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> obs<span style="color: navy">, </span> entry<b> then </b>BuildObsBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetSurveyCategory<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>obs.code<b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cc.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://loinc.org'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'10154-3'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Chief complaint Narrative - Reported'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"code"</i><span style="color: navy">;</span>
it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">txt</span><span style="color: navy"><b> -> </b></span> obs.note<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.text = <span style="color: maroon">txt</span> <i>"text"</i><span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"presentingProblemsObservation"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">── Consent for admission ───────────────────────────────────────────────</span>
qr.item<b> as </b><span style="color: maroon">g</span><b> where </b><span style="color: navy">(</span>linkId = 'sign-off'<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> g.item<b> as </b><span style="color: maroon">it</span><b> where </b><span style="color: navy">(</span>(linkId = 'sign-off/consent-for-admission') and (answer.value = true)<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Consent'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">consent</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span> consent<span style="color: navy">, </span> entry<b> then </b>BuildConsentBase<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">consent</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"base"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>consent.status = <span style="color: blue">'active'</span> <i>"status"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>consent.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">cg</span><b> then</b><span style="color: navy"> {
</span> it<span style="color: navy"><b> -> </b></span>cg.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/consentcategorycodes'</span> <i>"sys"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.code = <span style="color: blue">'acd'</span> <i>"cd"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cg.display = <span style="color: blue">'Advance Directive'</span> <i>"dsp"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"coding"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>cat.text = <span style="color: blue">'Consent for admission and procedures by the parent or guardian'</span> <i>"categoryText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span>consent.decision = <span style="color: blue">'permit'</span> <i>"decision"</i><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span> consent.period<b> as </b><span style="color: maroon">per</span><span style="color: navy">, </span> per.start = <span style="color: maroon">t</span> <i>"consentPeriodStart"</i><span style="color: navy">;</span>
qr.source<b> as </b><span style="color: maroon">src</span><span style="color: navy"><b> -> </b></span>consent.grantee = <span style="color: maroon">src</span> <i>"grantee"</i><span style="color: navy">;</span>
it<span style="color: navy"><b> -> </b></span> consent.provision<b> as </b><span style="color: maroon">prov</span><span style="color: navy">, </span> prov.code<b> as </b><span style="color: maroon">pc</span><span style="color: navy">, </span> pc.text = <span style="color: blue">'Taken on the newborn admission record. The parent or guardian signed the sheet; this records that the signature was obtained, not the signature itself.'</span> <i>"provenanceNote"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"createConsent"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"consentGroup"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><span style="color: navy">// </span><span style="color: green">─────────────────────────────────────────────────────────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">Shared scaffolding. Repeated in each map rather than imported: the transform</span>
<span style="color: navy">// </span><span style="color: green">engine resolves `imports` against whatever StructureMaps happen to be on the</span>
<span style="color: navy">// </span><span style="color: green">server, and a form that stops extracting because a shared map was not</span>
<span style="color: navy">// </span><span style="color: green">uploaded is a worse failure than a duplicated group.</span>
<span style="color: navy">// </span><span style="color: green">Two notes on what the publisher's StructureMap validator says about this file.</span>
<span style="color: navy">// </span><span style="color: green">Source parameters below are left untyped on purpose. Writing `: Element` makes</span>
<span style="color: navy">// </span><span style="color: green">the validator compare QuestionnaireResponse.item against the literal 'Element'</span>
<span style="color: navy">// </span><span style="color: green">and report them as incompatible with each other, which is noise, not a finding.</span>
<span style="color: navy">// </span><span style="color: green">`evaluate(context, expression)` is flagged as "takes 1 parameter but 2 were</span>
<span style="color: navy">// </span><span style="color: green">found". Leave it. The FML parser in the same jar refuses the one-argument form</span>
<span style="color: navy">// </span><span style="color: green">outright -- it wants a parameter, a comma, then the FHIRPath -- so the</span>
<span style="color: navy">// </span><span style="color: green">publisher is objecting to what its own compiler emits. Two arguments is the</span>
<span style="color: navy">// </span><span style="color: green">only form that compiles, and it is what the R5 transform engine executes.</span>
<span style="color: navy">// </span><span style="color: green">─────────────────────────────────────────────────────────────────────────────</span>
<b>group </b>BuildObsBase<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>obs<b> then </b>SetResponseProvenance<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">obs</span><span style="color: navy">)</span> <i>"responseProvenance"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> then </b>SetObservationFullUrl<span style="color: navy">(</span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"idAndFullUrl"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>entry.request<b> as </b><span style="color: maroon">request</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>request.method = <span style="color: blue">'POST'</span> <i>"requestMethod"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>request.url = <span style="color: blue">'Observation'</span> <i>"requestUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"entryRequest"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>obs.status = <span style="color: blue">'final'</span> <i>"status"</i><span style="color: navy">;</span>
qr.subject<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -> </b></span>obs.subject = <span style="color: maroon">s</span><span style="color: navy">;</span>
qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -> </b></span>obs.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -> </b></span>obs.effective = <span style="color: maroon">t</span> <i>"effective"</i><span style="color: navy">;</span>
qr.source<b> as </b><span style="color: maroon">src</span><span style="color: navy"><b> -> </b></span>obs.performer = <span style="color: maroon">src</span> <i>"performerFromSource"</i><span style="color: navy">;</span>
qr<b> where </b><span style="color: navy">(</span>source.exists().not()<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span> qr.author<b> as </b><span style="color: maroon">a</span><span style="color: navy"><b> -> </b></span>obs.performer = <span style="color: maroon">a</span> <i>"performerFromAuthor"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"performerFallback"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">A stored response's id already reads "QuestionnaireResponse/<id>", so it is</span>
<span style="color: navy">// </span><span style="color: green">a relative reference as it stands. The hasValue() guard is what stops an</span>
<span style="color: navy">// </span><span style="color: green">unsaved response -- one posted straight to $extract rather than saved first</span>
<span style="color: navy">// </span><span style="color: green">-- from writing "QuestionnaireResponse/null" into the record.</span>
qr.id<b> as </b><span style="color: maroon">qid</span><b> where </b><span style="color: navy">(</span>$this.hasValue()<span style="color: navy">)</span><span style="color: navy"><b> -> </b></span> obs.derivedFrom = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ref</span><span style="color: navy">, </span> ref.reference = <span style="color: maroon">qid</span> <i>"linkQuestionnaireResponse"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetObservationFullUrl<span style="color: navy">(</span><b>source</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> obs.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -> </b></span>entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/Observation/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span> <i>"assignFullUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><span style="color: navy">// </span><span style="color: green">The two answer shapes a component can carry. Both read the answer through the</span>
<span style="color: navy">// </span><span style="color: green">untyped `.value` accessor: reading `valueCoding` or `valueQuantity` by its</span>
<span style="color: navy">// </span><span style="color: green">typed property name fails at transform time on HAPI R5 with "Attempt to read</span>
<span style="color: navy">// </span><span style="color: green">invalid property ... on QuestionnaireResponse.item.answer".</span>
<b>group </b>SetComponentCodedValue<span style="color: navy">(</span><b>source</b> <span style="color: maroon">it</span>, <b>target</b> <span style="color: maroon">comp</span><span style="color: navy">)</span><span style="color: navy"> {
</span> it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">cv</span><span style="color: navy"><b> -> </b></span>comp.value = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CodeableConcept'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cc</span><b> then</b><span style="color: navy"> {
</span> cv<span style="color: navy"><b> -> </b></span>cc.coding = <span style="color: maroon">cv</span> <i>"valueCoding"</i><span style="color: navy">;</span>
cv.display<b> as </b><span style="color: maroon">d</span><span style="color: navy"><b> -> </b></span>cc.text = <span style="color: maroon">d</span> <i>"valueText"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"codedValue"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"componentAnswer"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetComponentValue<span style="color: navy">(</span><b>source</b> <span style="color: maroon">it</span>, <b>target</b> <span style="color: maroon">comp</span><span style="color: navy">)</span><span style="color: navy"> {
</span> it.answer first<b> as </b><span style="color: maroon">a</span><b> then</b><span style="color: navy"> {
</span> a.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -> </b></span>comp.value = <span style="color: maroon">v</span> <i>"plainValue"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"componentAnswer"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetSurveyCategory<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>obs.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">coding</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>coding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>"categorySystem"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.code = <span style="color: blue">'survey'</span> <i>"categoryCode"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.display = <span style="color: blue">'Survey'</span> <i>"categoryDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"categoryCoding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetVitalSignsCategory<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>obs.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">coding</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>coding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>"categorySystem"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.code = <span style="color: blue">'vital-signs'</span> <i>"categoryCode"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.display = <span style="color: blue">'Vital Signs'</span> <i>"categoryDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"categoryCoding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetExamCategory<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>obs.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">coding</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>coding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>"categorySystem"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.code = <span style="color: blue">'exam'</span> <i>"categoryCode"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.display = <span style="color: blue">'Exam'</span> <i>"categoryDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"categoryCoding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetLaboratoryCategory<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>obs.category<b> as </b><span style="color: maroon">cat</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>cat.coding<b> as </b><span style="color: maroon">coding</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>coding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>"categorySystem"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.code = <span style="color: blue">'laboratory'</span> <i>"categoryCode"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>coding.display = <span style="color: blue">'Laboratory'</span> <i>"categoryDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"categoryCoding"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"category"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>BuildConditionBase<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>Condition, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>r<b> then </b>SetResponseProvenance<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">r</span><span style="color: navy">)</span> <i>"responseProvenance"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>r.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> then </b>SetConditionFullUrl<span style="color: navy">(</span><span style="color: maroon">r</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"idAndFullUrl"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>entry.request<b> as </b><span style="color: maroon">request</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>request.method = <span style="color: blue">'POST'</span> <i>"requestMethod"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>request.url = <span style="color: blue">'Condition'</span> <i>"requestUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"entryRequest"</i><span style="color: navy">;</span>
qr.subject<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -> </b></span>r.subject = <span style="color: maroon">s</span><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetConditionFullUrl<span style="color: navy">(</span><b>source</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>Condition, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> r.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -> </b></span>entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/Condition/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span> <i>"assignFullUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>BuildCarePlanBase<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>CarePlan, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>r<b> then </b>SetResponseProvenance<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">r</span><span style="color: navy">)</span> <i>"responseProvenance"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>r.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> then </b>SetCarePlanFullUrl<span style="color: navy">(</span><span style="color: maroon">r</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"idAndFullUrl"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>entry.request<b> as </b><span style="color: maroon">request</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>request.method = <span style="color: blue">'POST'</span> <i>"requestMethod"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>request.url = <span style="color: blue">'CarePlan'</span> <i>"requestUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"entryRequest"</i><span style="color: navy">;</span>
qr.subject<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -> </b></span>r.subject = <span style="color: maroon">s</span><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetCarePlanFullUrl<span style="color: navy">(</span><b>source</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>CarePlan, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> r.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -> </b></span>entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/CarePlan/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span> <i>"assignFullUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>BuildConsentBase<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>Consent, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>r<b> then </b>SetResponseProvenance<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">r</span><span style="color: navy">)</span> <i>"responseProvenance"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>r.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> then </b>SetConsentFullUrl<span style="color: navy">(</span><span style="color: maroon">r</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>"idAndFullUrl"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>entry.request<b> as </b><span style="color: maroon">request</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>request.method = <span style="color: blue">'POST'</span> <i>"requestMethod"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>request.url = <span style="color: blue">'Consent'</span> <i>"requestUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"entryRequest"</i><span style="color: navy">;</span>
qr.subject<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -> </b></span>r.subject = <span style="color: maroon">s</span><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>SetConsentFullUrl<span style="color: navy">(</span><b>source</b> <span style="color: maroon">r</span><span style="color: navy"> : </span>Consent, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
</span> r.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -> </b></span>entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/Consent/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span> <i>"assignFullUrl"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span><span style="color: navy">// </span><span style="color: green">── Provenance and tenancy ───────────────────────────────────────────────────</span>
<span style="color: navy">// </span><span style="color: green">Two tags on everything this map creates. The first says which questionnaire</span>
<span style="color: navy">// </span><span style="color: green">produced it, so a form that reopens mid-admission recalls its own earlier</span>
<span style="color: navy">// </span><span style="color: green">entries and not another form's. The second copies the tenant tags off the</span>
<span style="color: navy">// </span><span style="color: green">response, because nothing else on the path puts them there.</span>
<span style="color: navy">// </span><span style="color: green">The code is the form's document type, not the questionnaire's id: every</span>
<span style="color: navy">// </span><span style="color: green">environment mints its own ids, and there is only one set of maps, so an id</span>
<span style="color: navy">// </span><span style="color: green">here would tie the tag to whichever environment stamped it.</span>
<span style="color: navy">// </span><span style="color: green">── Provenance and tenancy ───────────────────────────────────────────────────</span>
<b>group </b>SetResponseProvenance<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">r</span><span style="color: navy">)</span><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>r.meta<b> as </b><span style="color: maroon">m</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>m.tag<b> as </b><span style="color: maroon">t</span><b> then</b><span style="color: navy"> {
</span> qr<span style="color: navy"><b> -> </b></span>t.system = <span style="color: blue">'http://slade360edi.com/questionnaire-provenance'</span> <i>"provenanceSystem"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>t.code = <span style="color: blue">'newborn-admission-record'</span> <i>"provenanceCode"</i><span style="color: navy">;</span>
qr<span style="color: navy"><b> -> </b></span>t.display = <span style="color: blue">'Newborn admission record'</span> <i>"provenanceDisplay"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"provenanceTag"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"provenanceMeta"</i><span style="color: navy">;</span>
<span style="color: navy">// </span><span style="color: green">Every tag the response carries, onto the resource. `meta` is 0..1, so this</span>
<span style="color: navy">// </span><span style="color: green">lands on the same meta the rule above created rather than a second one.</span>
qr.meta<b> as </b><span style="color: maroon">qm</span><b> then</b><span style="color: navy"> {
</span> qm.tag<b> as </b><span style="color: maroon">qt</span><span style="color: navy"><b> -> </b></span> r.meta<b> as </b><span style="color: maroon">m</span><span style="color: navy">, </span> m.tag = <span style="color: maroon">qt</span> <i>"copyTag"</i><span style="color: navy">;</span>
<span style="color: navy">}</span> <i>"tenantTags"</i><span style="color: navy">;</span>
<span style="color: navy">}
</span></pre></div>
</text>
<url
value="https://fhir.slade360.co.ke/fhir/StructureMap/ExtractNewbornAdmissionRecord"/>
<version value="0.1.0"/>
<name value="ExtractNewbornAdmissionRecord"/>
<title value="Newborn Admission Record Extraction"/>
<status value="active"/>
<date value="2026-09-14T06:31:13+00:00"/>
<publisher value="Kathurima Kimathi"/>
<contact>
<name value="Kathurima Kimathi"/>
<telecom>
<system value="url"/>
<value value="https://www.linkedin.com/in/kathurima-kimathi/"/>
</telecom>
<telecom>
<system value="email"/>
<value value="kathurimakimathi415@gmail.com"/>
</telecom>
</contact>
<contact>
<name value="Oscar John"/>
<telecom>
<system value="email"/>
<value value="oscarjohnotieno@gmail.com"/>
<use value="work"/>
</telecom>
</contact>
<contact>
<name value="Kennedy Omondi"/>
<telecom>
<system value="email"/>
<value value="kennankole@gmail.com"/>
<use value="work"/>
</telecom>
</contact>
<description
value="The newborn unit's admission record out as: the birth and current measurements each as their own Observation, so a weight chart can graph them from the first day; the intranatal and newborn history as one panel; the newborn examination as a second panel with its graded findings coded and its rates as quantities; the Apgar carried over from the delivery record as two Observations under the LOINC score codes; a Condition per admission diagnosis; a CarePlan for the supportive care planned; and a Consent from the parent's signature."/>
<structure>
<url
value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
<mode value="source"/>
<alias value="QR"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
<mode value="target"/>
<alias value="Bundle"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
<mode value="target"/>
<alias value="Observation"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Condition"/>
<mode value="target"/>
<alias value="Condition"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/CarePlan"/>
<mode value="target"/>
<alias value="CarePlan"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Consent"/>
<mode value="target"/>
<alias value="Consent"/>
</structure>
<group>
<name value="ExtractNewbornAdmissionRecord"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<rule>
<name value="setBundleType"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="bundle"/>
<element value="type"/>
<transform value="copy"/>
<parameter>
<valueString value="transaction"/>
</parameter>
</target>
</rule>
<rule>
<name value="bioGroup"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition value="linkId = 'bio'"/>
</source>
<rule>
<name value="measure_8339_4"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/birth-weight') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetVitalSignsCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="8339-4"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Birth weight Measured"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="measure_29463_7"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/weight-now') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetVitalSignsCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="29463-7"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Body weight"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="measure_11884_4"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/gestation') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetVitalSignsCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="11884-4"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Gestational age Estimated"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="measure_8310_5"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/temperature') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetVitalSignsCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="8310-5"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Body temperature"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="coded_cord_condition"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/mode-of-delivery') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="cord-mode-of-delivery"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Mode of delivery"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="codedValue"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="cv"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<variable value="cc"/>
<transform value="create"/>
<parameter>
<valueString value="CodeableConcept"/>
</parameter>
</target>
<rule>
<name value="valueCoding"/>
<source>
<context value="cv"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<transform value="copy"/>
<parameter>
<valueId value="cv"/>
</parameter>
</target>
</rule>
<rule>
<name value="valueText"/>
<source>
<context value="cv"/>
<element value="display"/>
<variable value="d"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="d"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</rule>
<rule>
<name value="coded_cord_condition2"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'bio/place-of-birth') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="cord-place-of-birth"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Place of birth"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="codedValue"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="cv"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<variable value="cc"/>
<transform value="create"/>
<parameter>
<valueString value="CodeableConcept"/>
</parameter>
</target>
<rule>
<name value="valueCoding"/>
<source>
<context value="cv"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<transform value="copy"/>
<parameter>
<valueId value="cv"/>
</parameter>
</target>
</rule>
<rule>
<name value="valueText"/>
<source>
<context value="cv"/>
<element value="display"/>
<variable value="d"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="d"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</rule>
<documentation
value="── The measurements ────────────────────────────────────────────────────
Birth weight and weight now are both LOINC-coded and both extracted: they
are different facts, and the difference between them on day three is what
tells physiological weight loss from failure to feed."/>
</rule>
<rule>
<name value="apgarGroup"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition value="linkId = 'apgar-at-birth'"/>
</source>
<rule>
<name value="measure_9272_6"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'apgar-at-birth/one-minute') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="9272-6"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="1 minute Apgar Score"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="measure_9274_2"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'apgar-at-birth/five-minutes') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="9274-2"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="5 minute Apgar Score"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="set"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="obs"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<documentation
value="── Apgar carried over from the delivery record ─────────────────────────
Two Observations under the LOINC score codes, not components of anything.
A five-minute Apgar is the single most-quoted number about a newborn and it
has to be findable by its own code.
No component breakdown here: this sheet copies the totals off the delivery
record and does not ask for the five signs. The breakdown lives on the
newborn observation chart, where it is actually assessed."/>
</rule>
<rule>
<name value="panel_10164_2"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition
value="(linkId = 'history') and item.answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="g"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="10164-2"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="History of Present illness Narrative"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Newborn history on admission"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="comp_sign_prolonged_rupture_of_membranes_over_24_hours"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/prolonged-rom') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString
value="sign-prolonged-rupture-of-membranes-over-24-hours"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString
value="Prolonged rupture of membranes over 24 hours"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_fever"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/fever') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-fever"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Fever"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_difficulty_breathing"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/difficulty-breathing') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-difficulty-breathing"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Difficulty breathing"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_apnoeas"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/apnoeas') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-apnoeas"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Apnoeas"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_diarrhoea"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/diarrhoea') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-diarrhoea"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Diarrhoea"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_convulsions"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/convulsions') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-convulsions"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Convulsions"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_partial_or_focal_fits"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/partial-focal-fits') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-partial-or-focal-fits"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Partial or focal fits"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_high_pitched_cry"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/high-pitched-cry') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-high-pitched-cry"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="High pitched cry"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_difficulty_feeding"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/difficulty-feeding') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-difficulty-feeding"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Difficulty feeding"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_severe_vomiting"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/severe-vomiting') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-severe-vomiting"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Severe vomiting"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_length_of_illness_in_days"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/length-of-illness') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-length-of-illness-in-days"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Length of illness in days"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_maternal_hiv_status"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'history/maternal-hiv-status') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="maternal-hiv-status"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Maternal HIV status"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="note"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition value="linkId = 'history/maternal-and-infant-drugs'"/>
</source>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="text"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="txt"/>
</source>
<target>
<context value="obs"/>
<element value="note"/>
<variable value="n"/>
</target>
<target>
<context value="n"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="txt"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<documentation
value="── The history, as one panel ───────────────────────────────────────────"/>
</rule>
<rule>
<name value="examinationPanel"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition
value="(linkId = 'examination') and item.item.answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetExamCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="g"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="8716-3"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Vital signs note"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Newborn examination on admission"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="examSub"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="g2"/>
<condition value="linkId = 'examination/breathing'"/>
</source>
<rule>
<name value="comp_sign_central_cyanosis"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/breathing/central-cyanosis') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-central-cyanosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Central cyanosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_severe_indrawing"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/breathing/severe-indrawing') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-severe-indrawing"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Severe indrawing"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_grunting"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/breathing/grunting') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-grunting"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Grunting"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_crackles"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/breathing/crackles') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-crackles"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Crackles"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_9279_1"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/breathing/respiratory-rate') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="9279-1"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Respiratory rate"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="examSub2"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="g2"/>
<condition value="linkId = 'examination/circulation'"/>
</source>
<rule>
<name value="comp_8867_4"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/circulation/heart-rate') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="8867-4"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Heart rate"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_capillary_refill_band"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/circulation/capillary-refill') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-capillary-refill-band"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Capillary refill band"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_grade_pallor_or_anaemia_grade"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/circulation/pallor') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="grade-pallor-or-anaemia-grade"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Pallor or anaemia grade"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="examSub3"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="g2"/>
<condition value="linkId = 'examination/dehydration'"/>
</source>
<rule>
<name value="comp_skin_pinch_time"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/dehydration/skin-pinch') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="skin-pinch-time"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Skin pinch return time"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="examSub4"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="g2"/>
<condition value="linkId = 'examination/disability'"/>
</source>
<rule>
<name value="comp_sign_floppy_or_unable_to_suck"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/disability/floppy-or-unable-to-suck') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-floppy-or-unable-to-suck"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Floppy, or unable to suck"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_bulging_fontanelle"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/disability/bulging-fontanelle') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-bulging-fontanelle"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Bulging fontanelle"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="examSub5"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="g2"/>
<condition value="linkId = 'examination/general'"/>
</source>
<rule>
<name value="comp_grade_jaundice_grade"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/general/jaundice') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="grade-jaundice-grade"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Jaundice grade"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_abdominal_distension"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/general/abdominal-distension') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-abdominal-distension"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Abdominal distension"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_umbilicus_appearance"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/general/umbilicus') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="umbilicus-appearance"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Umbilical stump appearance"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_severe_skin_pustules"/>
<source>
<context value="g2"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'examination/general/severe-skin-pustules') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-severe-skin-pustules"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Severe skin pustules"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentCodedValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="note2"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition value="linkId = 'examination/other'"/>
</source>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="text"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="txt"/>
</source>
<target>
<context value="obs"/>
<element value="note"/>
<variable value="n"/>
</target>
<target>
<context value="n"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="txt"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<documentation
value="── The newborn examination, as one panel ───────────────────────────────"/>
</rule>
<rule>
<name value="admissionDiagnoses"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition value="linkId = 'admission-diagnoses'"/>
</source>
<rule>
<name value="dx_birth_asphyxia"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/birth-asphyxia') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Birth asphyxia"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_meconium_aspiration"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/meconium-aspiration') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Meconium aspiration"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_premature_or_lbw"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/premature-or-lbw') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Premature or low birth weight"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_twin_delivery"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/twin-delivery') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Twin delivery"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_newborn_rds"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/newborn-rds') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Newborn respiratory distress syndrome"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_jaundice"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/jaundice') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Jaundice"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_neonatal_sepsis"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/neonatal-sepsis') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Neonatal sepsis"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="dx_meningitis"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'admission-diagnoses/meningitis') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="Meningitis"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="otherDiagnoses"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition value="linkId = 'admission-diagnoses/other'"/>
</source>
<rule>
<name value="createOtherCondition"/>
<source>
<context value="it"/>
<element value="answer"/>
<variable value="a"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="cond"/>
<transform value="create"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cond"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConditionBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="cond"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="clinicalStatus"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cond"/>
<element value="clinicalStatus"/>
<variable value="cs"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cs"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Active"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="category"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cond"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/condition-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="encounter-diagnosis"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="a"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Encounter Diagnosis"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="txt"/>
</source>
<target>
<context value="cond"/>
<element value="code"/>
<variable value="cc"/>
</target>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="txt"/>
</parameter>
</target>
</rule>
<rule>
<name value="recordedDate"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="cond"/>
<element value="recordedDate"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="cond"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<documentation
value="── Admission diagnoses ─────────────────────────────────────────────────
The sheet prints eight named diagnoses as tick boxes plus two free-text
lines. A ticked box becomes a Condition; the tick's own display is the
diagnosis name, which is why the label travels in the rule rather than
being read off the answer."/>
</rule>
<rule>
<name value="investigationsPanel"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition
value="(linkId = 'investigations') and item.answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetLaboratoryCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="g"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="11502-2"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Laboratory report"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="codeText"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString
value="Investigations known or ordered on admission"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="comp_maternal_vdrl_result"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/maternal-vdrl') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="maternal-vdrl-result"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Maternal VDRL result"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_maternal_hiv_status2"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/maternal-hiv') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="maternal-hiv-status"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Maternal HIV status"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_haemoglobin_or_haematocrit"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/hb-hct') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-haemoglobin-or-haematocrit"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Haemoglobin or haematocrit"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_15074_8"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/glucose') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="15074-8"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Glucose [Moles/volume] in Blood"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_bilirubin"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/bilirubin') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-bilirubin"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Bilirubin"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="comp_sign_lumbar_puncture"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'investigations/lumbar-puncture') and answer.value.exists()"/>
</source>
<target>
<context value="obs"/>
<element value="component"/>
<variable value="comp"/>
</target>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/concept-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="sign-lumbar-puncture"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Lumbar puncture"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="value"/>
<source>
<context value="it"/>
</source>
<target>
<context value="comp"/>
</target>
<dependent>
<name value="SetComponentValue"/>
<parameter>
<valueId value="it"/>
</parameter>
<parameter>
<valueId value="comp"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="note3"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition value="linkId = 'investigations/other'"/>
</source>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="text"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="txt"/>
</source>
<target>
<context value="obs"/>
<element value="note"/>
<variable value="n"/>
</target>
<target>
<context value="n"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="txt"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<documentation
value="── Investigations known and their results ──────────────────────────────
The sheet mixes orders and results on one block: it asks for the maternal
VDRL *result*, not for a VDRL to be done. So these become laboratory
Observations carrying what is known, not ServiceRequests -- ordering a test
whose answer is already written on the sheet would be wrong twice over."/>
</rule>
<rule>
<name value="supportiveCarePlan"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition
value="(linkId = 'supportive-care') and item.answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="plan"/>
<transform value="create"/>
<parameter>
<valueString value="CarePlan"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="plan"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildCarePlanBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="plan"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="status"/>
<source>
<context value="g"/>
</source>
<target>
<context value="plan"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="intent"/>
<source>
<context value="g"/>
</source>
<target>
<context value="plan"/>
<element value="intent"/>
<transform value="copy"/>
<parameter>
<valueString value="plan"/>
</parameter>
</target>
</rule>
<rule>
<name value="title"/>
<source>
<context value="g"/>
</source>
<target>
<context value="plan"/>
<element value="title"/>
<transform value="copy"/>
<parameter>
<valueString value="Supportive care on newborn admission"/>
</parameter>
</target>
</rule>
<rule>
<name value="created"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="plan"/>
<element value="created"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="plan"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
<rule>
<name value="custodian"/>
<source>
<context value="qr"/>
<element value="source"/>
<variable value="src"/>
</source>
<target>
<context value="plan"/>
<element value="custodian"/>
<transform value="copy"/>
<parameter>
<valueId value="src"/>
</parameter>
</target>
</rule>
<rule>
<name value="category"/>
<source>
<context value="g"/>
</source>
<target>
<context value="plan"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="https://fhir.slade360.co.ke/fhir/CodeSystem/document-type-codesystem"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="newborn-admission-record"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="g"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Newborn admission record"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="care_vitamin_k_and_teo"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/vitamin-k-and-teo') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Vitamin K and tetracycline eye ointment"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_arvs_for_pmtct"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/arvs-for-pmtct') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="ARVs for PMTCT"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_nutrition_or_feeds"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/nutrition-or-feeds') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Nutrition or feeds"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_oxygen"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/oxygen') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Oxygen"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_iv_fluids"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/iv-fluids') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="IV fluids"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_blood_transfusion"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/blood-transfusion') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Blood transfusion"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_incubator_or_keep_warm"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/incubator-or-keep-warm') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Incubator or keep warm"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="care_phototherapy"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'supportive-care/phototherapy') and (answer.value.ofType(Coding).code = 'Y')"/>
</source>
<target>
<context value="plan"/>
<element value="activity"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<element value="plannedActivityReference"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<rule>
<name value="activityDisplay"/>
<source>
<context value="it"/>
</source>
<target>
<context value="ref"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Phototherapy"/>
</parameter>
</target>
</rule>
</rule>
<documentation
value="── Supportive care planned ─────────────────────────────────────────────"/>
</rule>
<rule>
<name value="presentingProblemsObservation"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'presenting-problems') and answer.value.exists()"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildObsBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetSurveyCategory"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="code"/>
<source>
<context value="it"/>
</source>
<target>
<context value="obs"/>
<element value="code"/>
<variable value="cc"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="10154-3"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Chief complaint Narrative - Reported"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="answer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="text"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="txt"/>
</source>
<target>
<context value="obs"/>
<element value="note"/>
<variable value="n"/>
</target>
<target>
<context value="n"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="txt"/>
</parameter>
</target>
</rule>
</rule>
<documentation
value="── Presenting problems ─────────────────────────────────────────────────"/>
</rule>
<rule>
<name value="consentGroup"/>
<source>
<context value="qr"/>
<element value="item"/>
<variable value="g"/>
<condition value="linkId = 'sign-off'"/>
</source>
<rule>
<name value="createConsent"/>
<source>
<context value="g"/>
<element value="item"/>
<variable value="it"/>
<condition
value="(linkId = 'sign-off/consent-for-admission') and (answer.value = true)"/>
</source>
<target>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<element value="resource"/>
<variable value="consent"/>
<transform value="create"/>
<parameter>
<valueString value="Consent"/>
</parameter>
</target>
<rule>
<name value="base"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="consent"/>
</target>
<target>
<context value="entry"/>
</target>
<dependent>
<name value="BuildConsentBase"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="consent"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="status"/>
<source>
<context value="it"/>
</source>
<target>
<context value="consent"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="active"/>
</parameter>
</target>
</rule>
<rule>
<name value="category"/>
<source>
<context value="it"/>
</source>
<target>
<context value="consent"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="coding"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="cg"/>
</target>
<rule>
<name value="sys"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/consentcategorycodes"/>
</parameter>
</target>
</rule>
<rule>
<name value="cd"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="acd"/>
</parameter>
</target>
</rule>
<rule>
<name value="dsp"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cg"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Advance Directive"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="categoryText"/>
<source>
<context value="it"/>
</source>
<target>
<context value="cat"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString
value="Consent for admission and procedures by the parent or guardian"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="decision"/>
<source>
<context value="it"/>
</source>
<target>
<context value="consent"/>
<element value="decision"/>
<transform value="copy"/>
<parameter>
<valueString value="permit"/>
</parameter>
</target>
</rule>
<rule>
<name value="consentPeriodStart"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="consent"/>
<element value="period"/>
<variable value="per"/>
</target>
<target>
<context value="per"/>
<element value="start"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="grantee"/>
<source>
<context value="qr"/>
<element value="source"/>
<variable value="src"/>
</source>
<target>
<context value="consent"/>
<element value="grantee"/>
<transform value="copy"/>
<parameter>
<valueId value="src"/>
</parameter>
</target>
</rule>
<rule>
<name value="provenanceNote"/>
<source>
<context value="it"/>
</source>
<target>
<context value="consent"/>
<element value="provision"/>
<variable value="prov"/>
</target>
<target>
<context value="prov"/>
<element value="code"/>
<variable value="pc"/>
</target>
<target>
<context value="pc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString
value="Taken on the newborn admission record. The parent or guardian signed the sheet; this records that the signature was obtained, not the signature itself."/>
</parameter>
</target>
</rule>
</rule>
<documentation
value="── Consent for admission ───────────────────────────────────────────────"/>
</rule>
</group>
<group>
<name value="BuildObsBase"/>
<documentation
value="─────────────────────────────────────────────────────────────────────────────
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.
─────────────────────────────────────────────────────────────────────────────"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="responseProvenance"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
</target>
<dependent>
<name value="SetResponseProvenance"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="obs"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="idAndFullUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="id"/>
<transform value="uuid"/>
</target>
<dependent>
<name value="SetObservationFullUrl"/>
<parameter>
<valueId value="obs"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="entryRequest"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="entry"/>
<element value="request"/>
<variable value="request"/>
</target>
<rule>
<name value="requestMethod"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="method"/>
<transform value="copy"/>
<parameter>
<valueString value="POST"/>
</parameter>
</target>
</rule>
<rule>
<name value="requestUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="status"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="final"/>
</parameter>
</target>
</rule>
<rule>
<name value="subject"/>
<source>
<context value="qr"/>
<element value="subject"/>
<variable value="s"/>
</source>
<target>
<context value="obs"/>
<element value="subject"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
<rule>
<name value="encounter"/>
<source>
<context value="qr"/>
<element value="encounter"/>
<variable value="e"/>
</source>
<target>
<context value="obs"/>
<element value="encounter"/>
<transform value="copy"/>
<parameter>
<valueId value="e"/>
</parameter>
</target>
</rule>
<rule>
<name value="effective"/>
<source>
<context value="qr"/>
<element value="authored"/>
<variable value="t"/>
</source>
<target>
<context value="obs"/>
<element value="effective"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
<rule>
<name value="performerFromSource"/>
<source>
<context value="qr"/>
<element value="source"/>
<variable value="src"/>
</source>
<target>
<context value="obs"/>
<element value="performer"/>
<transform value="copy"/>
<parameter>
<valueId value="src"/>
</parameter>
</target>
</rule>
<rule>
<name value="performerFallback"/>
<source>
<context value="qr"/>
<condition value="source.exists().not()"/>
</source>
<rule>
<name value="performerFromAuthor"/>
<source>
<context value="qr"/>
<element value="author"/>
<variable value="a"/>
</source>
<target>
<context value="obs"/>
<element value="performer"/>
<transform value="copy"/>
<parameter>
<valueId value="a"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="linkQuestionnaireResponse"/>
<source>
<context value="qr"/>
<element value="id"/>
<variable value="qid"/>
<condition value="$this.hasValue()"/>
</source>
<target>
<context value="obs"/>
<element value="derivedFrom"/>
<variable value="ref"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<target>
<context value="ref"/>
<element value="reference"/>
<transform value="copy"/>
<parameter>
<valueId value="qid"/>
</parameter>
</target>
<documentation
value="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."/>
</rule>
</group>
<group>
<name value="SetObservationFullUrl"/>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="source"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="assignFullUrl"/>
<source>
<context value="obs"/>
<element value="id"/>
<variable value="id"/>
</source>
<target>
<context value="entry"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="https://fhir.slade360.co.ke/fhir/Observation/"/>
</parameter>
<parameter>
<valueId value="id"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="SetComponentCodedValue"/>
<documentation
value="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"."/>
<input>
<name value="it"/>
<mode value="source"/>
</input>
<input>
<name value="comp"/>
<mode value="target"/>
</input>
<rule>
<name value="componentAnswer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="codedValue"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="cv"/>
</source>
<target>
<context value="comp"/>
<element value="value"/>
<variable value="cc"/>
<transform value="create"/>
<parameter>
<valueString value="CodeableConcept"/>
</parameter>
</target>
<rule>
<name value="valueCoding"/>
<source>
<context value="cv"/>
</source>
<target>
<context value="cc"/>
<element value="coding"/>
<transform value="copy"/>
<parameter>
<valueId value="cv"/>
</parameter>
</target>
</rule>
<rule>
<name value="valueText"/>
<source>
<context value="cv"/>
<element value="display"/>
<variable value="d"/>
</source>
<target>
<context value="cc"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueId value="d"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="SetComponentValue"/>
<input>
<name value="it"/>
<mode value="source"/>
</input>
<input>
<name value="comp"/>
<mode value="target"/>
</input>
<rule>
<name value="componentAnswer"/>
<source>
<context value="it"/>
<element value="answer"/>
<listMode value="first"/>
<variable value="a"/>
</source>
<rule>
<name value="plainValue"/>
<source>
<context value="a"/>
<element value="value"/>
<variable value="v"/>
</source>
<target>
<context value="comp"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="v"/>
</parameter>
</target>
</rule>
</rule>
</group>
<group>
<name value="SetSurveyCategory"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="categoryCoding"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="coding"/>
</target>
<rule>
<name value="categorySystem"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/observation-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryCode"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="survey"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryDisplay"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Survey"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="SetVitalSignsCategory"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="categoryCoding"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="coding"/>
</target>
<rule>
<name value="categorySystem"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/observation-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryCode"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="vital-signs"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryDisplay"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Vital Signs"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="SetExamCategory"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="categoryCoding"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="coding"/>
</target>
<rule>
<name value="categorySystem"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/observation-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryCode"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="exam"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryDisplay"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Exam"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="SetLaboratoryCategory"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="obs"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<rule>
<name value="category"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="obs"/>
<element value="category"/>
<variable value="cat"/>
</target>
<rule>
<name value="categoryCoding"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="cat"/>
<element value="coding"/>
<variable value="coding"/>
</target>
<rule>
<name value="categorySystem"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/observation-category"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryCode"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="laboratory"/>
</parameter>
</target>
</rule>
<rule>
<name value="categoryDisplay"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="coding"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Laboratory"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="BuildConditionBase"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="r"/>
<type value="Condition"/>
<mode value="target"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="responseProvenance"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
</target>
<dependent>
<name value="SetResponseProvenance"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="r"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="idAndFullUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
<element value="id"/>
<transform value="uuid"/>
</target>
<dependent>
<name value="SetConditionFullUrl"/>
<parameter>
<valueId value="r"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="entryRequest"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="entry"/>
<element value="request"/>
<variable value="request"/>
</target>
<rule>
<name value="requestMethod"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="method"/>
<transform value="copy"/>
<parameter>
<valueString value="POST"/>
</parameter>
</target>
</rule>
<rule>
<name value="requestUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString value="Condition"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="subject"/>
<source>
<context value="qr"/>
<element value="subject"/>
<variable value="s"/>
</source>
<target>
<context value="r"/>
<element value="subject"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="SetConditionFullUrl"/>
<input>
<name value="r"/>
<type value="Condition"/>
<mode value="source"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="assignFullUrl"/>
<source>
<context value="r"/>
<element value="id"/>
<variable value="id"/>
</source>
<target>
<context value="entry"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="https://fhir.slade360.co.ke/fhir/Condition/"/>
</parameter>
<parameter>
<valueId value="id"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="BuildCarePlanBase"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="r"/>
<type value="CarePlan"/>
<mode value="target"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="responseProvenance"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
</target>
<dependent>
<name value="SetResponseProvenance"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="r"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="idAndFullUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
<element value="id"/>
<transform value="uuid"/>
</target>
<dependent>
<name value="SetCarePlanFullUrl"/>
<parameter>
<valueId value="r"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="entryRequest"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="entry"/>
<element value="request"/>
<variable value="request"/>
</target>
<rule>
<name value="requestMethod"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="method"/>
<transform value="copy"/>
<parameter>
<valueString value="POST"/>
</parameter>
</target>
</rule>
<rule>
<name value="requestUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString value="CarePlan"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="subject"/>
<source>
<context value="qr"/>
<element value="subject"/>
<variable value="s"/>
</source>
<target>
<context value="r"/>
<element value="subject"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="SetCarePlanFullUrl"/>
<input>
<name value="r"/>
<type value="CarePlan"/>
<mode value="source"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="assignFullUrl"/>
<source>
<context value="r"/>
<element value="id"/>
<variable value="id"/>
</source>
<target>
<context value="entry"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="https://fhir.slade360.co.ke/fhir/CarePlan/"/>
</parameter>
<parameter>
<valueId value="id"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="BuildConsentBase"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="r"/>
<type value="Consent"/>
<mode value="target"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="responseProvenance"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
</target>
<dependent>
<name value="SetResponseProvenance"/>
<parameter>
<valueId value="qr"/>
</parameter>
<parameter>
<valueId value="r"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="idAndFullUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
<element value="id"/>
<transform value="uuid"/>
</target>
<dependent>
<name value="SetConsentFullUrl"/>
<parameter>
<valueId value="r"/>
</parameter>
<parameter>
<valueId value="entry"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="entryRequest"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="entry"/>
<element value="request"/>
<variable value="request"/>
</target>
<rule>
<name value="requestMethod"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="method"/>
<transform value="copy"/>
<parameter>
<valueString value="POST"/>
</parameter>
</target>
</rule>
<rule>
<name value="requestUrl"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="request"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString value="Consent"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="subject"/>
<source>
<context value="qr"/>
<element value="subject"/>
<variable value="s"/>
</source>
<target>
<context value="r"/>
<element value="subject"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="SetConsentFullUrl"/>
<input>
<name value="r"/>
<type value="Consent"/>
<mode value="source"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<rule>
<name value="assignFullUrl"/>
<source>
<context value="r"/>
<element value="id"/>
<variable value="id"/>
</source>
<target>
<context value="entry"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="https://fhir.slade360.co.ke/fhir/Consent/"/>
</parameter>
<parameter>
<valueId value="id"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="SetResponseProvenance"/>
<documentation
value="── 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 ───────────────────────────────────────────────────"/>
<input>
<name value="qr"/>
<type value="QR"/>
<mode value="source"/>
</input>
<input>
<name value="r"/>
<mode value="target"/>
</input>
<rule>
<name value="provenanceMeta"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="r"/>
<element value="meta"/>
<variable value="m"/>
</target>
<rule>
<name value="provenanceTag"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="m"/>
<element value="tag"/>
<variable value="t"/>
</target>
<rule>
<name value="provenanceSystem"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="t"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://slade360edi.com/questionnaire-provenance"/>
</parameter>
</target>
</rule>
<rule>
<name value="provenanceCode"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="t"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="newborn-admission-record"/>
</parameter>
</target>
</rule>
<rule>
<name value="provenanceDisplay"/>
<source>
<context value="qr"/>
</source>
<target>
<context value="t"/>
<element value="display"/>
<transform value="copy"/>
<parameter>
<valueString value="Newborn admission record"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="tenantTags"/>
<source>
<context value="qr"/>
<element value="meta"/>
<variable value="qm"/>
</source>
<rule>
<name value="copyTag"/>
<source>
<context value="qm"/>
<element value="tag"/>
<variable value="qt"/>
</source>
<target>
<context value="r"/>
<element value="meta"/>
<variable value="m"/>
</target>
<target>
<context value="m"/>
<element value="tag"/>
<transform value="copy"/>
<parameter>
<valueId value="qt"/>
</parameter>
</target>
</rule>
<documentation
value="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."/>
</rule>
</group>
</StructureMap>