WHO SMART Guideline: Surveillance and Outbreak Toolkit
0.2.1 - CI Build International flag

WHO SMART Guideline: Surveillance and Outbreak Toolkit, published by WHO. This is not an authorized publication; it is the continuous build for version 0.2.1. This version is based on the current content of https://github.com/WorldHealthOrganization/smart-ot and changes regularly. See the Directory of published versions

: null - XML Representation

Draft as of 2023-11-07

Raw xml | Download



<StructureMap xmlns="http://hl7.org/fhir">
  <id value="MeaslesLogicalModelToResources"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>http://worldhealthorganization.github.io/smart-ot/StructureMap/MeaslesLogicalModelToResources<span style="color: navy">&quot; = &quot;</span>MeaslesLogicalModelToResources<span style="color: navy">&quot;

</span><b>uses</b><span style="color: navy"> &quot;</span>http://worldhealthorganization.github.io/smart-ot/StructureDefinition/SOTMeaslesF<span style="color: navy">&quot; </span><b>alias </b>MeaslesLogicalModel <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/bundle.html" title="Bundle">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style="color: navy">&quot; </span><b>alias </b>MeaslesCIFBundle <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-MeaslesCIFComposition.html" title="Measles Case Investigation Form Composition">http://worldhealthorganization.github.io/smart-ot/StructureDefinition/MeaslesCIFComposition</a><span style="color: navy">&quot; </span><b>alias </b>MeaslesCIFComposition <b>as </b><b>target</b>

<b>imports</b><span style="color: navy"> &quot;</span><a href="StructureMap-MetaDataTypesHelper.html" title="MetaDataTypesHelper">http://worldhealthorganization.github.io/smart-ot/StructureMap/MetaDataTypesHelper</a><span style="color: navy">&quot;
</span>
<b>group </b>MeaslesLogicalModelToResources<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>SOTMeasles, <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>  lm<span style="color: navy"><b> -&gt; </b></span>bundle.type = <span style="color: blue">'document'</span> <i>&quot;set bundle type&quot;</i><span style="color: navy">;</span>
  <span style="color: #b36b00" title="This element was not defined prior to R5">// lm.ReportingSource as reportingSource then {     reportingSource.DateReportedNational as date -&gt; bundle.timestamp = date &quot;set date&quot;;   } &quot;set timestamp&quot;;</span>
  lm<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">bid</span><span style="color: navy">, </span> bundle.id = <span style="color: maroon">bid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">cid</span><span style="color: navy">, </span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">pid</span><span style="color: navy">, </span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">prid</span><span style="color: navy">, </span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oid</span><span style="color: navy">, </span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">eid</span><b> then</b><span style="color: navy"> {
</span>    lm<span style="color: navy"><b> -&gt; </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">'Composition'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">composition</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">cid</span><span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span>      lm<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lm</span><b> then </b>LmToComposition<span style="color: navy">(</span><span style="color: maroon">lm</span><span style="color: navy">, </span><span style="color: maroon">composition</span><span style="color: navy">, </span><span style="color: maroon">cid</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">, </span><span style="color: maroon">prid</span><span style="color: navy">, </span><span style="color: maroon">oid</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Patient'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">patient</span><b> then</b><span style="color: navy"> {
</span>        lm.Demographics<b> as </b><span style="color: maroon">demographics</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">demographics</span><b> then </b>DemographicsToPatient<span style="color: navy">(</span><span style="color: maroon">demographics</span><span style="color: navy">, </span><span style="color: maroon">patient</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;create patient&quot;</i><span style="color: navy">;</span>
        lm<span style="color: navy"><b> -&gt; </b></span>entry.resource = <span style="color: maroon">patient</span> <i>&quot;set patient as entry&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;map patient resource&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">prid</span><span style="color: navy">)</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Practitioner'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">practitioner</span><b> then</b><span style="color: navy"> {
</span>        lm.ReportingSource<b> as </b><span style="color: maroon">reportingSource</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">reportingSource</span><b> then </b>ReportingSourceToPractitioner<span style="color: navy">(</span><span style="color: maroon">reportingSource</span><span style="color: navy">, </span><span style="color: maroon">practitioner</span><span style="color: navy">, </span><span style="color: maroon">prid</span><span style="color: navy">)</span> <i>&quot;create practitioner&quot;</i><span style="color: navy">;</span>
        lm<span style="color: navy"><b> -&gt; </b></span>entry.resource = <span style="color: maroon">practitioner</span> <i>&quot;set practitioner as entry&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;map practitioner resource&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">oid</span><span style="color: navy">)</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Organization'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">organization</span><b> then</b><span style="color: navy"> {
</span>        lm.ReportingSource<b> as </b><span style="color: maroon">reportingSource</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">reportingSource</span><b> then </b>ReportingSourceToOrganization<span style="color: navy">(</span><span style="color: maroon">reportingSource</span><span style="color: navy">, </span><span style="color: maroon">organization</span><span style="color: navy">, </span><span style="color: maroon">oid</span><span style="color: navy">)</span> <i>&quot;create organization&quot;</i><span style="color: navy">;</span>
        lm<span style="color: navy"><b> -&gt; </b></span>entry.resource = <span style="color: maroon">organization</span> <i>&quot;set organization as entry&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;map organization resource&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Encounter'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">encounter</span><b> then</b><span style="color: navy"> {
</span>        lm.ReportingSource<b> as </b><span style="color: maroon">reportingSource</span><b> then</b><span style="color: navy"> {
</span>          reportingSource.DateOfConsultation<b> as </b><span style="color: maroon">date</span><b> then</b><span style="color: navy"> {
</span>            date<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">type</span><span style="color: navy">, </span> type.code = <span style="color: blue">'AMB'</span><span style="color: navy">, </span> type.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/v3-ActCode'</span><span style="color: navy">, </span> type.display = <span style="color: blue">'ambulatory'</span><b> then </b>createCompositionEncounterResource<span style="color: navy">(</span><span style="color: maroon">date</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">, </span><span style="color: maroon">type</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">, </span><span style="color: maroon">encounter</span><span style="color: navy">)</span> <i>&quot;create encounter&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
          reportingSource.DateOfHomeVisit<b> as </b><span style="color: maroon">date</span><b> then</b><span style="color: navy"> {
</span>            date<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">type</span><span style="color: navy">, </span> type.code = <span style="color: blue">'HH'</span><span style="color: navy">, </span> type.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/v3-ActCode'</span><span style="color: navy">, </span> type.display = <span style="color: blue">'home health'</span><b> then </b>createCompositionEncounterResource<span style="color: navy">(</span><span style="color: maroon">date</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">, </span><span style="color: maroon">type</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">, </span><span style="color: maroon">encounter</span><span style="color: navy">)</span> <i>&quot;create encounter&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
        lm<span style="color: navy"><b> -&gt; </b></span>entry.resource = <span style="color: maroon">encounter</span> <i>&quot;set encounter as entry&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;map encounter resource&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lm</span><b> then </b>mapClinicalToObservations<span style="color: navy">(</span><span style="color: maroon">lm</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">composition</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set clinical data&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lm</span><b> then </b>mapLabsToDiagnosticReport<span style="color: navy">(</span><span style="color: maroon">lm</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">composition</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set labs data&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lm</span><b> then </b>mapVaccinationStatusToImmunization<span style="color: navy">(</span><span style="color: maroon">lm</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">composition</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set immunization data&quot;</i><span style="color: navy">;</span>
      lm<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lm</span><b> then </b>mapClassificationToConditions<span style="color: navy">(</span><span style="color: maroon">lm</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">composition</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span> <i>&quot;set classification&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;map composition resource&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set entries&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapClassificationToConditions<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>MeaslesLogicalModel, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>MeaslesCIFComposition, <b>source</b> <span style="color: maroon">pid</span>, <b>source</b> <span style="color: maroon">eid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  lm<span style="color: navy"><b> -&gt; </b></span> composition.section<b> as </b><span style="color: maroon">section</span><span style="color: navy">, </span> section.title = <span style="color: blue">'Classification'</span><b> then</b><span style="color: navy"> {
</span>    lm.Classification<b> as </b><span style="color: maroon">classification</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">id</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Condition/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</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">condition</span><b> then</b><span style="color: navy"> {
</span>      classification<span style="color: navy"><b> -&gt; </b></span>condition.id = <span style="color: maroon">id</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
      classification<span style="color: navy"><b> -&gt; </b></span> condition.verificationStatus<b> as </b><span style="color: maroon">tgtStatus</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">status</span><span style="color: navy">, </span> status.code = <span style="color: blue">'confirmed'</span><span style="color: navy">, </span> status.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-ver-status'</span><span style="color: navy">, </span> status.display = <span style="color: blue">'Confirmed'</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">status</span><span style="color: navy">, </span><span style="color: maroon">tgtStatus</span><span style="color: navy">)</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
      classification<span style="color: navy"><b> -&gt; </b></span> condition.subject<b> as </b><span style="color: maroon">subject</span><span style="color: navy">, </span> subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
      classification.FinalClassification<b> as </b><span style="color: maroon">coding</span><span style="color: navy"><b> -&gt; </b></span>condition.code<b> as </b><span style="color: maroon">code</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">code</span><span style="color: navy">)</span> <i>&quot;set code&quot;</i><span style="color: navy">;</span>
      classification<span style="color: navy"><b> -&gt; </b></span> condition.encounter<b> as </b><span style="color: maroon">encounter</span><span style="color: navy">, </span> encounter.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Encounter/'</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
      classification<span style="color: navy"><b> -&gt; </b></span> condition.category<b> as </b><span style="color: maroon">tgt</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">status</span><span style="color: navy">, </span> status.code = <span style="color: blue">'encounter-diagnosis'</span><span style="color: navy">, </span> status.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style="color: navy">, </span> status.display = <span style="color: blue">'Encounter Diagnosis'</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">status</span><span style="color: navy">, </span><span style="color: maroon">tgt</span><span style="color: navy">)</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
      classification.ClassificationDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span>condition.recordedDate = <span style="color: maroon">date</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
      classification.ClassifiedBy<b> as </b><span style="color: maroon">person</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">rpid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">rpid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'RelatedPerson/'</span><span style="color: navy">, </span><span style="color: maroon">rpid</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'RelatedPerson'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">recorder</span><b> then</b><span style="color: navy"> {
</span>        person<span style="color: navy"><b> -&gt; </b></span>recorder.id = <span style="color: maroon">rpid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
        person<span style="color: navy"><b> -&gt; </b></span> recorder.name<b> as </b><span style="color: maroon">targetName</span><span style="color: navy">, </span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'HumanName'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">name</span><span style="color: navy">, </span> name.text = <span style="color: maroon">person</span><b> then </b>humanNameToHumanName<span style="color: navy">(</span><span style="color: maroon">name</span><span style="color: navy">, </span><span style="color: maroon">targetName</span><span style="color: navy">)</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
        person<span style="color: navy"><b> -&gt; </b></span> recorder.patient<b> as </b><span style="color: maroon">patient</span><span style="color: navy">, </span> patient.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set patient&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set person&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;Set classification&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set section&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapContactTracing<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>MeaslesLogicalModel, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>MeaslesCIFComposition, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  lm<span style="color: navy"><b> -&gt; </b></span> composition.section<b> as </b><span style="color: maroon">section</span><span style="color: navy">, </span> section.title = <span style="color: blue">'Contact Tracing'</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapClinicalToObservations<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>SOTMeasles, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>Composition, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  lm<span style="color: navy"><b> -&gt; </b></span> composition.section<b> as </b><span style="color: maroon">section</span><span style="color: navy">, </span> section.title = <span style="color: blue">'Clinical Data, Follow up and Treatment'</span><b> then</b><span style="color: navy"> {
</span>    lm.Clinical<b> as </b><span style="color: maroon">clinical</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">clinical</span><b> then</b><span style="color: navy"> {
</span>      clinical.Fever<b> as </b><span style="color: maroon">fever</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        fever<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        fever<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE66'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Fever'</span><b> then</b><span style="color: navy"> {
</span>          fever<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">fever</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">fever</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          clinical.FeverOnsetDate<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">onsetDate</span><span style="color: navy">, </span> observation.effective = <span style="color: maroon">period</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set fever&quot;</i><span style="color: navy">;</span>
      clinical.Temperature<b> as </b><span style="color: maroon">temperature</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        temperature<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        temperature<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE70'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Temperature'</span><b> then</b><span style="color: navy"> {
</span>          temperature<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">temperature</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">temperature</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set Temperature&quot;</i><span style="color: navy">;</span>
      clinical.Rash<b> as </b><span style="color: maroon">rash</span><b> where </b>code != 'Yes'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        rash<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        rash<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE72'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Rash'</span><b> then</b><span style="color: navy"> {
</span>          rash<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">rash</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">rash</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set Rash&quot;</i><span style="color: navy">;</span>
      clinical.TypeOfRash<b> as </b><span style="color: maroon">haemorrhagic</span><b> where </b>code = 'Haemorrhagic'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        haemorrhagic<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        haemorrhagic<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'Haemorrhagic'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/RashType'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Haemorrhagic'</span><b> then</b><span style="color: navy"> {
</span>          haemorrhagic<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span> ValueCoding.code = <span style="color: blue">'Yes'</span><span style="color: navy">, </span> ValueCoding.system = <span style="color: blue">'http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown'</span><span style="color: navy">, </span> ValueCoding.display = <span style="color: blue">'Yes'</span><b> then</b><span style="color: navy"> {
</span>            haemorrhagic<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">haemorrhagic</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
          clinical.RashOnsetDate<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">onsetDate</span><span style="color: navy">, </span> observation.effective = <span style="color: maroon">period</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set haemorrhagic&quot;</i><span style="color: navy">;</span>
      clinical.TypeOfRash<b> as </b><span style="color: maroon">erythematous</span><b> where </b>code = 'Erythematous'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        erythematous<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        erythematous<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'Erythematous'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/RashType'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Erythematous'</span><b> then</b><span style="color: navy"> {
</span>          erythematous<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span> ValueCoding.code = <span style="color: blue">'Yes'</span><span style="color: navy">, </span> ValueCoding.system = <span style="color: blue">'http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown'</span><span style="color: navy">, </span> ValueCoding.display = <span style="color: blue">'Yes'</span><b> then</b><span style="color: navy"> {
</span>            erythematous<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">erythematous</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
          clinical.RashOnsetDate<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">onsetDate</span><span style="color: navy">, </span> observation.effective = <span style="color: maroon">period</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set erythematous&quot;</i><span style="color: navy">;</span>
      clinical.TypeOfRash<b> as </b><span style="color: maroon">vesicularPustular</span><b> where </b>code = 'VesicularPustular'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        vesicularPustular<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        vesicularPustular<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'Vesicular-pustular'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/RashType'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Vesicular Pustular'</span><b> then</b><span style="color: navy"> {
</span>          vesicularPustular<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span> ValueCoding.code = <span style="color: blue">'Yes'</span><span style="color: navy">, </span> ValueCoding.system = <span style="color: blue">'http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown'</span><span style="color: navy">, </span> ValueCoding.display = <span style="color: blue">'Yes'</span><b> then</b><span style="color: navy"> {
</span>            vesicularPustular<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">vesicularPustular</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        clinical.RashOnsetDate<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">onsetDate</span><span style="color: navy">, </span> observation.effective = <span style="color: maroon">period</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set vesicularPustular&quot;</i><span style="color: navy">;</span>
      clinical.TypeOfRash<b> as </b><span style="color: maroon">petechialPurpuric</span><b> where </b>code = 'PetechialPurpuric'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        petechialPurpuric<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        petechialPurpuric<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'Petechial-purpuric'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/RashType'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Petechial Purpuric'</span><b> then</b><span style="color: navy"> {
</span>          petechialPurpuric<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span> ValueCoding.code = <span style="color: blue">'Yes'</span><span style="color: navy">, </span> ValueCoding.system = <span style="color: blue">'http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown'</span><span style="color: navy">, </span> ValueCoding.display = <span style="color: blue">'Yes'</span><b> then</b><span style="color: navy"> {
</span>            petechialPurpuric<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">petechialPurpuric</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">petechialPurpuric</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        clinical.RashOnsetDate<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">onsetDate</span><span style="color: navy">, </span> observation.effective = <span style="color: maroon">period</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set petechialPurpuric&quot;</i><span style="color: navy">;</span>
      clinical.TypeOfRash<b> as </b><span style="color: maroon">other</span><b> where </b>code = 'Other'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        other<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        other<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'Other'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/RashType'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Rash'</span><b> then</b><span style="color: navy"> {
</span>          other<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span> ValueCoding.code = <span style="color: blue">'Yes'</span><span style="color: navy">, </span> ValueCoding.system = <span style="color: blue">'http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown'</span><span style="color: navy">, </span> ValueCoding.display = <span style="color: blue">'Yes'</span><b> then</b><span style="color: navy"> {
</span>            other<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">other</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">ValueCoding</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set other&quot;</i><span style="color: navy">;</span>
      clinical.Cough<b> as </b><span style="color: maroon">cough</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        cough<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        cough<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE84'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Cough'</span><b> then</b><span style="color: navy"> {
</span>          cough<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">cough</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">cough</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set cough&quot;</i><span style="color: navy">;</span>
      clinical.Conjunctivitis<b> as </b><span style="color: maroon">conjunctivitis</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        conjunctivitis<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        conjunctivitis<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE88'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Conjunctivitis'</span><b> then</b><span style="color: navy"> {
</span>          conjunctivitis<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">conjunctivitis</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">conjunctivitis</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set conjunctivitis&quot;</i><span style="color: navy">;</span>
      clinical.Coryza<b> as </b><span style="color: maroon">coryza</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        coryza<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        coryza<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE92'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Coryza'</span><b> then</b><span style="color: navy"> {
</span>          coryza<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">coryza</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">coryza</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set coryza&quot;</i><span style="color: navy">;</span>
      clinical.KoplikSpots<b> as </b><span style="color: maroon">koplikSpots</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        koplikSpots<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        koplikSpots<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE96'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Koplik Spots'</span><b> then</b><span style="color: navy"> {
</span>          koplikSpots<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">koplikSpots</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">koplikSpots</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set koplikSpots&quot;</i><span style="color: navy">;</span>
      clinical.Lymphadenopathy<b> as </b><span style="color: maroon">lymphadenopathy</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        lymphadenopathy<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        lymphadenopathy<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE100'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Lymphadenopathy'</span><b> then</b><span style="color: navy"> {
</span>          lymphadenopathy<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">lymphadenopathy</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">lymphadenopathy</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set lymphadenopathy&quot;</i><span style="color: navy">;</span>
      clinical.JointPain<b> as </b><span style="color: maroon">jointPain</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        jointPain<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        jointPain<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE104'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Joint Pain'</span><b> then</b><span style="color: navy"> {
</span>          jointPain<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">jointPain</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">jointPain</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set jointPain&quot;</i><span style="color: navy">;</span>
      clinical.PregnancyStatus<b> as </b><span style="color: maroon">pregnancy</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        pregnancy<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        pregnancy<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE108'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Pregnancy'</span><b> then</b><span style="color: navy"> {
</span>          pregnancy<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">pregnancy</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">pregnancy</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set pregnancy&quot;</i><span style="color: navy">;</span>
      clinical.PregnancyStatus<b> as </b><span style="color: maroon">pregnancy</span><b> where </b>code = 'Yes'<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        pregnancy<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        clinical.GestationWeeks<b> as </b><span style="color: maroon">weeks</span><span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE112'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Weeks Pregnant'</span><b> then</b><span style="color: navy"> {
</span>          weeks<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">weeks</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">weeks</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set pregnancy weeks&quot;</i><span style="color: navy">;</span>
      clinical.Outcome<b> as </b><span style="color: maroon">outcome</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        outcome<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        outcome<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'DE121'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Outcome'</span><b> then</b><span style="color: navy"> {
</span>          outcome<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">outcome</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">outcome</span><span style="color: navy">, </span><span style="color: maroon">coding</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
        clinical.DateOfDeath<b> as </b><span style="color: maroon">onsetDate</span><span style="color: navy"><b> -&gt; </b></span>observation.effective = <span style="color: maroon">onsetDate</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set outcome&quot;</i><span style="color: navy">;</span>
      clinical<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">clinical</span><b> then </b>mapEncounters<span style="color: navy">(</span><span style="color: maroon">clinical</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set clinical&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set section&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>createObservationResource<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span>, <b>source</b> <span style="color: maroon">coding</span><span style="color: navy"> : </span>Coding, <b>target</b> <span style="color: maroon">observation</span><span style="color: navy"> : </span>Observation, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  src<span style="color: navy"><b> -&gt; </b></span> <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">code</span><span style="color: navy">, </span> code.coding = <span style="color: maroon">coding</span><span style="color: navy">, </span> observation.code = <span style="color: maroon">code</span> <i>&quot;set code&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span> <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">value</span><span style="color: navy">, </span> value.coding = <span style="color: maroon">src</span><span style="color: navy">, </span> observation.value = <span style="color: maroon">value</span> <i>&quot;set value&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>observation.status = <span style="color: blue">'registered'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>observation.subject<b> as </b><span style="color: maroon">subject</span><b> then</b><span style="color: navy"> {
</span>    src<span style="color: navy"><b> -&gt; </b></span>subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapLabsToDiagnosticReport<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>MeaslesLogicalModel, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>MeaslesCIFComposition, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  lm<span style="color: navy"><b> -&gt; </b></span> composition.section<b> as </b><span style="color: maroon">section</span><span style="color: navy">, </span> section.title = <span style="color: blue">'Specimens &amp; Laboratory Testing'</span><b> then</b><span style="color: navy"> {
</span>    lm.LaboratoryResults<b> as </b><span style="color: maroon">labs</span><span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">id</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'DiagnosticReport/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'DiagnosticReport'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">diagnosticReport</span><b> then</b><span style="color: navy"> {
</span>      labs<span style="color: navy"><b> -&gt; </b></span>diagnosticReport.id = <span style="color: maroon">id</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
      labs<span style="color: navy"><b> -&gt; </b></span>diagnosticReport.status = <span style="color: blue">'registered'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
      labs<span style="color: navy"><b> -&gt; </b></span> diagnosticReport.subject<b> as </b><span style="color: maroon">subject</span><span style="color: navy">, </span> subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
      labs.Antigen<b> as </b><span style="color: maroon">antigen</span><span style="color: navy"><b> -&gt; </b></span>diagnosticReport.code<b> as </b><span style="color: maroon">code</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">antigen</span><span style="color: navy">, </span><span style="color: maroon">code</span><span style="color: navy">)</span> <i>&quot;set code&quot;</i><span style="color: navy">;</span>
      labs<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">id</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> diagnosticReport.specimen<b> as </b><span style="color: maroon">refSpecimen</span><span style="color: navy">, </span> refSpecimen.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Specimen/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Specimen'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">specimen</span><b> then</b><span style="color: navy"> {
</span>        labs<span style="color: navy"><b> -&gt; </b></span>specimen.id = <span style="color: maroon">id</span> <i>&quot;Set idn&quot;</i><span style="color: navy">;</span>
        labs.SpecimenCollectionDate<b> as </b><span style="color: maroon">collectDate</span><span style="color: navy"><b> -&gt; </b></span> specimen.collection<b> as </b><span style="color: maroon">collection</span><span style="color: navy">, </span> collection.collected = <span style="color: maroon">collectDate</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">// </span><span style="color: green">labs.SpecimenSentDate as sentDate -&gt;</span>
        labs.SpecimenRecdDate<b> as </b><span style="color: maroon">recdDate</span><span style="color: navy"><b> -&gt; </b></span>specimen.receivedTime = <span style="color: maroon">recdDate</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
        labs.SampleId<b> as </b><span style="color: maroon">sampleId</span><span style="color: navy"><b> -&gt; </b></span> specimen.identifier<b> as </b><span style="color: maroon">identifier</span><span style="color: navy">, </span> identifier.value = <span style="color: maroon">sampleId</span> <i>&quot;set identifier&quot;</i><span style="color: navy">;</span>
        labs.SampleType<b> as </b><span style="color: maroon">sampleType</span><span style="color: navy"><b> -&gt; </b></span>specimen.type = <span style="color: maroon">sampleType</span> <i>&quot;set type&quot;</i><span style="color: navy">;</span>
        labs.SpecimenNumber<b> as </b><span style="color: maroon">number</span><b> then</b><span style="color: navy"> {
</span>          number.display<b> as </b><span style="color: maroon">text</span><span style="color: navy"><b> -&gt; </b></span> specimen.note<b> as </b><span style="color: maroon">note</span><span style="color: navy">, </span> note.text = <span style="color: maroon">text</span> <i>&quot;set note&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set note&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set specimen&quot;</i><span style="color: navy">;</span>
      labs<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">id</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> diagnosticReport.performer<b> as </b><span style="color: maroon">performer</span><span style="color: navy">, </span> performer.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Organization/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Organization'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">perfOrg</span><b> then</b><span style="color: navy"> {
</span>        labs.LabName<b> as </b><span style="color: maroon">labName</span><span style="color: navy"><b> -&gt; </b></span>perfOrg.name = <span style="color: maroon">labName</span> <i>&quot;set name&quot;</i><span style="color: navy">;</span>
        labs<span style="color: navy"><b> -&gt; </b></span>perfOrg.id = <span style="color: maroon">id</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set performer&quot;</i><span style="color: navy">;</span>
      labs<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</span><span style="color: navy">, </span> diagnosticReport.result<b> as </b><span style="color: maroon">result</span><span style="color: navy">, </span> result.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Observation/'</span><span style="color: navy">, </span><span style="color: maroon">obsid</span><span style="color: navy">)</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">observation</span><b> then</b><span style="color: navy"> {
</span>        labs<span style="color: navy"><b> -&gt; </b></span>observation.id = <span style="color: maroon">obsid</span> <i>&quot;set obsid&quot;</i><span style="color: navy">;</span>
        labs.Antigen<b> as </b><span style="color: maroon">antigen</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">antigen</span><b> then</b><span style="color: navy"> {
</span>          labs.Results<b> as </b><span style="color: maroon">result</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">result</span><b> then </b>createObservationResource<span style="color: navy">(</span><span style="color: maroon">result</span><span style="color: navy">, </span><span style="color: maroon">antigen</span><span style="color: navy">, </span><span style="color: maroon">observation</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set obs&quot;</i><span style="color: navy">;</span>
          labs.LabResultsDate<b> as </b><span style="color: maroon">resultDate</span><span style="color: navy"><b> -&gt; </b></span>observation.effective = <span style="color: maroon">resultDate</span> <i>&quot;set start date&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set antigen&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set results&quot;</i><span style="color: navy">;</span>
      labs.Antigen<b> as </b><span style="color: maroon">antigen</span><span style="color: navy"><b> -&gt; </b></span>diagnosticReport.code = <span style="color: maroon">antigen</span> <i>&quot;set code&quot;</i><span style="color: navy">;</span>
      labs.LabResultsDate<b> as </b><span style="color: maroon">resultDate</span><span style="color: navy"><b> -&gt; </b></span>diagnosticReport.effective = <span style="color: maroon">resultDate</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set diagnosticReport&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set section&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>createImmunizationResource<span style="color: navy">(</span><b>source</b> <span style="color: maroon">vax</span><span style="color: navy"> : </span>SOTMeaslesVaccinationStatus, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">section</span><span style="color: navy"> : </span>Element, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  vax<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">id</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Immunization/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Immunization'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">immunization</span><b> then</b><span style="color: navy"> {
</span>    vax<span style="color: navy"><b> -&gt; </b></span>immunization.id = <span style="color: maroon">id</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
    vax<span style="color: navy"><b> -&gt; </b></span>immunization.status = <span style="color: blue">'completed'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
    vax<span style="color: navy"><b> -&gt; </b></span>immunization.vaccineCode<b> as </b><span style="color: maroon">code</span><b> then</b><span style="color: navy"> {
</span>      vax.VaccineType<b> as </b><span style="color: maroon">vaccineType</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">vaccineType</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">vaccineType</span><span style="color: navy">, </span><span style="color: maroon">code</span><span style="color: navy">)</span> <i>&quot;set code&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
    vax.Source<b> as </b><span style="color: maroon">source</span><span style="color: navy"><b> -&gt; </b></span>immunization.reportOrigin<b> as </b><span style="color: maroon">origin</span><b> then</b><span style="color: navy"> {
</span>      source<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">source</span><b> then </b>mapCodingtoCodeableConcept<span style="color: navy">(</span><span style="color: maroon">source</span><span style="color: navy">, </span><span style="color: maroon">origin</span><span style="color: navy">)</span> <i>&quot;set report origin&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
    vax.LastDoseDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span>immunization.occurrence = <span style="color: maroon">date</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
    vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> then</b><span style="color: navy"> {
</span>      doses.display<b> as </b><span style="color: maroon">seriesDose</span><span style="color: navy"><b> -&gt; </b></span> immunization.protocolApplied<b> as </b><span style="color: maroon">protocol</span><span style="color: navy">, </span> protocol.series = <span style="color: maroon">seriesDose</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set dosenumber&quot;</i><span style="color: navy">;</span>
    vax<span style="color: navy"><b> -&gt; </b></span> immunization.patient<b> as </b><span style="color: maroon">subject</span><span style="color: navy">, </span> subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;ad&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapVaccinationStatusToImmunization<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>MeaslesLogicalModel, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>MeaslesCIFComposition, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  lm<span style="color: navy"><b> -&gt; </b></span> composition.section<b> as </b><span style="color: maroon">section</span><span style="color: navy">, </span> section.title = <span style="color: blue">'Vaccination History'</span><b> then</b><span style="color: navy"> {
</span>    lm.VaccinationStatus<b> as </b><span style="color: maroon">vax</span><b> then</b><span style="color: navy"> {
</span>      vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> where </b>code = '99'<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
      vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> where </b>code = '1'<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then</b><span style="color: navy"> {
</span>        vax.LastDoseDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">date</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do1&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set&quot;</i><span style="color: navy">;</span>
      vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> where </b>code = '2'<b> then</b><span style="color: navy"> {
</span>        doses<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do2&quot;</i><span style="color: navy">;</span>
        vax.LastDoseDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">date</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set doses&quot;</i><span style="color: navy">;</span>
      vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> where </b>code = '3'<b> then</b><span style="color: navy"> {
</span>        vax<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
        vax<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
        vax.LastDoseDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">date</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set doses&quot;</i><span style="color: navy">;</span>
      vax.NumberOfDoses<b> as </b><span style="color: maroon">doses</span><b> where </b>code = '4'<b> then</b><span style="color: navy"> {
</span>        vax<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
        vax<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
        vax<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">doses</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
        vax.LastDoseDate<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">date</span><b> then </b>createImmunizationResource<span style="color: navy">(</span><span style="color: maroon">vax</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;do&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set doses&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set section&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>LmToComposition<span style="color: navy">(</span><b>source</b> <span style="color: maroon">lm</span><span style="color: navy"> : </span>SOTMeasles, <b>target</b> <span style="color: maroon">composition</span><span style="color: navy"> : </span>Composition, <b>source</b> <span style="color: maroon">cid</span>, <b>source</b> <span style="color: maroon">pid</span>, <b>source</b> <span style="color: maroon">prid</span>, <b>source</b> <span style="color: maroon">oid</span>, <b>source</b> <span style="color: maroon">eid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  cid<span style="color: navy"><b> -&gt; </b></span>composition.id = <span style="color: maroon">cid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.status = <span style="color: blue">'final'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.title = <span style="color: blue">'PAHO Measles Case Investigation Form'</span> <i>&quot;set title&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><span style="color: navy">, </span> coding.code = <span style="color: blue">'55751-2'</span><span style="color: navy">, </span> coding.system = <span style="color: blue">'http://loinc.org'</span><span style="color: navy">, </span> coding.display = <span style="color: blue">'Public health Case report'</span><span style="color: navy">, </span> <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">code</span><span style="color: navy">, </span> code.coding = <span style="color: maroon">coding</span><span style="color: navy">, </span> composition.type = <span style="color: maroon">code</span> <i>&quot;set type&quot;</i><span style="color: navy">;</span>
  lm.ReportingSource<b> as </b><span style="color: maroon">reportingSource</span><span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">reportingSource</span><b> then</b><span style="color: navy"> {
</span>    reportingSource.DateReportedLocal<b> as </b><span style="color: maroon">date</span><span style="color: navy"><b> -&gt; </b></span>composition.date = <span style="color: maroon">date</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set date reported local&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.subject<b> as </b><span style="color: maroon">subject</span><b> then</b><span style="color: navy"> {
</span>    lm<span style="color: navy"><b> -&gt; </b></span>subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.author<b> as </b><span style="color: maroon">practitioner</span><b> then</b><span style="color: navy"> {
</span>    lm<span style="color: navy"><b> -&gt; </b></span>practitioner.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Practitioner/'</span><span style="color: navy">, </span><span style="color: maroon">prid</span><span style="color: navy">)</span> <i>&quot;set author practitioner&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set author practitioner&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.author<b> as </b><span style="color: maroon">institution</span><b> then</b><span style="color: navy"> {
</span>    lm<span style="color: navy"><b> -&gt; </b></span>institution.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Organization/'</span><span style="color: navy">, </span><span style="color: maroon">oid</span><span style="color: navy">)</span> <i>&quot;set author institution&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set author org&quot;</i><span style="color: navy">;</span>
  lm<span style="color: navy"><b> -&gt; </b></span>composition.encounter<b> as </b><span style="color: maroon">encounter</span><b> then</b><span style="color: navy"> {
</span>    lm<span style="color: navy"><b> -&gt; </b></span>encounter.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Encounter/'</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set encounter&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>DemographicsToPatient<span style="color: navy">(</span><b>source</b> <span style="color: maroon">demographics</span><span style="color: navy"> : </span>DemographicsLogicalModel, <b>target</b> <span style="color: maroon">patient</span><span style="color: navy"> : </span>MeaslesPatient, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  pid<span style="color: navy"><b> -&gt; </b></span>patient.id = <span style="color: maroon">pid</span> <i>&quot;set patient id&quot;</i><span style="color: navy">;</span>
  demographics.Name<b> as </b><span style="color: maroon">sourceName</span><span style="color: navy"><b> -&gt; </b></span>patient.name<b> as </b><span style="color: maroon">targetName</span><b> then</b><span style="color: navy"> {
</span>    sourceName<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">sourceName</span><b> then </b>humanNameToHumanName<span style="color: navy">(</span><span style="color: maroon">sourceName</span><span style="color: navy">, </span><span style="color: maroon">targetName</span><span style="color: navy">)</span> <i>&quot;Copy name&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;Set name&quot;</i><span style="color: navy">;</span>
  demographics.DateOfBirth<b> as </b><span style="color: maroon">dob</span><span style="color: navy"><b> -&gt; </b></span>patient.birthDate = <span style="color: maroon">dob</span> <i>&quot;set date of birth&quot;</i><span style="color: navy">;</span>
  demographics.Sex<b> as </b><span style="color: maroon">sex</span><span style="color: navy"><b> -&gt; </b></span>patient.gender = <span style="color: maroon">sex</span> <i>&quot;set sex&quot;</i><span style="color: navy">;</span>
  demographics.CountryOfBirth<b> as </b><span style="color: maroon">cob</span><span style="color: navy"><b> -&gt; </b></span>patient.CountryOfBirth = <span style="color: maroon">cob</span> <i>&quot;set CountryOfBirth&quot;</i><span style="color: navy">;</span>
  demographics.Landmark<b> as </b><span style="color: maroon">landmark</span><span style="color: navy"><b> -&gt; </b></span>patient.extension<b> as </b><span style="color: maroon">ext</span><b> then</b><span style="color: navy"> {
</span>    landmark<span style="color: navy"><b> -&gt; </b></span> ext.url = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Landmark'</span><span style="color: navy">, </span> ext.value = <span style="color: maroon">landmark</span> <i>&quot;set landmark value&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set landmark&quot;</i><span style="color: navy">;</span>
  demographics.Guardian<b> as </b><span style="color: maroon">guardian</span><span style="color: navy"><b> -&gt; </b></span>patient.extension<b> as </b><span style="color: maroon">ext</span><b> then</b><span style="color: navy"> {
</span>    guardian<span style="color: navy"><b> -&gt; </b></span> ext.url = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Guardian'</span><span style="color: navy">, </span> ext.value = <span style="color: maroon">guardian</span> <i>&quot;set guardian value&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set guardian&quot;</i><span style="color: navy">;</span>
  demographics.Telephone<b> as </b><span style="color: maroon">sourcePhone</span><span style="color: navy"><b> -&gt; </b></span>patient.telecom<b> as </b><span style="color: maroon">targetPhone</span><b> then</b><span style="color: navy"> {
</span>    sourcePhone<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">sourcePhone</span><b> then </b>contactPointToContactPoint<span style="color: navy">(</span><span style="color: maroon">sourcePhone</span><span style="color: navy">, </span><span style="color: maroon">targetPhone</span><span style="color: navy">)</span> <i>&quot;Copy contact&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;Set contact&quot;</i><span style="color: navy">;</span>
  demographics.PlaceOfResidence<b> as </b><span style="color: maroon">sourceAddress</span><span style="color: navy"><b> -&gt; </b></span>patient.address<b> as </b><span style="color: maroon">targetAddress</span><b> then</b><span style="color: navy"> {
</span>    sourceAddress<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">sourceAddress</span><b> then </b>addressToAddress<span style="color: navy">(</span><span style="color: maroon">sourceAddress</span><span style="color: navy">, </span><span style="color: maroon">targetAddress</span><span style="color: navy">)</span> <i>&quot;Copy Address&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set address&quot;</i><span style="color: navy">;</span>
  demographics.Occupation<b> as </b><span style="color: maroon">occupation</span><span style="color: navy"><b> -&gt; </b></span>patient.extension<b> as </b><span style="color: maroon">ext</span><b> then</b><span style="color: navy"> {
</span>    occupation<span style="color: navy"><b> -&gt; </b></span> ext.url = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Occupation'</span><span style="color: navy">, </span> ext.value = <span style="color: maroon">occupation</span> <i>&quot;set occupation value&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set occupation&quot;</i><span style="color: navy">;</span>
  demographics.WorkAddress<b> as </b><span style="color: maroon">workAddress</span><span style="color: navy"><b> -&gt; </b></span>patient.extension<b> as </b><span style="color: maroon">ext</span><b> then</b><span style="color: navy"> {
</span>    workAddress<span style="color: navy"><b> -&gt; </b></span> ext.url = <span style="color: blue">'http://worldhealthorganization.github.io/smart-ot/StructureDefinition/WorkAddress'</span><span style="color: navy">, </span> ext.value = <span style="color: maroon">workAddress</span> <i>&quot;set work address value&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set work address&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>ReportingSourceToPractitioner<span style="color: navy">(</span><b>source</b> <span style="color: maroon">reportingSource</span><span style="color: navy"> : </span>ReportingSourceLogicalModel, <b>target</b> <span style="color: maroon">practitioner</span><span style="color: navy"> : </span>Practitioner, <b>source</b> <span style="color: maroon">prid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  prid<span style="color: navy"><b> -&gt; </b></span>practitioner.id = <span style="color: maroon">prid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
  reportingSource.ReportedBy<b> as </b><span style="color: maroon">name</span><span style="color: navy"><b> -&gt; </b></span> practitioner.name<b> as </b><span style="color: maroon">humanName</span><span style="color: navy">, </span> humanName.text = <span style="color: maroon">name</span> <i>&quot;set name&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>ReportingSourceToOrganization<span style="color: navy">(</span><b>source</b> <span style="color: maroon">reportingSource</span><span style="color: navy"> : </span>ReportingSourceLogicalModel, <b>target</b> <span style="color: maroon">organization</span><span style="color: navy"> : </span>Organization, <b>source</b> <span style="color: maroon">oid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  oid<span style="color: navy"><b> -&gt; </b></span>organization.id = <span style="color: maroon">oid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
  reportingSource.HealthServiceName<b> as </b><span style="color: maroon">name</span><span style="color: navy"><b> -&gt; </b></span>organization.name = <span style="color: maroon">name</span> <i>&quot;set name&quot;</i><span style="color: navy">;</span>
  reportingSource.HealthServiceTelephone<b> as </b><span style="color: maroon">phoneSource</span><span style="color: navy"><b> -&gt; </b></span> organization.contact<b> as </b><span style="color: maroon">contactDetails</span><span style="color: navy">, </span> contactDetails.telecom<b> as </b><span style="color: maroon">phoneTarget</span><b> then</b><span style="color: navy"> {
</span>    phoneSource<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">phoneSource</span><b> then </b>contactPointToContactPoint<span style="color: navy">(</span><span style="color: maroon">phoneSource</span><span style="color: navy">, </span><span style="color: maroon">phoneTarget</span><span style="color: navy">)</span> <i>&quot;set org contact&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set phone&quot;</i><span style="color: navy">;</span>
  reportingSource.PlaceOfReporting<b> as </b><span style="color: maroon">locationSource</span><span style="color: navy"><b> -&gt; </b></span> organization.contact<b> as </b><span style="color: maroon">contactDetails</span><span style="color: navy">, </span> contactDetails.address<b> as </b><span style="color: maroon">locationTarget</span><b> then</b><span style="color: navy"> {
</span>    locationSource<span style="color: navy"><b> -&gt; </b></span><span style="color: maroon">locationSource</span><b> then </b>contactPointToContactPoint<span style="color: navy">(</span><span style="color: maroon">locationSource</span><span style="color: navy">, </span><span style="color: maroon">locationTarget</span><span style="color: navy">)</span> <i>&quot;set org address&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;set address&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>mapEncounters<span style="color: navy">(</span><b>source</b> <span style="color: maroon">clinical</span><span style="color: navy"> : </span>SOTMeaslesClinical, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">section</span><span style="color: navy"> : </span>Element, <b>source</b> <span style="color: maroon">pid</span><span style="color: navy">)</span><span style="color: navy"> {
</span>  clinical.HistoryOfHospitalization<b> where </b>code = 'Yes'<b> then</b><span style="color: navy"> {
</span>    clinical.DateOfAdmission<b> as </b><span style="color: maroon">date</span><b> then</b><span style="color: navy"> {
</span>      date<span style="color: navy"><b> -&gt; </b></span> <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">type</span><span style="color: navy">, </span> type.code = <span style="color: blue">'IMP'</span><span style="color: navy">, </span> type.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/v3-ActCode'</span><span style="color: navy">, </span> type.display = <span style="color: blue">'inpatient encounter'</span><b> then </b>createEncounterResource<span style="color: navy">(</span><span style="color: maroon">date</span><span style="color: navy">, </span><span style="color: maroon">bundle</span><span style="color: navy">, </span><span style="color: maroon">section</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">, </span><span style="color: maroon">type</span><span style="color: navy">)</span> <i>&quot;create&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;d&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;dff&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>createEncounterResource<span style="color: navy">(</span><b>source</b> <span style="color: maroon">date</span>, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle, <b>target</b> <span style="color: maroon">section</span><span style="color: navy"> : </span>Element, <b>source</b> <span style="color: maroon">pid</span>, <b>source</b> <span style="color: maroon">type</span><span style="color: navy"> : </span>Coding<span style="color: navy">)</span><span style="color: navy"> {
</span>  date<span style="color: navy"><b> -&gt; </b></span> <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">eid</span><span style="color: navy">, </span> bundle.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'urn:uuid:'</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span><span style="color: navy">, </span> section.entry<b> as </b><span style="color: maroon">sectionEntry</span><span style="color: navy">, </span> sectionEntry.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Encounter/'</span><span style="color: navy">, </span><span style="color: maroon">eid</span><span style="color: navy">)</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Encounter'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">encounter</span><b> then</b><span style="color: navy"> {
</span>    date<span style="color: navy"><b> -&gt; </b></span>encounter.id = <span style="color: maroon">eid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
    date<span style="color: navy"><b> -&gt; </b></span>encounter.status = <span style="color: blue">'finished'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
    pid<span style="color: navy"><b> -&gt; </b></span> encounter.subject<b> as </b><span style="color: maroon">subject</span><span style="color: navy">, </span> subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
    date<span style="color: navy"><b> -&gt; </b></span> encounter.period<b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">date</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
    type<span style="color: navy"><b> -&gt; </b></span>encounter.class = <span style="color: maroon">type</span> <i>&quot;set type&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;dssd&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>createCompositionEncounterResource<span style="color: navy">(</span><b>source</b> <span style="color: maroon">date</span>, <b>source</b> <span style="color: maroon">pid</span>, <b>source</b> <span style="color: maroon">type</span><span style="color: navy"> : </span>Coding, <b>source</b> <span style="color: maroon">eid</span>, <b>target</b> <span style="color: maroon">encounter</span><span style="color: navy"> : </span>Encounter<span style="color: navy">)</span><span style="color: navy"> {
</span>  date<span style="color: navy"><b> -&gt; </b></span>encounter.id = <span style="color: maroon">eid</span> <i>&quot;set id&quot;</i><span style="color: navy">;</span>
  date<span style="color: navy"><b> -&gt; </b></span>encounter.status = <span style="color: blue">'finished'</span> <i>&quot;set status&quot;</i><span style="color: navy">;</span>
  pid<span style="color: navy"><b> -&gt; </b></span> encounter.subject<b> as </b><span style="color: maroon">subject</span><span style="color: navy">, </span> subject.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'Patient/'</span><span style="color: navy">, </span><span style="color: maroon">pid</span><span style="color: navy">)</span> <i>&quot;set subject&quot;</i><span style="color: navy">;</span>
  date<span style="color: navy"><b> -&gt; </b></span> encounter.period<b> as </b><span style="color: maroon">period</span><span style="color: navy">, </span> period.start = <span style="color: maroon">date</span> <i>&quot;set date&quot;</i><span style="color: navy">;</span>
  type<span style="color: navy"><b> -&gt; </b></span>encounter.class = <span style="color: maroon">type</span> <i>&quot;set type&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url
       value="http://worldhealthorganization.github.io/smart-ot/StructureMap/MeaslesLogicalModelToResources"/>
  <version value="0.2.1"/>
  <name value="MeaslesLogicalModelToResources"/>
  <status value="draft"/>
  <date value="2023-11-07T05:59:29+00:00"/>
  <publisher value="WHO"/>
  <contact>
    <name value="WHO"/>
    <telecom>
      <system value="url"/>
      <value value="http://who.int"/>
    </telecom>
  </contact>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
    </coding>
  </jurisdiction>
  <structure>
    <url
         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/SOTMeaslesF"/>
    <mode value="source"/>
    <alias value="MeaslesLogicalModel"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <mode value="target"/>
    <alias value="MeaslesCIFBundle"/>
  </structure>
  <structure>
    <url
         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/MeaslesCIFComposition"/>
    <mode value="target"/>
    <alias value="MeaslesCIFComposition"/>
  </structure>
  <import
          value="http://worldhealthorganization.github.io/smart-ot/StructureMap/MetaDataTypesHelper"/>
  <group>
    <name value="MeaslesLogicalModelToResources"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="SOTMeasles"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="set bundle type"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="type"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="document"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set id"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="bid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="bid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set entries"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="cid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="pid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="prid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="oid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="eid"/>
        <transform value="uuid"/>
      </target>
      <rule>
        <name value="map composition resource"/>
        <source>
          <context value="lm"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="entry"/>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="composition"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Composition"/>
          </parameter>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="urn:uuid:"/>
          </parameter>
          <parameter>
            <valueId value="cid"/>
          </parameter>
        </target>
        <rule>
          <name value="set"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="lm"/>
            </parameter>
          </target>
          <dependent>
            <name value="LmToComposition"/>
            <variable value="lm"/>
            <variable value="composition"/>
            <variable value="cid"/>
            <variable value="pid"/>
            <variable value="prid"/>
            <variable value="oid"/>
            <variable value="eid"/>
          </dependent>
        </rule>
        <rule>
          <name value="map patient resource"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="pid"/>
            </parameter>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="patient"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Patient"/>
            </parameter>
          </target>
          <rule>
            <name value="create patient"/>
            <source>
              <context value="lm"/>
              <element value="Demographics"/>
              <variable value="demographics"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="demographics"/>
              </parameter>
            </target>
            <dependent>
              <name value="DemographicsToPatient"/>
              <variable value="demographics"/>
              <variable value="patient"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="set patient as entry"/>
            <source>
              <context value="lm"/>
            </source>
            <target>
              <context value="entry"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="patient"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="map practitioner resource"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="prid"/>
            </parameter>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="practitioner"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Practitioner"/>
            </parameter>
          </target>
          <rule>
            <name value="create practitioner"/>
            <source>
              <context value="lm"/>
              <element value="ReportingSource"/>
              <variable value="reportingSource"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="reportingSource"/>
              </parameter>
            </target>
            <dependent>
              <name value="ReportingSourceToPractitioner"/>
              <variable value="reportingSource"/>
              <variable value="practitioner"/>
              <variable value="prid"/>
            </dependent>
          </rule>
          <rule>
            <name value="set practitioner as entry"/>
            <source>
              <context value="lm"/>
            </source>
            <target>
              <context value="entry"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="practitioner"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="map organization resource"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="oid"/>
            </parameter>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="organization"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Organization"/>
            </parameter>
          </target>
          <rule>
            <name value="create organization"/>
            <source>
              <context value="lm"/>
              <element value="ReportingSource"/>
              <variable value="reportingSource"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="reportingSource"/>
              </parameter>
            </target>
            <dependent>
              <name value="ReportingSourceToOrganization"/>
              <variable value="reportingSource"/>
              <variable value="organization"/>
              <variable value="oid"/>
            </dependent>
          </rule>
          <rule>
            <name value="set organization as entry"/>
            <source>
              <context value="lm"/>
            </source>
            <target>
              <context value="entry"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="organization"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="map encounter resource"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="eid"/>
            </parameter>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="encounter"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Encounter"/>
            </parameter>
          </target>
          <rule>
            <name value="set encounter"/>
            <source>
              <context value="lm"/>
              <element value="ReportingSource"/>
              <variable value="reportingSource"/>
            </source>
            <rule>
              <name value="set encounter"/>
              <source>
                <context value="reportingSource"/>
                <element value="DateOfConsultation"/>
                <variable value="date"/>
              </source>
              <rule>
                <name value="create encounter"/>
                <source>
                  <context value="date"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <variable value="type"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Coding"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="AMB"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString
                                 value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="ambulatory"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createCompositionEncounterResource"/>
                  <variable value="date"/>
                  <variable value="pid"/>
                  <variable value="type"/>
                  <variable value="eid"/>
                  <variable value="encounter"/>
                </dependent>
              </rule>
            </rule>
            <rule>
              <name value="set encounter"/>
              <source>
                <context value="reportingSource"/>
                <element value="DateOfHomeVisit"/>
                <variable value="date"/>
              </source>
              <rule>
                <name value="create encounter"/>
                <source>
                  <context value="date"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <variable value="type"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Coding"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="HH"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString
                                 value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  </parameter>
                </target>
                <target>
                  <context value="type"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="home health"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createCompositionEncounterResource"/>
                  <variable value="date"/>
                  <variable value="pid"/>
                  <variable value="type"/>
                  <variable value="eid"/>
                  <variable value="encounter"/>
                </dependent>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="set encounter as entry"/>
            <source>
              <context value="lm"/>
            </source>
            <target>
              <context value="entry"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="encounter"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="set clinical data"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="lm"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapClinicalToObservations"/>
            <variable value="lm"/>
            <variable value="bundle"/>
            <variable value="composition"/>
            <variable value="pid"/>
          </dependent>
        </rule>
        <rule>
          <name value="set labs data"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="lm"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapLabsToDiagnosticReport"/>
            <variable value="lm"/>
            <variable value="bundle"/>
            <variable value="composition"/>
            <variable value="pid"/>
          </dependent>
        </rule>
        <rule>
          <name value="set immunization data"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="lm"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapVaccinationStatusToImmunization"/>
            <variable value="lm"/>
            <variable value="bundle"/>
            <variable value="composition"/>
            <variable value="pid"/>
          </dependent>
        </rule>
        <rule>
          <name value="set classification"/>
          <source>
            <context value="lm"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="lm"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapClassificationToConditions"/>
            <variable value="lm"/>
            <variable value="bundle"/>
            <variable value="composition"/>
            <variable value="pid"/>
            <variable value="eid"/>
          </dependent>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="mapClassificationToConditions"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="MeaslesLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="MeaslesCIFComposition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="eid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set section"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="section"/>
        <variable value="section"/>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Classification"/>
        </parameter>
      </target>
      <rule>
        <name value="Set classification"/>
        <source>
          <context value="lm"/>
          <element value="Classification"/>
          <variable value="classification"/>
        </source>
        <target>
          <contextType value="variable"/>
          <variable value="id"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="entry"/>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="urn:uuid:"/>
          </parameter>
          <parameter>
            <valueId value="id"/>
          </parameter>
        </target>
        <target>
          <context value="section"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="sectionEntry"/>
        </target>
        <target>
          <context value="sectionEntry"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Condition/"/>
          </parameter>
          <parameter>
            <valueId value="id"/>
          </parameter>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="condition"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Condition"/>
          </parameter>
        </target>
        <rule>
          <name value="set id"/>
          <source>
            <context value="classification"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set"/>
          <source>
            <context value="classification"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="verificationStatus"/>
            <variable value="tgtStatus"/>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="status"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="confirmed"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-ver-status"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Confirmed"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="status"/>
            <variable value="tgtStatus"/>
          </dependent>
        </rule>
        <rule>
          <name value="set subject"/>
          <source>
            <context value="classification"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Patient/"/>
            </parameter>
            <parameter>
              <valueId value="pid"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set code"/>
          <source>
            <context value="classification"/>
            <element value="FinalClassification"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="coding"/>
            <variable value="code"/>
          </dependent>
        </rule>
        <rule>
          <name value="set subject"/>
          <source>
            <context value="classification"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="encounter"/>
          </target>
          <target>
            <context value="encounter"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Encounter/"/>
            </parameter>
            <parameter>
              <valueId value="eid"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set"/>
          <source>
            <context value="classification"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="tgt"/>
          </target>
          <target>
            <contextType value="variable"/>
            <variable value="status"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="encounter-diagnosis"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="status"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Encounter Diagnosis"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="status"/>
            <variable value="tgt"/>
          </dependent>
        </rule>
        <rule>
          <name value="set"/>
          <source>
            <context value="classification"/>
            <element value="ClassificationDate"/>
            <variable value="date"/>
          </source>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="recordedDate"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="date"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set person"/>
          <source>
            <context value="classification"/>
            <element value="ClassifiedBy"/>
            <variable value="person"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="rpid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="rpid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="RelatedPerson/"/>
            </parameter>
            <parameter>
              <valueId value="rpid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="recorder"/>
            <transform value="create"/>
            <parameter>
              <valueString value="RelatedPerson"/>
            </parameter>
          </target>
          <rule>
            <name value="set id"/>
            <source>
              <context value="person"/>
            </source>
            <target>
              <context value="recorder"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="rpid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set"/>
            <source>
              <context value="person"/>
            </source>
            <target>
              <context value="recorder"/>
              <contextType value="variable"/>
              <element value="name"/>
              <variable value="targetName"/>
            </target>
            <target>
              <contextType value="variable"/>
              <variable value="name"/>
              <transform value="create"/>
              <parameter>
                <valueString value="HumanName"/>
              </parameter>
            </target>
            <target>
              <context value="name"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="person"/>
              </parameter>
            </target>
            <dependent>
              <name value="humanNameToHumanName"/>
              <variable value="name"/>
              <variable value="targetName"/>
            </dependent>
          </rule>
          <rule>
            <name value="set patient"/>
            <source>
              <context value="person"/>
            </source>
            <target>
              <context value="recorder"/>
              <contextType value="variable"/>
              <element value="patient"/>
              <variable value="patient"/>
            </target>
            <target>
              <context value="patient"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="append"/>
              <parameter>
                <valueString value="Patient/"/>
              </parameter>
              <parameter>
                <valueId value="pid"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="mapContactTracing"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="MeaslesLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="MeaslesCIFComposition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="section"/>
        <variable value="section"/>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Contact Tracing"/>
        </parameter>
      </target>
    </rule>
  </group>
  <group>
    <name value="mapClinicalToObservations"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="SOTMeasles"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="Composition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set section"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="section"/>
        <variable value="section"/>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Clinical Data, Follow up and Treatment"/>
        </parameter>
      </target>
      <rule>
        <name value="set clinical"/>
        <source>
          <context value="lm"/>
          <element value="Clinical"/>
          <variable value="clinical"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="clinical"/>
          </parameter>
        </target>
        <rule>
          <name value="set fever"/>
          <source>
            <context value="clinical"/>
            <element value="Fever"/>
            <variable value="fever"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="fever"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="fever"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE66"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Fever"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="fever"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="fever"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="fever"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
            <rule>
              <name value="set start date"/>
              <source>
                <context value="clinical"/>
                <element value="FeverOnsetDate"/>
                <variable value="onsetDate"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="period"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Period"/>
                </parameter>
              </target>
              <target>
                <context value="period"/>
                <contextType value="variable"/>
                <element value="start"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="onsetDate"/>
                </parameter>
              </target>
              <target>
                <context value="observation"/>
                <contextType value="variable"/>
                <element value="effective"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="period"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set Temperature"/>
          <source>
            <context value="clinical"/>
            <element value="Temperature"/>
            <variable value="temperature"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="temperature"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="temperature"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE70"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Temperature"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="temperature"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="temperature"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="temperature"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set Rash"/>
          <source>
            <context value="clinical"/>
            <element value="Rash"/>
            <variable value="rash"/>
            <condition value="code != 'Yes'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="rash"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="rash"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE72"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Rash"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="rash"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="rash"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="rash"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set haemorrhagic"/>
          <source>
            <context value="clinical"/>
            <element value="TypeOfRash"/>
            <variable value="haemorrhagic"/>
            <condition value="code = 'Haemorrhagic'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="haemorrhagic"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="haemorrhagic"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Haemorrhagic"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/RashType"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Haemorrhagic"/>
              </parameter>
            </target>
            <rule>
              <name value="set value"/>
              <source>
                <context value="haemorrhagic"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="ValueCoding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <rule>
                <name value="set obs"/>
                <source>
                  <context value="haemorrhagic"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="haemorrhagic"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createObservationResource"/>
                  <variable value="ValueCoding"/>
                  <variable value="coding"/>
                  <variable value="observation"/>
                  <variable value="pid"/>
                </dependent>
              </rule>
            </rule>
            <rule>
              <name value="set start date"/>
              <source>
                <context value="clinical"/>
                <element value="RashOnsetDate"/>
                <variable value="onsetDate"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="period"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Period"/>
                </parameter>
              </target>
              <target>
                <context value="period"/>
                <contextType value="variable"/>
                <element value="start"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="onsetDate"/>
                </parameter>
              </target>
              <target>
                <context value="observation"/>
                <contextType value="variable"/>
                <element value="effective"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="period"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set erythematous"/>
          <source>
            <context value="clinical"/>
            <element value="TypeOfRash"/>
            <variable value="erythematous"/>
            <condition value="code = 'Erythematous'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="erythematous"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="erythematous"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Erythematous"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/RashType"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Erythematous"/>
              </parameter>
            </target>
            <rule>
              <name value="set value"/>
              <source>
                <context value="erythematous"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="ValueCoding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <rule>
                <name value="set obs"/>
                <source>
                  <context value="erythematous"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="erythematous"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createObservationResource"/>
                  <variable value="ValueCoding"/>
                  <variable value="coding"/>
                  <variable value="observation"/>
                  <variable value="pid"/>
                </dependent>
              </rule>
            </rule>
            <rule>
              <name value="set start date"/>
              <source>
                <context value="clinical"/>
                <element value="RashOnsetDate"/>
                <variable value="onsetDate"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="period"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Period"/>
                </parameter>
              </target>
              <target>
                <context value="period"/>
                <contextType value="variable"/>
                <element value="start"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="onsetDate"/>
                </parameter>
              </target>
              <target>
                <context value="observation"/>
                <contextType value="variable"/>
                <element value="effective"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="period"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set vesicularPustular"/>
          <source>
            <context value="clinical"/>
            <element value="TypeOfRash"/>
            <variable value="vesicularPustular"/>
            <condition value="code = 'VesicularPustular'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="vesicularPustular"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="vesicularPustular"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Vesicular-pustular"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/RashType"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Vesicular Pustular"/>
              </parameter>
            </target>
            <rule>
              <name value="set value"/>
              <source>
                <context value="vesicularPustular"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="ValueCoding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <rule>
                <name value="set obs"/>
                <source>
                  <context value="vesicularPustular"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="vesicularPustular"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createObservationResource"/>
                  <variable value="ValueCoding"/>
                  <variable value="coding"/>
                  <variable value="observation"/>
                  <variable value="pid"/>
                </dependent>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="set start date"/>
            <source>
              <context value="clinical"/>
              <element value="RashOnsetDate"/>
              <variable value="onsetDate"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="period"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Period"/>
              </parameter>
            </target>
            <target>
              <context value="period"/>
              <contextType value="variable"/>
              <element value="start"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="onsetDate"/>
              </parameter>
            </target>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="effective"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="period"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="set petechialPurpuric"/>
          <source>
            <context value="clinical"/>
            <element value="TypeOfRash"/>
            <variable value="petechialPurpuric"/>
            <condition value="code = 'PetechialPurpuric'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="petechialPurpuric"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="petechialPurpuric"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Petechial-purpuric"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/RashType"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Petechial Purpuric"/>
              </parameter>
            </target>
            <rule>
              <name value="set value"/>
              <source>
                <context value="petechialPurpuric"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="ValueCoding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <rule>
                <name value="set obs"/>
                <source>
                  <context value="petechialPurpuric"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="petechialPurpuric"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createObservationResource"/>
                  <variable value="petechialPurpuric"/>
                  <variable value="coding"/>
                  <variable value="observation"/>
                  <variable value="pid"/>
                </dependent>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="set start date"/>
            <source>
              <context value="clinical"/>
              <element value="RashOnsetDate"/>
              <variable value="onsetDate"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="period"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Period"/>
              </parameter>
            </target>
            <target>
              <context value="period"/>
              <contextType value="variable"/>
              <element value="start"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="onsetDate"/>
              </parameter>
            </target>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="effective"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="period"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="set other"/>
          <source>
            <context value="clinical"/>
            <element value="TypeOfRash"/>
            <variable value="other"/>
            <condition value="code = 'Other'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="other"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="other"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Other"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/RashType"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Rash"/>
              </parameter>
            </target>
            <rule>
              <name value="set value"/>
              <source>
                <context value="other"/>
              </source>
              <target>
                <contextType value="variable"/>
                <variable value="ValueCoding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://ritikarawlani.github.io/smart-outbreak-measles/YesNoUnknown"/>
                </parameter>
              </target>
              <target>
                <context value="ValueCoding"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Yes"/>
                </parameter>
              </target>
              <rule>
                <name value="set obs"/>
                <source>
                  <context value="other"/>
                </source>
                <target>
                  <contextType value="variable"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="other"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="createObservationResource"/>
                  <variable value="ValueCoding"/>
                  <variable value="coding"/>
                  <variable value="observation"/>
                  <variable value="pid"/>
                </dependent>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set cough"/>
          <source>
            <context value="clinical"/>
            <element value="Cough"/>
            <variable value="cough"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="cough"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="cough"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE84"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Cough"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="cough"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="cough"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="cough"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set conjunctivitis"/>
          <source>
            <context value="clinical"/>
            <element value="Conjunctivitis"/>
            <variable value="conjunctivitis"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="conjunctivitis"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="conjunctivitis"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE88"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Conjunctivitis"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="conjunctivitis"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="conjunctivitis"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="conjunctivitis"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set coryza"/>
          <source>
            <context value="clinical"/>
            <element value="Coryza"/>
            <variable value="coryza"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="coryza"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="coryza"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE92"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Coryza"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="coryza"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="coryza"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="coryza"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set koplikSpots"/>
          <source>
            <context value="clinical"/>
            <element value="KoplikSpots"/>
            <variable value="koplikSpots"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="koplikSpots"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="koplikSpots"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE96"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Koplik Spots"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="koplikSpots"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="koplikSpots"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="koplikSpots"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set lymphadenopathy"/>
          <source>
            <context value="clinical"/>
            <element value="Lymphadenopathy"/>
            <variable value="lymphadenopathy"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="lymphadenopathy"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="lymphadenopathy"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE100"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Lymphadenopathy"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="lymphadenopathy"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="lymphadenopathy"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="lymphadenopathy"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set jointPain"/>
          <source>
            <context value="clinical"/>
            <element value="JointPain"/>
            <variable value="jointPain"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="jointPain"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="jointPain"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE104"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Joint Pain"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="jointPain"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="jointPain"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="jointPain"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set pregnancy"/>
          <source>
            <context value="clinical"/>
            <element value="PregnancyStatus"/>
            <variable value="pregnancy"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="pregnancy"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="pregnancy"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE108"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Pregnancy"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="pregnancy"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="pregnancy"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="pregnancy"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set pregnancy weeks"/>
          <source>
            <context value="clinical"/>
            <element value="PregnancyStatus"/>
            <variable value="pregnancy"/>
            <condition value="code = 'Yes'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="pregnancy"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="clinical"/>
              <element value="GestationWeeks"/>
              <variable value="weeks"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE112"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Weeks Pregnant"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="weeks"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="weeks"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="weeks"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set outcome"/>
          <source>
            <context value="clinical"/>
            <element value="Outcome"/>
            <variable value="outcome"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="section"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="sectionEntry"/>
          </target>
          <target>
            <context value="sectionEntry"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="outcome"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set obs"/>
            <source>
              <context value="outcome"/>
            </source>
            <target>
              <contextType value="variable"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="DE121"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://worldhealthorganization.github.io/smart-ot/PAHO_MRCIF"/>
              </parameter>
            </target>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Outcome"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="outcome"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="outcome"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="outcome"/>
                <variable value="coding"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
          </rule>
          <rule>
            <name value="set start date"/>
            <source>
              <context value="clinical"/>
              <element value="DateOfDeath"/>
              <variable value="onsetDate"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="effective"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="onsetDate"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="set encounter"/>
          <source>
            <context value="clinical"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="clinical"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapEncounters"/>
            <variable value="clinical"/>
            <variable value="bundle"/>
            <variable value="section"/>
            <variable value="pid"/>
          </dependent>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="createObservationResource"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="coding"/>
      <type value="Coding"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="observation"/>
      <type value="Observation"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set code"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="code"/>
        <transform value="create"/>
        <parameter>
          <valueString value="CodeableConcept"/>
        </parameter>
      </target>
      <target>
        <context value="code"/>
        <contextType value="variable"/>
        <element value="coding"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="coding"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="code"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="code"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set value"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="CodeableConcept"/>
        </parameter>
      </target>
      <target>
        <context value="value"/>
        <contextType value="variable"/>
        <element value="coding"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="src"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set status"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="registered"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set subject"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <rule>
        <name value="set subject"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="subject"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Patient/"/>
          </parameter>
          <parameter>
            <valueId value="pid"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="mapLabsToDiagnosticReport"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="MeaslesLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="MeaslesCIFComposition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set section"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="section"/>
        <variable value="section"/>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Specimens &amp; Laboratory Testing"/>
        </parameter>
      </target>
      <rule>
        <name value="set diagnosticReport"/>
        <source>
          <context value="lm"/>
          <element value="LaboratoryResults"/>
          <variable value="labs"/>
        </source>
        <target>
          <contextType value="variable"/>
          <variable value="id"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="entry"/>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="urn:uuid:"/>
          </parameter>
          <parameter>
            <valueId value="id"/>
          </parameter>
        </target>
        <target>
          <context value="section"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="sectionEntry"/>
        </target>
        <target>
          <context value="sectionEntry"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="DiagnosticReport/"/>
          </parameter>
          <parameter>
            <valueId value="id"/>
          </parameter>
        </target>
        <target>
          <context value="entry"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="diagnosticReport"/>
          <transform value="create"/>
          <parameter>
            <valueString value="DiagnosticReport"/>
          </parameter>
        </target>
        <rule>
          <name value="set id"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="id"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set status"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="registered"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set subject"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Patient/"/>
            </parameter>
            <parameter>
              <valueId value="pid"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set code"/>
          <source>
            <context value="labs"/>
            <element value="Antigen"/>
            <variable value="antigen"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="antigen"/>
            <variable value="code"/>
          </dependent>
        </rule>
        <rule>
          <name value="set specimen"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="id"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="specimen"/>
            <variable value="refSpecimen"/>
          </target>
          <target>
            <context value="refSpecimen"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Specimen/"/>
            </parameter>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="specimen"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Specimen"/>
            </parameter>
          </target>
          <rule>
            <name value="Set idn"/>
            <source>
              <context value="labs"/>
            </source>
            <target>
              <context value="specimen"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="id"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set date"/>
            <source>
              <context value="labs"/>
              <element value="SpecimenCollectionDate"/>
              <variable value="collectDate"/>
            </source>
            <target>
              <context value="specimen"/>
              <contextType value="variable"/>
              <element value="collection"/>
              <variable value="collection"/>
            </target>
            <target>
              <context value="collection"/>
              <contextType value="variable"/>
              <element value="collected"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="collectDate"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set date"/>
            <source>
              <context value="labs"/>
              <element value="SpecimenRecdDate"/>
              <variable value="recdDate"/>
            </source>
            <target>
              <context value="specimen"/>
              <contextType value="variable"/>
              <element value="receivedTime"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="recdDate"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set identifier"/>
            <source>
              <context value="labs"/>
              <element value="SampleId"/>
              <variable value="sampleId"/>
            </source>
            <target>
              <context value="specimen"/>
              <contextType value="variable"/>
              <element value="identifier"/>
              <variable value="identifier"/>
            </target>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="sampleId"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set type"/>
            <source>
              <context value="labs"/>
              <element value="SampleType"/>
              <variable value="sampleType"/>
            </source>
            <target>
              <context value="specimen"/>
              <contextType value="variable"/>
              <element value="type"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="sampleType"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set note"/>
            <source>
              <context value="labs"/>
              <element value="SpecimenNumber"/>
              <variable value="number"/>
            </source>
            <rule>
              <name value="set note"/>
              <source>
                <context value="number"/>
                <element value="display"/>
                <variable value="text"/>
              </source>
              <target>
                <context value="specimen"/>
                <contextType value="variable"/>
                <element value="note"/>
                <variable value="note"/>
              </target>
              <target>
                <context value="note"/>
                <contextType value="variable"/>
                <element value="text"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="text"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set performer"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="id"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="performer"/>
            <variable value="performer"/>
          </target>
          <target>
            <context value="performer"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Organization/"/>
            </parameter>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="perfOrg"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Organization"/>
            </parameter>
          </target>
          <rule>
            <name value="set name"/>
            <source>
              <context value="labs"/>
              <element value="LabName"/>
              <variable value="labName"/>
            </source>
            <target>
              <context value="perfOrg"/>
              <contextType value="variable"/>
              <element value="name"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="labName"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set id"/>
            <source>
              <context value="labs"/>
            </source>
            <target>
              <context value="perfOrg"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="id"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="set results"/>
          <source>
            <context value="labs"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="obsid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="entry"/>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="urn:uuid:"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="result"/>
            <variable value="result"/>
          </target>
          <target>
            <context value="result"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="append"/>
            <parameter>
              <valueString value="Observation/"/>
            </parameter>
            <parameter>
              <valueId value="obsid"/>
            </parameter>
          </target>
          <target>
            <context value="entry"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <rule>
            <name value="set obsid"/>
            <source>
              <context value="labs"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="id"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="obsid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="set antigen"/>
            <source>
              <context value="labs"/>
              <element value="Antigen"/>
              <variable value="antigen"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="antigen"/>
              </parameter>
            </target>
            <rule>
              <name value="set obs"/>
              <source>
                <context value="labs"/>
                <element value="Results"/>
                <variable value="result"/>
              </source>
              <target>
                <contextType value="variable"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="result"/>
                </parameter>
              </target>
              <dependent>
                <name value="createObservationResource"/>
                <variable value="result"/>
                <variable value="antigen"/>
                <variable value="observation"/>
                <variable value="pid"/>
              </dependent>
            </rule>
            <rule>
              <name value="set start date"/>
              <source>
                <context value="labs"/>
                <element value="LabResultsDate"/>
                <variable value="resultDate"/>
              </source>
              <target>
                <context value="observation"/>
                <contextType value="variable"/>
                <element value="effective"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="resultDate"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="set code"/>
          <source>
            <context value="labs"/>
            <element value="Antigen"/>
            <variable value="antigen"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="antigen"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="set date"/>
          <source>
            <context value="labs"/>
            <element value="LabResultsDate"/>
            <variable value="resultDate"/>
          </source>
          <target>
            <context value="diagnosticReport"/>
            <contextType value="variable"/>
            <element value="effective"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="resultDate"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="createImmunizationResource"/>
    <typeMode value="none"/>
    <input>
      <name value="vax"/>
      <type value="SOTMeaslesVaccinationStatus"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="section"/>
      <type value="Element"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="ad"/>
      <source>
        <context value="vax"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="id"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="entry"/>
      </target>
      <target>
        <context value="entry"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="id"/>
        </parameter>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="sectionEntry"/>
      </target>
      <target>
        <context value="sectionEntry"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="Immunization/"/>
        </parameter>
        <parameter>
          <valueId value="id"/>
        </parameter>
      </target>
      <target>
        <context value="entry"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="immunization"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Immunization"/>
        </parameter>
      </target>
      <rule>
        <name value="set id"/>
        <source>
          <context value="vax"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="id"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set status"/>
        <source>
          <context value="vax"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="completed"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set"/>
        <source>
          <context value="vax"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="vaccineCode"/>
          <variable value="code"/>
        </target>
        <rule>
          <name value="set code"/>
          <source>
            <context value="vax"/>
            <element value="VaccineType"/>
            <variable value="vaccineType"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="vaccineType"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="vaccineType"/>
            <variable value="code"/>
          </dependent>
        </rule>
      </rule>
      <rule>
        <name value="set"/>
        <source>
          <context value="vax"/>
          <element value="Source"/>
          <variable value="source"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="reportOrigin"/>
          <variable value="origin"/>
        </target>
        <rule>
          <name value="set report origin"/>
          <source>
            <context value="source"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="source"/>
            </parameter>
          </target>
          <dependent>
            <name value="mapCodingtoCodeableConcept"/>
            <variable value="source"/>
            <variable value="origin"/>
          </dependent>
        </rule>
      </rule>
      <rule>
        <name value="set date"/>
        <source>
          <context value="vax"/>
          <element value="LastDoseDate"/>
          <variable value="date"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="occurrence"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="date"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set dosenumber"/>
        <source>
          <context value="vax"/>
          <element value="NumberOfDoses"/>
          <variable value="doses"/>
        </source>
        <rule>
          <name value="set"/>
          <source>
            <context value="doses"/>
            <element value="display"/>
            <variable value="seriesDose"/>
          </source>
          <target>
            <context value="immunization"/>
            <contextType value="variable"/>
            <element value="protocolApplied"/>
            <variable value="protocol"/>
          </target>
          <target>
            <context value="protocol"/>
            <contextType value="variable"/>
            <element value="series"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="seriesDose"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="set subject"/>
        <source>
          <context value="vax"/>
        </source>
        <target>
          <context value="immunization"/>
          <contextType value="variable"/>
          <element value="patient"/>
          <variable value="subject"/>
        </target>
        <target>
          <context value="subject"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Patient/"/>
          </parameter>
          <parameter>
            <valueId value="pid"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="mapVaccinationStatusToImmunization"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="MeaslesLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="MeaslesCIFComposition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set section"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="section"/>
        <variable value="section"/>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Vaccination History"/>
        </parameter>
      </target>
      <rule>
        <name value="set status"/>
        <source>
          <context value="lm"/>
          <element value="VaccinationStatus"/>
          <variable value="vax"/>
        </source>
        <rule>
          <name value="do"/>
          <source>
            <context value="vax"/>
            <element value="NumberOfDoses"/>
            <variable value="doses"/>
            <condition value="code = '99'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="doses"/>
            </parameter>
          </target>
          <dependent>
            <name value="createImmunizationResource"/>
            <variable value="vax"/>
            <variable value="bundle"/>
            <variable value="section"/>
            <variable value="pid"/>
          </dependent>
        </rule>
        <rule>
          <name value="set"/>
          <source>
            <context value="vax"/>
            <element value="NumberOfDoses"/>
            <variable value="doses"/>
            <condition value="code = '1'"/>
          </source>
          <target>
            <contextType value="variable"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="doses"/>
            </parameter>
          </target>
          <rule>
            <name value="do1"/>
            <source>
              <context value="vax"/>
              <element value="LastDoseDate"/>
              <variable value="date"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="date"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
        </rule>
        <rule>
          <name value="set doses"/>
          <source>
            <context value="vax"/>
            <element value="NumberOfDoses"/>
            <variable value="doses"/>
            <condition value="code = '2'"/>
          </source>
          <rule>
            <name value="do2"/>
            <source>
              <context value="doses"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
              <element value="LastDoseDate"/>
              <variable value="date"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="date"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
        </rule>
        <rule>
          <name value="set doses"/>
          <source>
            <context value="vax"/>
            <element value="NumberOfDoses"/>
            <variable value="doses"/>
            <condition value="code = '3'"/>
          </source>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
              <element value="LastDoseDate"/>
              <variable value="date"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="date"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
        </rule>
        <rule>
          <name value="set doses"/>
          <source>
            <context value="vax"/>
            <element value="NumberOfDoses"/>
            <variable value="doses"/>
            <condition value="code = '4'"/>
          </source>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="doses"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
          <rule>
            <name value="do"/>
            <source>
              <context value="vax"/>
              <element value="LastDoseDate"/>
              <variable value="date"/>
            </source>
            <target>
              <contextType value="variable"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="date"/>
              </parameter>
            </target>
            <dependent>
              <name value="createImmunizationResource"/>
              <variable value="vax"/>
              <variable value="bundle"/>
              <variable value="section"/>
              <variable value="pid"/>
            </dependent>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="LmToComposition"/>
    <typeMode value="none"/>
    <input>
      <name value="lm"/>
      <type value="SOTMeasles"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="Composition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="cid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="prid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="oid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="eid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set id"/>
      <source>
        <context value="cid"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="cid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set status"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set title"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="PAHO Measles Case Investigation Form"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set type"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="coding"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Coding"/>
        </parameter>
      </target>
      <target>
        <context value="coding"/>
        <contextType value="variable"/>
        <element value="code"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="55751-2"/>
        </parameter>
      </target>
      <target>
        <context value="coding"/>
        <contextType value="variable"/>
        <element value="system"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="http://loinc.org"/>
        </parameter>
      </target>
      <target>
        <context value="coding"/>
        <contextType value="variable"/>
        <element value="display"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Public health Case report"/>
        </parameter>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="code"/>
        <transform value="create"/>
        <parameter>
          <valueString value="CodeableConcept"/>
        </parameter>
      </target>
      <target>
        <context value="code"/>
        <contextType value="variable"/>
        <element value="coding"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="coding"/>
        </parameter>
      </target>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="type"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="code"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set date reported local"/>
      <source>
        <context value="lm"/>
        <element value="ReportingSource"/>
        <variable value="reportingSource"/>
      </source>
      <target>
        <contextType value="variable"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="reportingSource"/>
        </parameter>
      </target>
      <rule>
        <name value="set date"/>
        <source>
          <context value="reportingSource"/>
          <element value="DateReportedLocal"/>
          <variable value="date"/>
        </source>
        <target>
          <context value="composition"/>
          <contextType value="variable"/>
          <element value="date"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="date"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set subject"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <rule>
        <name value="set subject"/>
        <source>
          <context value="lm"/>
        </source>
        <target>
          <context value="subject"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Patient/"/>
          </parameter>
          <parameter>
            <valueId value="pid"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set author practitioner"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="author"/>
        <variable value="practitioner"/>
      </target>
      <rule>
        <name value="set author practitioner"/>
        <source>
          <context value="lm"/>
        </source>
        <target>
          <context value="practitioner"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Practitioner/"/>
          </parameter>
          <parameter>
            <valueId value="prid"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set author org"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="author"/>
        <variable value="institution"/>
      </target>
      <rule>
        <name value="set author institution"/>
        <source>
          <context value="lm"/>
        </source>
        <target>
          <context value="institution"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Organization/"/>
          </parameter>
          <parameter>
            <valueId value="oid"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set encounter"/>
      <source>
        <context value="lm"/>
      </source>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="encounter"/>
      </target>
      <rule>
        <name value="set encounter"/>
        <source>
          <context value="lm"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Encounter/"/>
          </parameter>
          <parameter>
            <valueId value="eid"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="DemographicsToPatient"/>
    <typeMode value="none"/>
    <input>
      <name value="demographics"/>
      <type value="DemographicsLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="MeaslesPatient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set patient id"/>
      <source>
        <context value="pid"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="pid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="Set name"/>
      <source>
        <context value="demographics"/>
        <element value="Name"/>
        <variable value="sourceName"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="name"/>
        <variable value="targetName"/>
      </target>
      <rule>
        <name value="Copy name"/>
        <source>
          <context value="sourceName"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="sourceName"/>
          </parameter>
        </target>
        <dependent>
          <name value="humanNameToHumanName"/>
          <variable value="sourceName"/>
          <variable value="targetName"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="set date of birth"/>
      <source>
        <context value="demographics"/>
        <element value="DateOfBirth"/>
        <variable value="dob"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="birthDate"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="dob"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set sex"/>
      <source>
        <context value="demographics"/>
        <element value="Sex"/>
        <variable value="sex"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="gender"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="sex"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set CountryOfBirth"/>
      <source>
        <context value="demographics"/>
        <element value="CountryOfBirth"/>
        <variable value="cob"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="CountryOfBirth"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="cob"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set landmark"/>
      <source>
        <context value="demographics"/>
        <element value="Landmark"/>
        <variable value="landmark"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="extension"/>
        <variable value="ext"/>
      </target>
      <rule>
        <name value="set landmark value"/>
        <source>
          <context value="landmark"/>
        </source>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Landmark"/>
          </parameter>
        </target>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="landmark"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set guardian"/>
      <source>
        <context value="demographics"/>
        <element value="Guardian"/>
        <variable value="guardian"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="extension"/>
        <variable value="ext"/>
      </target>
      <rule>
        <name value="set guardian value"/>
        <source>
          <context value="guardian"/>
        </source>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Guardian"/>
          </parameter>
        </target>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="guardian"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="Set contact"/>
      <source>
        <context value="demographics"/>
        <element value="Telephone"/>
        <variable value="sourcePhone"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="telecom"/>
        <variable value="targetPhone"/>
      </target>
      <rule>
        <name value="Copy contact"/>
        <source>
          <context value="sourcePhone"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="sourcePhone"/>
          </parameter>
        </target>
        <dependent>
          <name value="contactPointToContactPoint"/>
          <variable value="sourcePhone"/>
          <variable value="targetPhone"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="set address"/>
      <source>
        <context value="demographics"/>
        <element value="PlaceOfResidence"/>
        <variable value="sourceAddress"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="address"/>
        <variable value="targetAddress"/>
      </target>
      <rule>
        <name value="Copy Address"/>
        <source>
          <context value="sourceAddress"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="sourceAddress"/>
          </parameter>
        </target>
        <dependent>
          <name value="addressToAddress"/>
          <variable value="sourceAddress"/>
          <variable value="targetAddress"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="set occupation"/>
      <source>
        <context value="demographics"/>
        <element value="Occupation"/>
        <variable value="occupation"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="extension"/>
        <variable value="ext"/>
      </target>
      <rule>
        <name value="set occupation value"/>
        <source>
          <context value="occupation"/>
        </source>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/Occupation"/>
          </parameter>
        </target>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="occupation"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="set work address"/>
      <source>
        <context value="demographics"/>
        <element value="WorkAddress"/>
        <variable value="workAddress"/>
      </source>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="extension"/>
        <variable value="ext"/>
      </target>
      <rule>
        <name value="set work address value"/>
        <source>
          <context value="workAddress"/>
        </source>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="http://worldhealthorganization.github.io/smart-ot/StructureDefinition/WorkAddress"/>
          </parameter>
        </target>
        <target>
          <context value="ext"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="workAddress"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ReportingSourceToPractitioner"/>
    <typeMode value="none"/>
    <input>
      <name value="reportingSource"/>
      <type value="ReportingSourceLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="practitioner"/>
      <type value="Practitioner"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="prid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set id"/>
      <source>
        <context value="prid"/>
      </source>
      <target>
        <context value="practitioner"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="prid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set name"/>
      <source>
        <context value="reportingSource"/>
        <element value="ReportedBy"/>
        <variable value="name"/>
      </source>
      <target>
        <context value="practitioner"/>
        <contextType value="variable"/>
        <element value="name"/>
        <variable value="humanName"/>
      </target>
      <target>
        <context value="humanName"/>
        <contextType value="variable"/>
        <element value="text"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="name"/>
        </parameter>
      </target>
    </rule>
  </group>
  <group>
    <name value="ReportingSourceToOrganization"/>
    <typeMode value="none"/>
    <input>
      <name value="reportingSource"/>
      <type value="ReportingSourceLogicalModel"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="organization"/>
      <type value="Organization"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="oid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="set id"/>
      <source>
        <context value="oid"/>
      </source>
      <target>
        <context value="organization"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="oid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set name"/>
      <source>
        <context value="reportingSource"/>
        <element value="HealthServiceName"/>
        <variable value="name"/>
      </source>
      <target>
        <context value="organization"/>
        <contextType value="variable"/>
        <element value="name"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="name"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set phone"/>
      <source>
        <context value="reportingSource"/>
        <element value="HealthServiceTelephone"/>
        <variable value="phoneSource"/>
      </source>
      <target>
        <context value="organization"/>
        <contextType value="variable"/>
        <element value="contact"/>
        <variable value="contactDetails"/>
      </target>
      <target>
        <context value="contactDetails"/>
        <contextType value="variable"/>
        <element value="telecom"/>
        <variable value="phoneTarget"/>
      </target>
      <rule>
        <name value="set org contact"/>
        <source>
          <context value="phoneSource"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="phoneSource"/>
          </parameter>
        </target>
        <dependent>
          <name value="contactPointToContactPoint"/>
          <variable value="phoneSource"/>
          <variable value="phoneTarget"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="set address"/>
      <source>
        <context value="reportingSource"/>
        <element value="PlaceOfReporting"/>
        <variable value="locationSource"/>
      </source>
      <target>
        <context value="organization"/>
        <contextType value="variable"/>
        <element value="contact"/>
        <variable value="contactDetails"/>
      </target>
      <target>
        <context value="contactDetails"/>
        <contextType value="variable"/>
        <element value="address"/>
        <variable value="locationTarget"/>
      </target>
      <rule>
        <name value="set org address"/>
        <source>
          <context value="locationSource"/>
        </source>
        <target>
          <contextType value="variable"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="locationSource"/>
          </parameter>
        </target>
        <dependent>
          <name value="contactPointToContactPoint"/>
          <variable value="locationSource"/>
          <variable value="locationTarget"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="mapEncounters"/>
    <typeMode value="none"/>
    <input>
      <name value="clinical"/>
      <type value="SOTMeaslesClinical"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="section"/>
      <type value="Element"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="dff"/>
      <source>
        <context value="clinical"/>
        <element value="HistoryOfHospitalization"/>
        <condition value="code = 'Yes'"/>
      </source>
      <rule>
        <name value="d"/>
        <source>
          <context value="clinical"/>
          <element value="DateOfAdmission"/>
          <variable value="date"/>
        </source>
        <rule>
          <name value="create"/>
          <source>
            <context value="date"/>
          </source>
          <target>
            <contextType value="variable"/>
            <variable value="type"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="type"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="IMP"/>
            </parameter>
          </target>
          <target>
            <context value="type"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
            </parameter>
          </target>
          <target>
            <context value="type"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="inpatient encounter"/>
            </parameter>
          </target>
          <dependent>
            <name value="createEncounterResource"/>
            <variable value="date"/>
            <variable value="bundle"/>
            <variable value="section"/>
            <variable value="pid"/>
            <variable value="type"/>
          </dependent>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="createEncounterResource"/>
    <typeMode value="none"/>
    <input>
      <name value="date"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="section"/>
      <type value="Element"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="type"/>
      <type value="Coding"/>
      <mode value="source"/>
    </input>
    <rule>
      <name value="dssd"/>
      <source>
        <context value="date"/>
      </source>
      <target>
        <contextType value="variable"/>
        <variable value="eid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="entry"/>
      </target>
      <target>
        <context value="entry"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="eid"/>
        </parameter>
      </target>
      <target>
        <context value="section"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="sectionEntry"/>
      </target>
      <target>
        <context value="sectionEntry"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="Encounter/"/>
        </parameter>
        <parameter>
          <valueId value="eid"/>
        </parameter>
      </target>
      <target>
        <context value="entry"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="encounter"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Encounter"/>
        </parameter>
      </target>
      <rule>
        <name value="set id"/>
        <source>
          <context value="date"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="id"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="eid"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set status"/>
        <source>
          <context value="date"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="finished"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set subject"/>
        <source>
          <context value="pid"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="subject"/>
        </target>
        <target>
          <context value="subject"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Patient/"/>
          </parameter>
          <parameter>
            <valueId value="pid"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set date"/>
        <source>
          <context value="date"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="period"/>
          <variable value="period"/>
        </target>
        <target>
          <context value="period"/>
          <contextType value="variable"/>
          <element value="start"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="date"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="set type"/>
        <source>
          <context value="type"/>
        </source>
        <target>
          <context value="encounter"/>
          <contextType value="variable"/>
          <element value="class"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="type"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="createCompositionEncounterResource"/>
    <typeMode value="none"/>
    <input>
      <name value="date"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="pid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="type"/>
      <type value="Coding"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="eid"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="encounter"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="set id"/>
      <source>
        <context value="date"/>
      </source>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="eid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set status"/>
      <source>
        <context value="date"/>
      </source>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="finished"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set subject"/>
      <source>
        <context value="pid"/>
      </source>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <target>
        <context value="subject"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="Patient/"/>
        </parameter>
        <parameter>
          <valueId value="pid"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set date"/>
      <source>
        <context value="date"/>
      </source>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="period"/>
        <variable value="period"/>
      </target>
      <target>
        <context value="period"/>
        <contextType value="variable"/>
        <element value="start"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="date"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="set type"/>
      <source>
        <context value="type"/>
      </source>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="class"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="type"/>
        </parameter>
      </target>
    </rule>
  </group>
</StructureMap>