CDA to FHIR Maps
0.1.0 - ci-build IT

CDA to FHIR Maps - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

: CDA to FHIR - LDO - XML Representation

Draft as of 2024-04-11

Raw xml | Download



<StructureMap xmlns="http://hl7.org/fhir">
  <id value="cda2fhirLdo"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
         <pre>map &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirLdo&quot; = &quot;cda2fhirLdo&quot;

uses &quot;http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument&quot; alias ClinicalDocument as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor&quot; alias AssignedAuthor as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity&quot; alias AssignedEntity as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity&quot; alias AssociatedEntity as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization&quot; alias CustodianOrganization as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf&quot; alias OrganizationPartOf as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Organization&quot; alias rapresentedOrganization as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Section&quot; alias Section as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/PatientRole&quot; alias PatientRole as queried
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AD&quot; alias AD as source
uses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target
uses &quot;http://hl7.org/fhir/StructureDefinition/Composition&quot; alias Composition as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Encounter&quot; alias Encounter as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Person&quot; alias Patient as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as produced
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Act&quot; alias Act as produced
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ&quot; alias IVL_PQ as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/PQ&quot; alias PQ as source
uses &quot;http://hl7.org/fhir/StructureDefinition/SimpleQuantity&quot; alias SimpleQuantity as target

imports &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes&quot;
imports &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader&quot;

group CdaToBundle(source cda : ClinicalDocument, target bundle : Bundle) {
  cda -&gt;  bundle.entry as e,  e.request = create('BackboneElement') as request,  request.method = 'POST',  e.resource = create('Composition') as composition,  composition.id = uuid() as uuid1,  e.fullUrl = append('https://example/Composition/', uuid1),  request.url = 'Composition',  bundle.entry as e2,  e2.request = create('BackboneElement') as requestPAT,  requestPAT.method = 'PUT',  e2.resource = create('Patient') as patient,  patient.id = uuid() as uuid2,  e2.fullUrl = append('https://example/Patient/', uuid2),  bundle.entry as e3,  e3.request = create('BackboneElement') as request,  request.method = 'POST',  e3.resource = create('Encounter') as encounter,  encounter.id = uuid() as uuid3,  e3.fullUrl = append('https://example/Encounter/', uuid3),  request.url = 'Encounter',  bundle.entry as e5,  e5.request = create('BackboneElement') as request,  request.method = 'POST',  e5.resource = create('DocumentReference') as DocumentReference,  DocumentReference.id = uuid() as uuid5,  e5.fullUrl = append('https://example/DocumentReference/', uuid5),  request.url = 'DocumentReference' then {
    cda then ClinicalDocumentToBundle(cda, patient, composition, encounter, bundle, DocumentReference) &quot;cdatobundle&quot;;
    cda.recordTarget as recordTarget then {
      recordTarget.patientRole as patient then {
        patient.id as id -&gt; patient.identifier as identifier then {
          id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
          id.extension as ext -&gt; identifier.value = ext;
          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        } &quot;record&quot;;
        patient.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') or (root = '2.16.840.1.113883.2.9.4.3.7') or (root = '2.16.840.1.113883.2.9.4.3.3') or (root = '2.16.840.1.113883.2.9.4.3.17') or (root = '2.16.840.1.113883.2.9.4.3.18') or (root = '2.16.840.1.113883.2.9.2.10.4.1.1') or (root = '2.16.840.1.113883.2.9.2.20.4.1.1') or (root = '2.16.840.1.113883.2.9.2.30.4.1.1') or (root = '2.16.840.1.113883.2.9.2.41.4.1.1') or (root = '2.16.840.1.113883.2.9.2.42.4.1.1') or (root = '2.16.840.1.113883.2.9.2.50.4.1.1') or (root = '2.16.840.1.113883.2.9.2.60.4.1.1') or (root = '2.16.840.1.113883.2.9.2.70.4.1.1') or (root = '2.16.840.1.113883.2.9.2.80.4.1.1') or (root = '2.16.840.1.113883.2.9.2.90.4.1.1') or (root = '2.16.840.1.113883.2.9.2.100.4.1.1') or (root = '2.16.840.1.113883.2.9.2.110.4.1.1') or (root = '2.16.840.1.113883.2.9.2.120.4.1.1') or (root = '2.16.840.1.113883.2.9.2.130.4.1.1') or (root = '2.16.840.1.113883.2.9.2.140.4.1.1') or (root = '2.16.840.1.113883.2.9.2.150.4.1.1') or (root = '2.16.840.1.113883.2.9.2.160.4.1.1') or (root = '2.16.840.1.113883.2.9.2.170.4.1.1') or (root = '2.16.840.1.113883.2.9.2.180.4.1.1') or (root = '2.16.840.1.113883.2.9.2.190.4.1.1') or (root = '2.16.840.1.113883.2.9.2.200.4.1.1') or (root = '2.16.840.1.113883.2.9.2.10.4.1') or (root = '2.16.840.1.113883.2.9.2.20.4.1') or (root = '2.16.840.1.113883.2.9.2.30.4.1') or (root = '2.16.840.1.113883.2.9.2.41.4.1') or (root = '2.16.840.1.113883.2.9.2.42.4.1') or (root = '2.16.840.1.113883.2.9.2.50.4.1') or (root = '2.16.840.1.113883.2.9.2.60.4.1') or (root = '2.16.840.1.113883.2.9.2.70.4.1') or (root = '2.16.840.1.113883.2.9.2.80.4.1') or (root = '2.16.840.1.113883.2.9.2.90.4.1') or (root = '2.16.840.1.113883.2.9.2.100.4.1') or (root = '2.16.840.1.113883.2.9.2.110.4.1') or (root = '2.16.840.1.113883.2.9.2.120.4.1') or (root = '2.16.840.1.113883.2.9.2.130.4.1') or (root = '2.16.840.1.113883.2.9.2.140.4.1') or (root = '2.16.840.1.113883.2.9.2.150.4.1') or (root = '2.16.840.1.113883.2.9.2.160.4.1') or (root = '2.16.840.1.113883.2.9.2.170.4.1') or (root = '2.16.840.1.113883.2.9.2.180.4.1') or (root = '2.16.840.1.113883.2.9.2.190.4.1') or (root = '2.16.840.1.113883.2.9.2.200.4.1') or (root = '2.16.840.1.113883.2.9.4.3.15') then {
          id.extension as ext -&gt; requestPAT.url = append('Patient?identifier=', ext) &quot;UUID&quot;;
        } &quot;ext&quot;;
      } &quot;recPat&quot;;
    } &quot;patient&quot;;
  } &quot;ClinicalDocumentToBody&quot;;
}

group ClinicalDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target encounter : Encounter, target bundle : Bundle, target DocumentReference : DocumentReference) {
  cda -&gt; bundle.id = uuid() &quot;id&quot;;
  cda.id -&gt; bundle.identifier &quot;identifier&quot;;
  cda -&gt; bundle.type = 'transaction' &quot;type&quot;;
  cda -&gt; bundle.timestamp = (timestamp.now()) &quot;date&quot;;
  cda then ClinicalDocumentComposition(cda, composition, patient, encounter, bundle, DocumentReference) &quot;composition&quot;;
  cda.component as component then {
    component.structuredBody as body then {
      body.component as component then {
        // discretizzi il primo livello di component
        component.section as srcSection then {
          srcSection.code where (code = '46241-6') -&gt; composition.section as tgtSection then ClinicalDocumentSectionMotivoRicovero(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;motivoRicovero&quot;;
          srcSection.code where (code = '47039-3') -&gt; composition.section as tgtSection then ClinicalDocumentSectionInquadramentoClinico(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;inquadramentoClinico&quot;;
          srcSection.code where (code = '8648-8') -&gt; composition.section as tgtSection then ClinicalDocumentSectionDecorsoOspedaliero(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;DecorsoOspedaliero&quot;;
          srcSection.code where (code = '55109-3') -&gt; composition.section as tgtSection then ClinicalDocumentSectionComplicanze(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;Complicazioni&quot;;
          srcSection.code where (code = '11493-4') -&gt; composition.section as tgtSection then ClinicalDocumentSectionRiscontri(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;HospitalDischargeStudiesSummary&quot;;
          srcSection.code where (code = '34104-0') -&gt; composition.section as tgtSection then ClinicalDocumentSectionConsulenza(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;HospitalDischargeStudiesSummary&quot;;
          srcSection.code where (code = '30954-2') -&gt; composition.section as tgtSection then ClinicalDocumentSectionEsamiEseguitiRicovero(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;EsamiEseguitiDuranteilRicovero&quot;;
          srcSection.code where (code = '47519-4') -&gt; composition.section as tgtSection then ClinicalDocumentSectionProcedureEseguiteRicovero(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;HistoryOfProceduresDocument&quot;;
          srcSection.code where (code = '48765-2') -&gt; composition.section as tgtSection then ClinicalDocumentSectionAllergie(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;EsamiEseguitiDuranteIlRicovero&quot;;
          srcSection.code where (code = '10160-0') -&gt; composition.section as tgtSection then ClinicalDocumentSectionTerapiaFarmacologicaDuranteRicovero(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;TerapiaFarmacologicaAllaDimissione&quot;;
          srcSection.code where (code = '11535-2') -&gt; composition.section as tgtSection then ClinicalDocumentSectionDiagnosiDimissione(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;DiagnosiDiDimissione&quot;;
          srcSection.code where (code = '18776-5') -&gt; composition.section as tgtSection then ClinicalDocumentSectionIstruzioniFollowUp(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;DiagnosiDiDimissione&quot;;
          srcSection.code where (code = '10183-2') -&gt; composition.section as tgtSection then ClinicalDocumentSectionTerapiaDimissione(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;TerapiaFarmacologicaAllaDimissione&quot;;
        };
      };
    } &quot;body&quot;;
  };
}

// -------------------------------------------------------------------------------------------------------------------
group ClinicalDocumentSectionMotivoRicovero(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;cText&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
    entry1.observation as obs then Observation(obs, patient, enc, observation, bundle) &quot;act&quot;;
  };
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e8,  e8.request = create('BackboneElement') as request,  request.method = 'POST',  e8.resource = create('Observation') as Observation,  Observation.id = uuid() as uuid8,  e8.fullUrl = append('https://example/Observation/', uuid8),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %Observation.id) then {
      src -&gt;  Observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  Observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src.code -&gt; Observation.code;
      src where observation.statusCode.exists().not() then {
        src -&gt; Observation.status = 'final' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; Observation.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
}

group ClinicalDocumentSectionInquadramentoClinico(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id),  tgt.text as fhirText then {
    cdaText -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    cdaText -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    src.code -&gt; observation.code;
    src where observation.statusCode.exists().not() then {
      src -&gt; observation.status = 'final' &quot;status&quot;;
    } &quot;statuscode&quot;;
    cdaText -&gt; observation.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
    } &quot;reference&quot;;
  } &quot;cdaText&quot;;
  src.component as component then {
    component.section as section2 then {
      // ANAMNESI
      section2 -&gt; tgt.section as sec2 then {
        section2.code where (code = '11329-0') -&gt; sec2.code;
        section2.title as t -&gt; sec2.title = (t.dataString);
        // section2.code -&gt; sec2.code;
        src where src.entry.exists() then {
          section2.text as cdaText -&gt; sec2.text as fhirText then {
            cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
            cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
          } &quot;cdaText&quot;;
        } &quot;exist&quot;;
        src where src.entry.exists().not() then {
          section2.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as condition,  condition.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  sec2.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %condition.id) then {
            section2.code -&gt; condition.code;
            src where condition.statusCode.exists().not() then {
              src -&gt; condition.status = 'final' &quot;status&quot;;
            } &quot;statuscode&quot;;
            cdaText -&gt; condition.note as note then {
              cdaText -&gt;  condition.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
              cdaText -&gt;  condition.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
              cdaText as t -&gt; note.text = t &quot;reference&quot;;
            } &quot;reference&quot;;
          } &quot;cdaText&quot;;
        } &quot;where&quot;;
        section2.entry as entry1 then {
          entry1.observation as obs then {
            // EntryRelationship per il Problem
            obs.code where (code = '75326-9') then {
              obs -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Condition') as condition,  condition.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Condition/', uuid1),  request.url = 'Condition',  sec2.entry = create('Reference') as reference,  reference.reference = ('https://example/Condition/' + %condition.id) then {
                obs.code -&gt; condition.category;
                obs -&gt;  condition.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
                obs -&gt;  condition.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
                obs.statusCode as status where (code = 'completed') -&gt; condition.verificationStatus as status2 then {
                  status -&gt; status2.coding as status3 then {
                    status -&gt; status3.code = 'confirmed' &quot;finald&quot;;
                    status -&gt; status3.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status' &quot;system&quot;;
                  } &quot;st3&quot;;
                } &quot;status&quot;;
                obs.effectiveTime as effective1 then {
                  effective1 where effective1.low.exists() or effective1.high.exists() then {
                    effective1 -&gt; condition.onset = create('Period') as periodonset then IVLTSPeriod(effective1, periodonset) &quot;onsetperiod&quot;;
                  } &quot;ef&quot;;
                } &quot;effectivetime1&quot;;
                obs.value : CD as val then {
                  val -&gt; condition.code = create('CodeableConcept') as ce then {
                    val.originalText -&gt; ce.text;
                    val -&gt; ce.coding as coding then {
                      val.code as code -&gt; coding.code = cast(code, 'string');
                      val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
                      val.displayName as display -&gt; coding.display = cast(display, 'string');
                    } &quot;coding&quot;;
                  } &quot;Ce&quot;;
                } &quot;Value&quot;;
                obs.entryRelationship as entriRel then {
                  entriRel -&gt; condition.evidence = create('BackboneElement') as evidence then {
                    entriRel.observation as observation2 then {
                      observation2.code as code then {
                        code.code where (code.code = '89261-2') then {
                          obs -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation' then {
                            entriRel -&gt;  evidence.detail = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) &quot;ref&quot;;
                            observation2.code -&gt; observation.code;
                            observation2 where observation.statusCode.exists().not() then {
                              observation2 -&gt; observation.status = 'final' &quot;status&quot;;
                            } &quot;statuscode&quot;;
                            observation2.text as text -&gt; observation.note = create('Annotation') as note then {
                              text.reference as ref -&gt; note.text = (ref.value) &quot;val&quot;;
                            } &quot;Annontation&quot;;
                            obs -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
                            obs -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
                            observation2.statusCode as statusc where (code = 'completed') -&gt; ob.status = 'final';
                            observation2.statusCode as statusc where (code = 'active') -&gt; ob.status = 'registered';
                            observation2.statusCode as statusc where (code = 'aborted') -&gt; ob.status = 'cancelled';
                            observation2.statusCode as statusc where (code = 'suspended') -&gt; ob.status = 'partial';
                            observation2.value : INT as int -&gt; ob.value = (int.value);
                            observation2.value : BL as boolean -&gt; ob.value = (boolean.value) &quot;boolean&quot;;
                            observation2.value : CD as val then {
                              val -&gt; ob.value = create('CodeableConcept') as ce then {
                                val.originalText as originalText then {
                                  originalText.reference as reference -&gt; ce.text = reference;
                                } &quot;originltext&quot;;
                                val -&gt; ce.coding as coding then {
                                  val.code as code -&gt; coding.code = cast(code, 'string');
                                  val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
                                  val.displayName as display -&gt; coding.display = cast(display, 'string');
                                  val.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
                                } &quot;code&quot;;
                                val.translation as translation -&gt; ce.coding as coding then {
                                  translation.code as code -&gt; coding.code = cast(code, 'string');
                                  translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
                                  translation.displayName as display -&gt; coding.display = cast(display, 'string');
                                  translation.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
                                  translation.qualifier as qualifier then {
                                    qualifier.value as value -&gt; ce.coding as coding then {
                                      value.code as code -&gt; coding.code = cast(code, 'string');
                                      value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
                                      value.displayName as display -&gt; coding.display = cast(display, 'string');
                                      value.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
                                    };
                                  };
                                };
                              } &quot;coding&quot;;
                            } &quot;val&quot;;
                            observation2.value : PQ as val then {
                              val -&gt; ob.value = create('Quantity') as quantity then {
                                val.value as value -&gt; quantity.value = value;
                                val.unit as unit -&gt; quantity.unit = unit;
                              } &quot;quantity&quot;;
                            } &quot;valueQuantity&quot;;
                            observation2.value : ST as value -&gt;  ob.value = create('string'),  ob.value = (value.dataString);
                            observation2.value : CE as val then {
                              val -&gt; observation.value = create('CodeableConcept') as ce then {
                                val.originalText -&gt; ce.text;
                                val -&gt; ce.coding as coding then {
                                  val.code as code -&gt; coding.code = cast(code, 'string');
                                  val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
                                  val.displayName as display -&gt; coding.display = cast(display, 'string');
                                } &quot;coding&quot;;
                              } &quot;Ce&quot;;
                            } &quot;Value&quot;;
                          } &quot;obser&quot;;
                        } &quot;whereDecorsoClinico&quot;;
                      };
                    } &quot;Observation2&quot;;
                  } &quot;evidence&quot;;
                } &quot;EntryRelationship1&quot;;
                obs.entryRelationship as entriRel then {
                  entriRel.observation as observation2 then {
                    observation2.code as code then {
                      code.code where (code.code = '33999-4') then {
                        observation2 -&gt; condition.clinicalStatus = create('CodeableConcept') as status then {
                          observation2.text as text then {
                            text.reference as refstat -&gt; status.text = (refstat.value) &quot;statref&quot;;
                          } &quot;textstat&quot;;
                          observation2 -&gt; status.coding = create('Coding') as coding then {
                            observation2.value as value then {
                              value.code where (value.code = 'LA16666-2') -&gt; coding.code = 'active' &quot;active&quot;;
                              value.code where (value.code = 'LA18632-2') -&gt; coding.code = 'inactive' &quot;inactive&quot;;
                              value.codeSystem as system -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical' &quot;system&quot;;
                              value.displayName as display -&gt; coding.display = cast(display, 'string');
                            } &quot;value1&quot;;
                          } &quot;coding&quot;;
                        } &quot;code&quot;;
                      } &quot;whereDecorsoClinico&quot;;
                    } &quot;codestatus&quot;;
                  } &quot;observationstatus&quot;;
                } &quot;entryrelationshipstatus&quot;;
              } &quot;whereEntryPatologicaProssima&quot;;
            } &quot;observationcondition&quot;;
          } &quot;entry&quot;;
        } &quot;subsection1&quot;;
        // ESAME PBIETTIVO
        section2.code where (code = '29545-1') then ClinicalDocumentSottoSectionOBS(section2, sec2, bundle, enc, patient) &quot;esameObiettivo&quot;;
        // TETAPIA FARMACOLOGICA
        section2.code where (code = '42346-7') then ClinicalDocumentSottoSectionMS(section2, sec2, bundle, patient, enc) &quot;TerapiaFarmacologicaAllIngresso&quot;;
      } &quot;sec2fhir&quot;;
    } &quot;componentSec&quot;;
  };
}

group ClinicalDocumentSectionDecorsoOspedaliero(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id),  tgt.text as fhirText then {
    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    src.code -&gt; observation.code;
    src where observation.statusCode.exists().not() then {
      src -&gt; observation.status = 'final' &quot;status&quot;;
    } &quot;statuscode&quot;;
    src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    cdaText -&gt; observation.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
    } &quot;reference&quot;;
  } &quot;cdaText&quot;;
  src.component as component then {
    component.section as section2 then {
      src then ClinicalDocumentSottoSectionOBS(section2, tgt, bundle, enc, patient) &quot;Decorso&quot;;
    } &quot;1&quot;;
  } &quot;2&quot;;
}

group ClinicalDocumentSectionComplicanze(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exist&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
      src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src.code -&gt; observation.code;
      src where observation.statusCode.exists().not() then {
        src -&gt; observation.status = 'final' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; observation.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
    entry1.observation as obs then Observation(obs, patient, enc, observation, bundle) &quot;act&quot;;
  };
}

group ClinicalDocumentSectionRiscontri(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id),  tgt.text as fhirText then {
    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    src.code -&gt; observation.code;
    src where observation.statusCode.exists().not() then {
      src -&gt; observation.status = 'final' &quot;status&quot;;
    } &quot;statuscode&quot;;
    src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    cdaText -&gt; observation.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
    } &quot;reference&quot;;
  } &quot;cdaText&quot;;
  src.component as component then {
    component.section as section2 then {
      src then ClinicalDocumentSottoSectionOBS(section2, tgt, bundle, enc, patient) &quot;Decorso&quot;;
    } &quot;1&quot;;
  } &quot;2&quot;;
}

group ClinicalDocumentSectionConsulenza(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exist&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
      src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src.code -&gt; observation.code;
      src where observation.statusCode.exists().not() then {
        src -&gt; observation.status = 'final' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; observation.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
    entry1.observation as obs then ObservationConsulenza(obs, patient, enc, observation, bundle) &quot;act&quot;;
  };
}

group ClinicalDocumentSectionEsamiEseguitiRicovero(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exists&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
      src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src.code -&gt; observation.code;
      src where observation.statusCode.exists().not() then {
        src -&gt; observation.status = 'final' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; observation.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
    entry1.observation as obs then ObservationEsamiDuranteRicovero(obs, patient, enc, observation, bundle) &quot;act&quot;;
  };
}

group ClinicalDocumentSectionProcedureEseguiteRicovero(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exists&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Procedure') as procedure,  procedure.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Procedure/', uuid1),  request.url = 'Procedure',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Procedure/' + %procedure.id) then {
      src -&gt;  procedure.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  procedure.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src -&gt; procedure.status = 'unknown' &quot;statuscode&quot;;
      cdaText -&gt; procedure.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Procedure') as procedure,  procedure.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Procedure/', uuid1),  request.url = 'Procedure',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Procedure/' + %procedure.id) then {
    src -&gt;  procedure.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  procedure.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    entry1.procedure as proceduresrc then {
      proceduresrc.code -&gt; procedure.code;
      proceduresrc.text as txt -&gt; procedure.note as note then {
        txt.reference as ref -&gt; note.text = (ref.value);
      };
      proceduresrc where proc.statusCode.exists().not() then {
        proceduresrc -&gt; procedure.status = 'unknown' &quot;statuscode&quot;;
      } &quot;status&quot;;
      proceduresrc.statusCode as statusc where (code = 'completed') -&gt; procedure.status = 'completed';
      proceduresrc.statusCode as statusc where (code = 'active') -&gt; procedure.status = 'in-progress';
      proceduresrc.statusCode as statusc where (code = 'aborted') -&gt; procedure.status = 'stopped';
      proceduresrc.statusCode as statusc where (code = 'suspended') -&gt; procedure.status = 'on-hold';
      proceduresrc.statusCode as statusc where (code = 'cancelled') -&gt; procedure.status = 'not-done';
      proceduresrc.statusCode as statusc where (code = 'held') -&gt; procedure.status = 'on-hold';
      proceduresrc.statusCode as statusc where (code = 'new') -&gt; procedure.status = 'preparation';
      proceduresrc.statusCode as statusc where (code = 'obsolete') -&gt; procedure.status = 'entered-in-error';
      proceduresrc.statusCode as statusc where (code = 'nullified') -&gt; procedure.status = 'unknown';
      proceduresrc.effectiveTime as efft -&gt; procedure.performed = create('Period') as period then IVLTSPeriod(efft, period);
      proceduresrc.entryRelationship as entriRel -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  procedure.reasonReference = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
        entriRel -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
        entriRel -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
        entriRel.observation as obs then {
          obs.code -&gt; observation.code;
          obs where observation.statusCode.exists().not() then {
            obs -&gt; observation.status = 'final' &quot;status&quot;;
          } &quot;statuscode&quot;;
        } &quot;ObservationValue&quot;;
      } &quot;Observation&quot;;
    } &quot;Procedure&quot;;
  } &quot;Entry&quot;;
}

group ClinicalDocumentSectionAllergie(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exists&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('AllergyIntolerance') as allergy,  allergy.id = uuid() as uuid1,  e1.fullUrl = append('https://example/AllergyIntolerance/', uuid1),  request.url = 'AllergyIntolerance',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/AllergyIntolerance/' + %allergy.id) then {
      src -&gt;  allergy.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  allergy.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src -&gt; allergy.clinicalStatus = create('CodeableConcept') as status then {
        src -&gt; status.text = 'string' &quot;text&quot;;
        src -&gt; status.coding = create('Coding') as coding then {
          src -&gt; coding.code = 'active' &quot;active&quot;;
          src -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical' &quot;system&quot;;
        } &quot;coding&quot;;
      } &quot;allergy&quot;;
      src.code -&gt; allergy.code;
      cdaText -&gt; allergy.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('AllergyIntolerance') as allergy,  allergy.id = uuid() as uuid1,  e1.fullUrl = append('https://example/AllergyIntolerance/', uuid1),  request.url = 'AllergyIntolerance',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/AllergyIntolerance/' + %allergy.id) then {
    src -&gt;  allergy.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  allergy.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    entry1.act as actallint then {
      actallint.effectiveTime as eff -&gt; allergy.onset = create('Period') as per then IVLTSPeriod(eff, per);
      actallint.entryRelationship as entryact then {
        entryact.observation as entryobs then {
          entryobs.value as code then {
            code.code as code1 -&gt; allergy.type = translate(code1, '#AllergyTypeMap', 'code') &quot;type&quot;;
            code.code as code2 -&gt; allergy.category = translate(code2, '#AllergyCategoryMap', 'code') &quot;category&quot;;
          } &quot;code&quot;;
          entryobs.participant as partic then {
            partic.participantRole as pratRole then {
              pratRole.playingEntity as pratent then {
                pratent -&gt; allergy.reaction = create('BackboneElement') as reaction then {
                  pratent.code -&gt; reaction.substance &quot;subs&quot;;
                  entryobs.entryRelationship as entryobs1 where (typeCode = 'MFST') then {
                    entryobs1.observation as entobs then {
                      entobs.effectiveTime as eff then {
                        eff.low as l -&gt; reaction.onset = create('dateTime') as start then TSDateTime(l, start) &quot;val&quot;;
                      } &quot;eff&quot;;
                      entobs.value -&gt; reaction.manifestation &quot;manifest&quot;;
                    } &quot;observ&quot;;
                  } &quot;entry&quot;;
                } &quot;cod&quot;;
              } &quot;react&quot;;
            } &quot;pratentit&quot;;
          } &quot;PratRole&quot;;
          entryobs.entryRelationship as entryobs2 then {
            entryobs2.observation as entobs then {
              entobs.code as code where (code = 'SEV') then {
                entobs.value as value then {
                  value.code where (value.code = 'M') -&gt; allergy.criticality = 'unable-to-assess' &quot;active&quot;;
                  value.code where (value.code = 'L') -&gt; allergy.criticality = 'low' &quot;active&quot;;
                  value.code where (value.code = 'H') -&gt; allergy.criticality = 'high' &quot;active&quot;;
                } &quot;entobs&quot;;
              } &quot;sev&quot;;
            } &quot;severity&quot;;
          } &quot;observ&quot;;
          entryobs.entryRelationship as entryobs3 then {
            entryobs3.observation as entobs then {
              entobs.code as code where (code = '33999-4') then {
                entobs -&gt; allergy.clinicalStatus = create('CodeableConcept') as status then {
                  entobs -&gt; status.coding = create('Coding') as coding then {
                    entobs.value as value then {
                      value.code where (value.code = 'LA16666-2') -&gt; coding.code = 'active' &quot;active&quot;;
                      value.code where (value.code = 'LA18632-2') -&gt; coding.code = 'inactive' &quot;active&quot;;
                      value.codeSystem as system -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical' &quot;system&quot;;
                      value.displayName as display -&gt; coding.display = cast(display, 'string');
                    } &quot;value1&quot;;
                  } &quot;coding&quot;;
                } &quot;clinicalStatus&quot;;
              } &quot;stat&quot;;
            } &quot;obobs3serv&quot;;
          } &quot;entry3&quot;;
          entryobs.entryRelationship as entryobs4 then {
            entryobs4.act as entact then {
              entact.text as actext then {
                actext.reference as reftxt -&gt; allergy.note = create('BackboneElement') as note then {
                  reftxt as ref -&gt; note.text = (ref.value) &quot;notxt&quot;;
                } &quot;notetxt&quot;;
              } &quot;txtact&quot;;
            } &quot;obobs4serv&quot;;
          } &quot;entry4&quot;;
        } &quot;partic&quot;;
      };
    };
  } &quot;allergy&quot;;
}

group ClinicalDocumentSectionDiagnosiDimissione(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exists&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
      src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src.code -&gt; observation.code;
      src where observation.statusCode.exists().not() then {
        src -&gt; observation.status = 'final' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; observation.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {
    entry1.observation as obs then Observation(obs, patient, enc, observation, bundle) &quot;act&quot;;
  };
}

group ClinicalDocumentSectionIstruzioniFollowUp(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt; tgt.text as fhirText then {
    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
  } &quot;cdaText&quot;;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('CarePlan') as carePlan,  carePlan.id = uuid() as uuid1,  e1.fullUrl = append('https://example/CarePlan/', uuid1),  request.url = 'CarePlan',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/CarePlan/' + %carePlan.id) then {
    cdaText -&gt; carePlan.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
    } &quot;reference&quot;;
    src -&gt;  carePlan.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  carePlan.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    src -&gt; carePlan.status = 'active' &quot;status&quot;;
    src -&gt; carePlan.intent = 'order' &quot;intent&quot;;
  } &quot;entry&quot;;
}

group ClinicalDocumentSectionTerapiaFarmacologicaDuranteRicovero(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exists&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationAdministration') as medicationAdm,  medicationAdm.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationAdministration/', uuid1),  request.url = 'MedicationAdministration',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationAdministration/' + %medicationAdm.id) then {
      cdaText -&gt;  medicationAdm.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      cdaText -&gt;  medicationAdm.context = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      cdaText -&gt; medicationAdm.medication = create('CodeableConcept') as codecon then {
        cdaText -&gt; codecon.text = 'string' &quot;text&quot;;
      } &quot;code&quot;;
      src -&gt; medicationAdm.effective = create('Period') as period then {
        src -&gt; period.start = (start.now()) &quot;low&quot;;
        src -&gt; period.end = (end.now()) &quot;high&quot;;
      } &quot;Period&quot;;
      src where sub.statusCode.exists().not() then {
        src -&gt; medicationAdm.status = 'completed' &quot;status&quot;;
      } &quot;statuscode&quot;;
      cdaText -&gt; medicationAdm.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationAdministration') as medicationAdm,  medicationAdm.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationAdministration/', uuid1),  request.url = 'MedicationAdministration',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationAdministration/' + %medicationAdm.id) then {
    entry1 -&gt;  medicationAdm.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    entry1 -&gt;  medicationAdm.context = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    entry1.substanceAdministration as sa then {
      sa.text as tx -&gt; medicationAdm.note as note then {
        sa.performer as performer -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner then {
          performer.time as ti -&gt; note.time = (ti.value);
          performer.assignedEntity as assEnty then {
            assEnty -&gt; practitioner.meta as meta then {
              assEnty -&gt; meta.tag = create('Coding') as coding then {
                assEnty -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
                assEnty -&gt; coding.code = 'ClinicalDocument/body/TerapiaFarmacologicaRicovero/performer' &quot;code&quot;;
              } &quot;coding&quot;;
            } &quot;meta&quot;;
            assEnty.id as id -&gt; practitioner.identifier as identifier then {
              id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
              id.extension as ext -&gt; identifier.value = ext;
              id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
              id.root as r then {
                id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e1.fullUrl = append('https://example/Practitioner/', uuid2),  request.url = 'Practitioner',  medicationAdm.performer as perf,  perf.actor = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
              } &quot;r&quot;;
            } &quot;identifier&quot;;
            assEnty.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
              id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
            } &quot;2&quot;;
            assEnty.id as id where (root != '2.16.840.1.113883.2.9.4.3.2') then {
              id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
            } &quot;diverso&quot;;
            assEnty.assignedPerson as assi then {
              assi.name -&gt; practitioner.name;
            } &quot;assi&quot;;
          } &quot;assEntity&quot;;
        } &quot;perf&quot;;
        tx.reference as ref -&gt; note.text = (ref.value);
      } &quot;tx&quot;;
      sa.statusCode as st -&gt; medicationAdm.status = (st.code);
      sa.effectiveTime as eff -&gt; medicationAdm.effective = create('Period') as period then IVLTSPeriod(eff, period) &quot;period&quot;;
      sa -&gt; medicationAdm.dosage as dos then {
        sa.routeCode -&gt; dos.route;
      } &quot;dos&quot;;
      sa -&gt; medicationAdm.dosage as dos then {
        sa.approachSiteCode -&gt; dos.site;
      } &quot;dos&quot;;
      sa.doseQuantity as doseQuant -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationRequest') as medicationRq,  medicationRq.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationRequest/', uuid1),  request.url = 'MedicationRequest',  medicationAdm.request = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medicationRq.id) then {
        doseQuant -&gt; medicationRq.dosageInstruction = create('Dosage') as dosageInstruction then {
          doseQuant.originalText as ot then {
            ot.reference -&gt; dosageInstruction.text;
          } &quot;ot&quot;;
          doseQuant -&gt; dosageInstruction.doseAndRate as dosageRate then {
            doseQuant -&gt; dosageRate.dose = create('Range') as d then {
              doseQuant -&gt; d.low = create('SimpleQuantity') as l then {
                doseQuant.low as lo -&gt; l.value = (lo.value);
                doseQuant.low as lo -&gt; l.unit = (lo.unit);
              } &quot;low&quot;;
              doseQuant -&gt; d.high = create('SimpleQuantity') as h then {
                doseQuant.high as hi -&gt; h.value = (hi.value);
                doseQuant.high as hi -&gt; h.unit = (hi.unit);
              } &quot;low&quot;;
            } &quot;d&quot;;
          } &quot;dosageRate&quot;;
        } &quot;Dosage&quot;;
        sa -&gt;  medicationRq.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
        sa -&gt;  medicationRq.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
        sa -&gt; medicationRq.status = 'active' &quot;status&quot;;
        sa -&gt; medicationRq.intent = 'order' &quot;intent&quot;;
        sa.rateQuantity as rateQuantity -&gt; medicationRq.dosageInstruction = create('Dosage') as dosageInstruction1 then {
          rateQuantity.originalText as ot then {
            ot.reference -&gt; dosageInstruction1.text;
          } &quot;ot&quot;;
          rateQuantity -&gt; dosageInstruction1.doseAndRate as dosageRate then {
            rateQuantity -&gt; dosageRate.rate = create('Range') as d then {
              rateQuantity -&gt; d.low = create('SimpleQuantity') as l then {
                rateQuantity.low as lo -&gt; l.value = (lo.value);
                rateQuantity.low as lo -&gt; l.unit = (lo.unit);
              } &quot;low&quot;;
              rateQuantity -&gt; d.high = create('SimpleQuantity') as h then {
                rateQuantity.high as hi -&gt; h.value = (hi.value);
                rateQuantity.high as hi -&gt; h.unit = (hi.unit);
              } &quot;low&quot;;
            } &quot;d&quot;;
          } &quot;dosageRate&quot;;
        } &quot;Dosage&quot;;
        sa -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Medication') as medication,  medication.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Medication/', uuid1),  request.url = 'Medication',  medicationAdm.medication = create('Reference') as reference,  reference.reference = ('https://example/Medication/' + %medication.id) then {
          sa -&gt;  medicationRq.medication = create('Reference') as reference,  reference.reference = ('https://example/Medication/' + %medication.id) &quot;reference&quot;;
          sa.administrationUnitCode -&gt; medication.form;
          sa.consumable as consumable then {
            consumable.manufacturedProduct as manufac then {
              manufac.manufacturedMaterial as manuprod then {
                manuprod.code -&gt; medication.code;
              } &quot;manufactproduct&quot;;
            } &quot;manufac&quot;;
          };
          sa.entryRelationship as entryRR then {
            entryRR.observation as observation then {
              observation.code where displayName = 'Grammatura' -&gt; medication.ingredient as ingredient then {
                sa.consumable as consumable then {
                  consumable.manufacturedProduct as manufacturedProduct then {
                    manufacturedProduct.manufacturedMaterial as manufacturedMaterial then {
                      manufacturedMaterial.code as code -&gt; ingredient.item = create('CodeableConcept') as value then CECodeableConcept(code, value) &quot;CE&quot;;
                    } &quot;material&quot;;
                  } &quot;product&quot;;
                };
                observation.value as value -&gt; ingredient.strength as strength then {
                  value -&gt; strength.numerator as numerator then {
                    value -&gt; numerator.value = (value.value) &quot;valueN&quot;;
                  } &quot;numerator&quot;;
                  value -&gt; strength.denominator as denominator then {
                    value -&gt; denominator.value = 1 &quot;valueD&quot;;
                  } &quot;denominator&quot;;
                } &quot;strenght&quot;;
              } &quot;ingredient&quot;;
              observation.code where displayName = 'Quantità nella Confezione' then {
                observation.value as value -&gt; medication.amount as amount then {
                  value -&gt; amount.numerator as numerator then {
                    value -&gt; numerator.value = (value.value) &quot;valueN&quot;;
                  } &quot;numerator&quot;;
                  value -&gt; amount.denominator as denominator then {
                    value -&gt; denominator.value = 1 &quot;valueD&quot;;
                  } &quot;denominator&quot;;
                } &quot;amount&quot;;
              } &quot;quantita&quot;;
            } &quot;obs&quot;;
          } &quot;entryRr&quot;;
        } &quot;medication&quot;;
        sa.entryRelationship as entryRelationship then {
          entryRelationship.supply as sup -&gt; medicationRq.dispenseRequest as dispreq then {
            sup -&gt; dispreq.quantity = create('SimpleQuantity') as quantity then {
              sup.quantity as q -&gt; quantity.value = (q.value);
            } &quot;quantity&quot;;
          } &quot;sub&quot;;
        } &quot;entryR&quot;;
        sa.participant as participant then {
          participant.time as t -&gt; medicationRq.authoredOn = (t.value);
          participant.participantRole as participantR -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner then {
            participantR -&gt; practitioner.meta as meta then {
              participantR -&gt; meta.tag = create('Coding') as coding then {
                participantR -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
                participantR -&gt; coding.code = 'ClinicalDocument/body/TerapiaFarmacologicaRicovero/participant' &quot;code&quot;;
              } &quot;coding&quot;;
            } &quot;meta&quot;;
            participantR.id as id -&gt; practitioner.identifier as identifier then {
              id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
              id.extension as ext -&gt; identifier.value = ext;
              id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
              id.root as r then {
                id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e1.fullUrl = append('https://example/Practitioner/', uuid2),  request.url = append('Practitioner/', uuid1),  medicationRq.requester = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
              } &quot;r&quot;;
            } &quot;identifier&quot;;
            participantR.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
              id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
            } &quot;2&quot;;
            participantR.playingEntity as assi then {
              assi.name -&gt; practitioner.name;
            } &quot;assi&quot;;
          } &quot;perf&quot;;
          sa.effectiveTime : EIVL as eff -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
            eff -&gt; dosage.timing = create('Timing') as timing then {
              eff -&gt; timing.repeat as rep then {
                eff.event as ev -&gt; rep.where = (ev.code);
              } &quot;rep&quot;;
            } &quot;timing&quot;;
          } &quot;period&quot;;
          sa.effectiveTime : TS as eff -&gt;  medicationRq.dosageInstruction = create('Dosage') as dosage,  dosage.timing = create('Timing') as timing,  timing.event = (eff.value) &quot;tim&quot;;
          sa.effectiveTime : PIVL_TS as eff -&gt; medicationAdm.dosage = create('BackboneElement') as dosage then {
            eff -&gt; dosage.rate = create('Ratio') as ratio then {
              eff -&gt; ratio.numerator = create('Quantity') as quan then {
                eff.period as per -&gt; quan.value = (per.value);
                eff.period as per -&gt; quan.unit = (per.unit);
              } &quot;quanti&quot;;
              eff -&gt; ratio.denominator = create('Quantity') as quan then {
                eff.period -&gt; quan.value = '1';
                eff.period as per -&gt; quan.unit = (per.unit);
              } &quot;quanti&quot;;
            } &quot;ratio&quot;;
          } &quot;eff&quot;;
        } &quot;Medicationrequest&quot;;
      } &quot;sa&quot;;
    } &quot;entry&quot;;
  } &quot;sa&quot;;
}

group ClinicalDocumentSottoSectionOBS(source src : Section, target tgt, target bundle : Bundle, target enc : Encounter, target patient : Patient) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as observation,  observation.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id),  tgt.text as fhirText then {
    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    src.code -&gt; observation.code;
    src -&gt;  observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    src where observation.statusCode.exists().not() then {
      src -&gt; observation.status = 'final' &quot;status&quot;;
    } &quot;statuscode&quot;;
    cdaText -&gt; observation.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
    } &quot;reference&quot;;
  } &quot;cdaText&quot;;
}

group ClinicalDocumentSottoSectionMS(source src : Section, target tgt, target bundle : Bundle, target patient : Patient, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationStatement') as Medicationstatement,  Medicationstatement.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationStatement/', uuid1),  request.url = 'MedicationStatement',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationStatement/' + %Medicationstatement.id),  tgt.text as fhirText then {
    cdaText -&gt; Medicationstatement.note as note then {
      cdaText as t -&gt; note.text = t &quot;reference&quot;;
      cdaText as t -&gt;  Medicationstatement.medication = create('CodeableConcept') as medication,  medication.text = t &quot;text&quot;;
    } &quot;reference&quot;;
    src -&gt;  Medicationstatement.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt; Medicationstatement.status = 'unknown' &quot;status&quot;;
  } &quot;cdaText&quot;;
}

group Observation(source obs : Observation, target patient : Patient, target encounter : Encounter, target ob : Observation, target bundle : Bundle) {
  obs -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
  obs -&gt;  ob.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
  obs.code -&gt; ob.code;
  obs.statusCode as statusc where (code = 'completed') -&gt; ob.status = 'final';
  obs.statusCode as statusc where (code = 'active') -&gt; ob.status = 'registered';
  obs.statusCode as statusc where (code = 'aborted') -&gt; ob.status = 'cancelled';
  obs.statusCode as statusc where (code = 'suspended') -&gt; ob.status = 'partial';
  obs where obs.statusCode.exists().not() then {
    obs -&gt; ob.status = 'final' &quot;status&quot;;
  } &quot;statuscode&quot;;
  obs.effectiveTime as effectiveTime -&gt; ob.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value2&quot;;
  obs where effectiveTime.low.exists() or effectiveTime.high.exists() then {
    obs.effectiveTime as eff -&gt; ob.effective = create('Period') as period then IVLTSPeriod(eff, period) &quot;value3&quot;;
  } &quot;where&quot;;
  obs.value : INT as int -&gt; ob.value = (int.value);
  obs.value : BL as boolean -&gt; ob.value = (boolean.value) &quot;boolean&quot;;
  obs.value : CD as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText -&gt; ce.text;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : CE as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText -&gt; ce.text;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : PQ as val then {
    val -&gt; ob.value = create('Quantity') as quantity then {
      val.value as value -&gt; quantity.value = value;
      val.unit as unit -&gt; quantity.unit = unit;
    } &quot;quantity&quot;;
  } &quot;valueQuantity&quot;;
  obs.value : ST as value -&gt;  ob.value = create('string'),  ob.value = (value.dataString);
  obs.interpretationCode -&gt; ob.interpretation;
  obs.methodCode -&gt; ob.method;
  obs.referenceRange as refRange -&gt; ob.referenceRange = create('BackboneElement') as ref then {
    refRange.observationRange as obsRange -&gt; ref.low = create('SimpleQuantity') as Low then {
      obsRange.value : IVL_PQ as v then {
        v.low as l1 then {
          l1.value as decValue -&gt; Low.value = decValue;
          l1.unit as Unit -&gt; Low.unit = Unit;
        } &quot;decValue&quot;;
      } &quot;IVLPQ&quot;;
    } &quot;obsRange&quot;;
  } &quot;refRange&quot;;
}

group ObservationConsulenza(source obs : Observation, target patient : Patient, target encounter : Encounter, target ob : Observation, target bundle : Bundle) {
  obs -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
  obs -&gt;  ob.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
  obs.code -&gt; ob.code;
  obs.statusCode as statusc where (code = 'completed') -&gt; ob.status = 'final';
  obs.statusCode as statusc where (code = 'active') -&gt; ob.status = 'registered';
  obs.statusCode as statusc where (code = 'aborted') -&gt; ob.status = 'cancelled';
  obs.statusCode as statusc where (code = 'suspended') -&gt; ob.status = 'partial';
  obs where obs.statusCode.exists().not() then {
    obs -&gt; ob.status = 'final' &quot;status&quot;;
  } &quot;statuscode&quot;;
  obs.effectiveTime as effectiveTime -&gt; ob.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value2c&quot;;
  obs where effectiveTime.low.exists() or effectiveTime.high.exists() then {
    obs.effectiveTime as eff -&gt; ob.effective = create('Period') as period then IVLTSPeriod(eff, period) &quot;value3c&quot;;
  } &quot;where&quot;;
  obs.value : INT as int -&gt; ob.value = (int.value);
  obs.value : BL as boolean -&gt; ob.value = (boolean.value) &quot;boolean&quot;;
  obs.value : CE as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText as originalText then {
        originalText.reference as reference -&gt; ce.text = reference;
      } &quot;originltext&quot;;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
        val.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
            value.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : CD as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText -&gt; ce.text;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : PQ as val then {
    val -&gt; ob.value = create('Quantity') as quantity then {
      val.value as value -&gt; quantity.value = value;
      val.unit as unit -&gt; quantity.unit = unit;
    } &quot;quantity&quot;;
  } &quot;valueQuantity&quot;;
  obs.value : ST as value -&gt;  ob.value = create('string'),  ob.value = (value.dataString);
  obs -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
  obs -&gt;  ob.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
  obs.interpretationCode -&gt; ob.interpretation;
  obs.methodCode -&gt; ob.method;
  obs.referenceRange as refRange -&gt; ob.referenceRange = create('BackboneElement') as ref then {
    refRange.observationRange as obsRange -&gt; ref.low = create('SimpleQuantity') as Low then {
      obsRange.value : IVL_PQ as v then {
        v.low as l1 then {
          l1.value as decValue -&gt; Low.value = decValue;
          l1.unit as Unit -&gt; Low.unit = Unit;
        } &quot;decValue&quot;;
      } &quot;IVLPQ&quot;;
    } &quot;obsRange&quot;;
  } &quot;refRange&quot;;
  obs.performer as performer -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner,  practitioner.id = uuid() as uuid1 then {
    performer.assignedEntity as assEntity then {
      assEntity -&gt; practitioner.meta as meta then {
        assEntity -&gt; meta.tag = create('Coding') as coding then {
          assEntity -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
          assEntity -&gt; coding.code = 'ClinicalDocument/body/Consulenza/performer' &quot;code&quot;;
        } &quot;coding&quot;;
      } &quot;meta&quot;;
      assEntity.id as id -&gt; practitioner.identifier as identifier then {
        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
        id.extension as ext -&gt; identifier.value = ext;
        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        id.root as r then {
          id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e1.fullUrl = append('https://example/Practitioner/', uuid2),  ob.performer = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
        } &quot;r&quot;;
      } &quot;identifier&quot;;
      assEntity.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
      } &quot;2&quot;;
      assEntity.assignedPerson as assi then {
        assi.name -&gt; practitioner.name;
      } &quot;assi&quot;;
    } &quot;assEntity&quot;;
  } &quot;perf&quot;;
  obs.participant as participant -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('ServiceRequest') as serviceRequest,  serviceRequest.id = uuid() as uuid1,  e1.fullUrl = append('https://example/ServiceRequest/', uuid1),  request.url = 'ServiceRequest',  ob.basedOn = create('Reference') as reference,  reference.reference = ('https://example/ServiceRequest/' + %serviceRequest.id) then {
    participant.time as t -&gt; serviceRequest.authoredOn = (t.value);
    obs -&gt;  serviceRequest.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    obs -&gt;  serviceRequest.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
    obs -&gt; serviceRequest.status = 'active' &quot;status&quot;;
    obs -&gt; serviceRequest.intent = 'order' &quot;intent&quot;;
    participant.participantRole as participantRole -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner then {
      participantRole -&gt; practitioner.meta as meta then {
        participantRole -&gt; meta.tag = create('Coding') as coding then {
          participantRole -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
          participantRole -&gt; coding.code = 'ClinicalDocument/body/Consulenza/participant' &quot;code&quot;;
        } &quot;coding&quot;;
      } &quot;meta&quot;;
      participantRole.id as id -&gt; practitioner.identifier as identifier then {
        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
        id.extension as ext -&gt; identifier.value = ext;
        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        id.root as r then {
          id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid3,  e1.fullUrl = append('https://example/Practitioner/', uuid3),  serviceRequest.performer = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
        } &quot;r&quot;;
      } &quot;identifier&quot;;
      participantRole.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
      } &quot;2&quot;;
      participantRole.playingEntity as pe then {
        pe.name -&gt; practitioner.name;
      } &quot;pe&quot;;
    };
  };
}

group ObservationEsamiDuranteRicovero(source obs : Observation, target patient : Patient, target encounter : Encounter, target ob : Observation, target bundle : Bundle) {
  obs -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
  obs -&gt;  ob.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
  obs.code -&gt; ob.code;
  obs.statusCode as statusc where (code = 'completed') -&gt; ob.status = 'final';
  obs.statusCode as statusc where (code = 'active') -&gt; ob.status = 'registered';
  obs.statusCode as statusc where (code = 'aborted') -&gt; ob.status = 'cancelled';
  obs.statusCode as statusc where (code = 'suspended') -&gt; ob.status = 'partial';
  obs where obs.statusCode.exists().not() then {
    obs -&gt; ob.status = 'final' &quot;status&quot;;
  } &quot;statuscode&quot;;
  obs.effectiveTime as effectiveTime -&gt; ob.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value2r&quot;;
  obs where effectiveTime.low.exists() or effectiveTime.high.exists() then {
    obs.effectiveTime as eff -&gt; ob.effective = create('Period') as period then IVLTSPeriod(eff, period) &quot;value3r&quot;;
  } &quot;where&quot;;
  obs.value : INT as int -&gt; ob.value = (int.value);
  obs.value : BL as boolean -&gt; ob.value = (boolean.value) &quot;boolean&quot;;
  obs.value : CE as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText as originalText then {
        originalText.reference as reference -&gt; ce.text = reference;
      } &quot;originltext&quot;;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
        val.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
            value.codeSystemVersion as version -&gt; coding.version = cast(version, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : CD as val then {
    val -&gt; ob.value = create('CodeableConcept') as ce then {
      val.originalText -&gt; ce.text;
      val -&gt; ce.coding as coding then {
        val.code as code -&gt; coding.code = cast(code, 'string');
        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        val.displayName as display -&gt; coding.display = cast(display, 'string');
      } &quot;code&quot;;
      val.translation as translation -&gt; ce.coding as coding then {
        translation.code as code -&gt; coding.code = cast(code, 'string');
        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
        translation.displayName as display -&gt; coding.display = cast(display, 'string');
        translation.qualifier as qualifier then {
          qualifier.value as value -&gt; ce.coding as coding then {
            value.code as code -&gt; coding.code = cast(code, 'string');
            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');
            value.displayName as display -&gt; coding.display = cast(display, 'string');
          };
        };
      };
    } &quot;coding&quot;;
  } &quot;val&quot;;
  obs.value : PQ as val then {
    val -&gt; ob.value = create('Quantity') as quantity then {
      val.value as value -&gt; quantity.value = value;
      val.unit as unit -&gt; quantity.unit = unit;
    } &quot;quantity&quot;;
  } &quot;valueQuantity&quot;;
  obs.value : ST as value -&gt;  ob.value = create('string'),  ob.value = (value.dataString);
  obs -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
  obs -&gt;  ob.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
  obs.interpretationCode -&gt; ob.interpretation;
  obs.methodCode -&gt; ob.method;
  obs.effectiveTime as eff -&gt; ob.effective = create('Period') as per then IVLTSPeriod(eff, per);
  obs.referenceRange as refRange -&gt; ob.referenceRange = create('BackboneElement') as ref then {
    refRange.observationRange as obsRange -&gt; ref.low = create('SimpleQuantity') as Low then {
      obsRange.value : IVL_PQ as v then {
        v.low as l1 then {
          l1.value as decValue -&gt; Low.value = decValue;
          l1.unit as Unit -&gt; Low.unit = Unit;
        } &quot;decValue&quot;;
      } &quot;IVLPQ&quot;;
    } &quot;obsRange&quot;;
  } &quot;refRange&quot;;
  obs.performer as performer -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner,  practitioner.id = uuid() as uuid1 then {
    performer.assignedEntity as assEntity then {
      assEntity -&gt; practitioner.meta as meta then {
        assEntity -&gt; meta.tag = create('Coding') as coding then {
          assEntity -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
          assEntity -&gt; coding.code = 'ClinicalDocument/body/EsamiDuranteRicovero/performer' &quot;code&quot;;
        } &quot;coding&quot;;
      } &quot;meta&quot;;
      assEntity.id as id -&gt; practitioner.identifier as identifier then {
        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
        id.extension as ext -&gt; identifier.value = ext;
        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        id.root as r then {
          id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e1.fullUrl = append('https://example/Practitioner/', uuid2),  ob.performer = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
        } &quot;r&quot;;
      } &quot;identifier&quot;;
      assEntity.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
      } &quot;2&quot;;
      assEntity.assignedPerson as assi then {
        assi.name -&gt; practitioner.name;
      } &quot;assi&quot;;
    } &quot;assEntity&quot;;
  } &quot;perf&quot;;
  obs.participant as participant -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('ServiceRequest') as serviceRequest,  serviceRequest.id = uuid() as uuid1,  e1.fullUrl = append('https://example/ServiceRequest/', uuid1),  request.url = 'ServiceRequest',  ob.basedOn = create('Reference') as reference,  reference.reference = ('https://example/ServiceRequest/' + %serviceRequest.id) then {
    participant.time as t -&gt; serviceRequest.authoredOn = (t.value);
    obs -&gt;  serviceRequest.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    obs -&gt;  serviceRequest.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;
    obs -&gt; serviceRequest.status = 'active' &quot;status&quot;;
    obs -&gt; serviceRequest.intent = 'order' &quot;intent&quot;;
    participant.participantRole as participantRole -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner then {
      participantRole -&gt; practitioner.meta as meta then {
        participantRole -&gt; meta.tag = create('Coding') as coding then {
          participantRole -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
          participantRole -&gt; coding.code = 'ClinicalDocument/body/EsamiDuranteRicovero/participant' &quot;code&quot;;
        } &quot;coding&quot;;
      } &quot;meta&quot;;
      participantRole.id as id -&gt; practitioner.identifier as identifier then {
        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
        id.extension as ext -&gt; identifier.value = ext;
        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        id.root as r then {
          id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid3,  e1.fullUrl = append('https://example/Practitioner/', uuid3),  serviceRequest.performer = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
        } &quot;r&quot;;
      } &quot;identifier&quot;;
      participantRole.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
      } &quot;2&quot;;
      participantRole.playingEntity as pe then {
        pe.name -&gt; practitioner.name;
      } &quot;pe&quot;;
    };
  };
}

group periodTiming(source effectiveTime : PIVL_TS, target timing : Timing) {
  effectiveTime -&gt; timing.repeat as r then {
    effectiveTime.period as p -&gt; r.period = (p.value);
    effectiveTime.period as p -&gt; r.periodUnit = (p.unit);
  } &quot;repeat&quot;;
}

// ---------------------------------------------------------------------------------------
group Act(source cda : Act, target pat : Patient, target ac : DiagnosticReport, target enc : Encounter, target bundle : Bundle) {
  cda.code -&gt; ac.code;
  cda.statusCode as statusc where (code = 'completed') -&gt; ob.status = 'final';
  cda.statusCode as statusc where (code = 'active') -&gt; ob.status = 'registered';
  cda.statusCode as statusc where (code = 'aborted') -&gt; ob.status = 'cancelled';
  cda.statusCode as statusc where (code = 'suspended') -&gt; ob.status = 'partial';
  cda.effectiveTime as effectiveTime -&gt; ac.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value2a&quot;;
  obs where effectiveTime.low.exists() or effectiveTime.high.exists() then {
    cda.effectiveTime as eff -&gt; ac.effective = create('Period') as period then IVLTSPeriod(eff, period) &quot;value3a&quot;;
  } &quot;where&quot;;
  cda -&gt;  ac.subject = create('Reference') as reference,  reference.reference = ('https://example/' + %pat.id) &quot;reference&quot;;
  cda -&gt;  ac.encounter = create('Reference') as reference,  reference.reference = ('https://example/' + %enc.id) &quot;reference&quot;;
  cda.participant as part -&gt; enc.participant as participant then {
    part -&gt; participant.type as type then {
      part -&gt; type.coding as coding then {
        part -&gt; coding.code = (part.typeCode) &quot;codice&quot;;
        part -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/v3-ParticipationType' &quot;system&quot;;
      } &quot;codeType&quot;;
    } &quot;type&quot;;
    part.participantRole as participantRole -&gt; participant.individual = create('Reference') as reference then {
      participantRole -&gt;  bundle.entry as e,  e.request = create('BackboneElement') as request,  request.method = 'PUT',  e.resource = create('Practitioner') as practitioner,  practitioner.id = uuid() as uuid1,  e.fullUrl = append('https://example/Practitioner/', uuid1),  reference.reference = ('https://example/Practitioner/' + %practitioner.id) then {
        participantRole -&gt; practitioner.meta as meta then {
          participantRole -&gt; meta.tag = create('Coding') as coding then {
            participantRole -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
            participantRole -&gt; coding.code = 'ClinicalDocument/body/Act/participant' &quot;code&quot;;
          } &quot;coding&quot;;
        } &quot;meta&quot;;
        participantRole.id as id -&gt; practitioner.identifier as identifier then {
          id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
          id.extension as ext -&gt; identifier.value = ext then {
            participantRole -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
          } &quot;ext&quot;;
          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
        } &quot;identifier&quot;;
        participantRole.playingEntity as playingEntity then {
          playingEntity.name -&gt; practitioner.name;
        };
      } &quot;participanRoleBund&quot;;
    };
  };
  cda.entryRelationship as entryRelationship then {
    entryRelationship.observation as observation -&gt;  bundle.entry as e,  e.request = create('BackboneElement') as request,  request.method = 'POST',  e.resource = create('Observation') as obs,  obs.id = uuid() as uuid2,  e.fullUrl = append('https://example/Observation/', uuid2),  request.url = append('Observation/', uuid2),  ac.result = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs.id) then Observation(observation, pat, enc, obs, bundle) &quot;OBS&quot;;
  };
}

group ClinicalDocumentSectionTerapiaDimissione(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {
  src.title as t -&gt; tgt.title = (t.dataString);
  src.code -&gt; tgt.code;
  src where src.entry.exists() then {
    src.text as cdaText -&gt; tgt.text as fhirText then {
      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;
      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;
    } &quot;cdaText&quot;;
  } &quot;exist&quot;;
  src where src.entry.exists().not() then {
    src.text as cdaText -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationRequest') as medicationRq,  medicationRq.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationRequest/', uuid1),  request.url = 'MedicationRequest',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medicationRq.id) then {
      src -&gt;  medicationRq.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
      src -&gt;  medicationRq.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
      src -&gt; medicationRq.status = 'active' &quot;status&quot;;
      src -&gt; medicationRq.intent = 'order' &quot;intent&quot;;
      cdaText -&gt; medicationRq.medication = create('CodeableConcept') as codecon then {
        cdaText -&gt; codecon.text = 'string' &quot;text&quot;;
      } &quot;code&quot;;
      cdaText -&gt; medicationRq.note as note then {
        cdaText as t -&gt; note.text = t &quot;reference&quot;;
      } &quot;reference&quot;;
    } &quot;cdaText&quot;;
  } &quot;where&quot;;
  src.entry as entry1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('MedicationRequest') as medicationRq,  medicationRq.id = uuid() as uuid1,  e1.fullUrl = append('https://example/MedicationRequest/', uuid1),  request.url = 'MedicationRequest',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medicationRq.id) then {
    src -&gt;  medicationRq.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;
    src -&gt;  medicationRq.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;
    src -&gt; medicationRq.status = 'active' &quot;status&quot;;
    src -&gt; medicationRq.intent = 'order' &quot;intent&quot;;
    entry1.substanceAdministration as substract then {
      substract.consumable as cons then {
        cons.manufacturedProduct as man1 -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Medication') as medication,  medication.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Medication/', uuid1),  request.url = 'Medication',  medicationRq.medication = create('Reference') as medref,  medref.reference = ('https://example/Medication/' + %medication.id) then {
          man1.manufacturedMaterial as mm then {
            mm.code -&gt; medication.code;
          } &quot;mm&quot;;
          substract.administrationUnitCode -&gt; medication.form;
          substract.entryRelationship as entryR then {
            entryR.observation as observation then {
              observation.code where displayName = 'Grammatura' -&gt; medication.ingredient as ingredient then {
                substract.consumable as consumable then {
                  consumable.manufacturedProduct as manufacturedProduct then {
                    manufacturedProduct.manufacturedMaterial as manufacturedMaterial then {
                      manufacturedMaterial.code as code -&gt; ingredient.item = create('CodeableConcept') as value then CECodeableConcept(code, value) &quot;CE&quot;;
                    } &quot;material&quot;;
                  } &quot;product&quot;;
                };
                observation.value as value -&gt; ingredient.strength as strength then {
                  value -&gt; strength.numerator as numerator then {
                    value -&gt; numerator.value = (value.value) &quot;valueN&quot;;
                  } &quot;numerator&quot;;
                  value -&gt; strength.denominator as denominator then {
                    value -&gt; denominator.value = 1 &quot;valueD&quot;;
                  } &quot;denominator&quot;;
                } &quot;strenght&quot;;
              } &quot;ingredient&quot;;
              observation.code where displayName = 'Quantità nella Confezione' then {
                observation.value as value -&gt; medication.amount as amount then {
                  value -&gt; amount.numerator as numerator then {
                    value -&gt; numerator.value = (value.value) &quot;valueN&quot;;
                  } &quot;numerator&quot;;
                  value -&gt; amount.denominator as denominator then {
                    value -&gt; denominator.value = 1 &quot;valueD&quot;;
                  } &quot;denominator&quot;;
                } &quot;amount&quot;;
              } &quot;quantita&quot;;
            } &quot;obs&quot;;
          } &quot;entryR&quot;;
          substract.entryRelationship as entryRelationship then {
            entryRelationship.supply as sup -&gt; medicationRq.dispenseRequest as dispreq then {
              sup -&gt; dispreq.quantity = create('SimpleQuantity') as quantity then {
                sup.quantity as q -&gt; quantity.value = (q.value);
              } &quot;quantity&quot;;
            } &quot;sub&quot;;
          } &quot;entry&quot;;
        } &quot;man1&quot;;
      } &quot;cons&quot;;
      substract.text as tx -&gt; medicationRq.note as note then {
        tx.reference as ref -&gt; note.text = (ref.value);
      } &quot;tx&quot;;
      substract.statusCode as st -&gt; medicationRq.status = (st.code);
      substract.effectiveTime : IVL_TS as eff -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
        eff -&gt; dosage.timing = create('Timing') as timing then {
          eff -&gt; timing.repeat as rep then {
            eff -&gt; rep.bounds = create('Period') as period then IVLTSPeriod(eff, period) &quot;period&quot;;
          } &quot;rep&quot;;
        } &quot;timing&quot;;
      } &quot;period&quot;;
      substract.effectiveTime : EIVL_TS as eff -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
        eff -&gt; dosage.timing = create('Timing') as timing then {
          eff -&gt; timing.repeat as rep then {
            eff.event as ev -&gt; rep.when = (ev.code);
          } &quot;rep&quot;;
        } &quot;timing&quot;;
      } &quot;period&quot;;
      substract.effectiveTime : IVL_TS as eff -&gt;  medicationRq.dosageInstruction = create('Dosage') as dosage,  dosage.timing = create('Timing') as timing,  timing.event = (eff.value) &quot;tim&quot;;
      substract.effectiveTime : PIVL_TS as eff -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
        eff -&gt; dosage.timing = create('Timing') as timing then periodTiming(eff, timing) &quot;cod&quot;;
      } &quot;eff&quot;;
      substract -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
        substract.routeCode -&gt; dosage.route;
      } &quot;dosage&quot;;
      substract -&gt; medicationRq.dosageInstruction = create('Dosage') as dosage then {
        substract.approachSiteCode -&gt; dosage.site;
      } &quot;dosage&quot;;
      substract.doseQuantity as doseQuant -&gt; medicationRq.dosageInstruction = create('Dosage') as dosageInstruction then {
        doseQuant.originalText as ot then {
          ot.reference -&gt; dosageInstruction.text;
        } &quot;ot&quot;;
        doseQuant -&gt; dosageInstruction.doseAndRate as dosageRate then {
          doseQuant -&gt; dosageRate.dose = create('Range') as d then {
            doseQuant -&gt; d.low = create('SimpleQuantity') as l then {
              doseQuant.low as lo -&gt; l.value = (lo.value);
              doseQuant.low as lo -&gt; l.unit = (lo.unit);
            } &quot;low&quot;;
            doseQuant -&gt; d.high = create('SimpleQuantity') as h then {
              doseQuant.high as hi -&gt; h.value = (hi.value);
              doseQuant.high as hi -&gt; h.unit = (hi.unit);
            } &quot;low&quot;;
          } &quot;d&quot;;
        } &quot;dosageRate&quot;;
      } &quot;Dosage&quot;;
      substract.rateQuantity as rateQuantity -&gt; medicationRq.dosageInstruction = create('Dosage') as dosageInstruction1 then {
        rateQuantity.originalText as ot then {
          ot.reference -&gt; dosageInstruction1.text;
        } &quot;ot&quot;;
        rateQuantity -&gt; dosageInstruction1.doseAndRate as dosageRate then {
          rateQuantity -&gt; dosageRate.rate = create('Range') as d then {
            rateQuantity -&gt; d.low = create('SimpleQuantity') as l then {
              rateQuantity.low as lo -&gt; l.value = (lo.value);
              rateQuantity.low as lo -&gt; l.unit = (lo.unit);
            } &quot;low&quot;;
            rateQuantity -&gt; d.high = create('SimpleQuantity') as h then {
              rateQuantity.high as hi -&gt; h.value = (hi.value);
              rateQuantity.high as hi -&gt; h.unit = (hi.unit);
            } &quot;low&quot;;
          } &quot;d&quot;;
        } &quot;dosageRate&quot;;
      } &quot;rateq&quot;;
      substract.participant as part -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Practitioner') as practitioner then {
        part.time as time -&gt; medicationRq.authoredOn = (time.value);
        part.participantRole as partRole then {
          partRole -&gt; practitioner.meta as meta then {
            partRole -&gt; meta.tag = create('Coding') as coding then {
              partRole -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;
              partRole -&gt; coding.code = 'ClinicalDocument/body/TerapiaFarmacologicaRicovero/participant' &quot;code&quot;;
            } &quot;coding&quot;;
          } &quot;meta&quot;;
          partRole.id as id -&gt; practitioner.identifier as identifier then {
            id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;
            id.extension as ext -&gt; identifier.value = ext;
            id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;
            id.root as r then {
              id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e1.fullUrl = append('https://example/Practitioner/', uuid2),  request.url = append('Practitioner/', uuid1),  medicationRq.performer = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;aut&quot;;
            } &quot;r&quot;;
          } &quot;identifier&quot;;
          partRole.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {
            id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;
          } &quot;2&quot;;
          partRole.playingEntity as assi then {
            assi.name -&gt; practitioner.name;
          } &quot;assi&quot;;
        } &quot;perf&quot;;
      } &quot;partRole&quot;;
    } &quot;participant&quot;;
  } &quot;substract&quot;;
}

</pre>
      </div>
  </text>
  <url value="http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirLdo"/>
  <version value="0.1.0"/>
  <name value="cda2fhirLdo"/>
  <status value="draft"/>
  <date value="2024-04-11T15:38:19+02:00"/>
  <publisher value="HL7 Italy"/>
  <contact>
    <name value="HL7 Italy"/>
    <telecom>
      <system value="url"/>
      <value value="http://hl7.it"/>
    </telecom>
  </contact>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="IT"/>
      <display value="Italy"/>
    </coding>
  </jurisdiction>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument"/>
    <mode value="source"/>
    <alias value="ClinicalDocument"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor"/>
    <mode value="queried"/>
    <alias value="AssignedAuthor"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity"/>
    <mode value="queried"/>
    <alias value="AssignedEntity"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity"/>
    <mode value="queried"/>
    <alias value="AssociatedEntity"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization"/>
    <mode value="queried"/>
    <alias value="CustodianOrganization"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf"/>
    <mode value="queried"/>
    <alias value="OrganizationPartOf"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Organization"/>
    <mode value="queried"/>
    <alias value="rapresentedOrganization"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Section"/>
    <mode value="queried"/>
    <alias value="Section"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/PatientRole"/>
    <mode value="queried"/>
    <alias value="PatientRole"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/AD"/>
    <mode value="source"/>
    <alias value="AD"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <mode value="target"/>
    <alias value="Bundle"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Composition"/>
    <mode value="produced"/>
    <alias value="Composition"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="produced"/>
    <alias value="Patient"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
    <mode value="produced"/>
    <alias value="Encounter"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Person"/>
    <mode value="produced"/>
    <alias value="Patient"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
    <mode value="produced"/>
    <alias value="Practitioner"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Organization"/>
    <mode value="produced"/>
    <alias value="Organization"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Act"/>
    <mode value="produced"/>
    <alias value="Act"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ"/>
    <mode value="source"/>
    <alias value="IVL_PQ"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/PQ"/>
    <mode value="source"/>
    <alias value="PQ"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/SimpleQuantity"/>
    <mode value="target"/>
    <alias value="SimpleQuantity"/>
  </structure>
  <import value="http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes"/>
  <import value="http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader"/>
  <group>
    <name value="CdaToBundle"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="ClinicalDocumentToBody"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="composition"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Composition"/>
        </parameter>
      </target>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Composition/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Composition"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e2"/>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="requestPAT"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="requestPAT"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="PUT"/>
        </parameter>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="patient"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Patient"/>
        </parameter>
      </target>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid2"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Patient/"/>
        </parameter>
        <parameter>
          <valueId value="uuid2"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e3"/>
      </target>
      <target>
        <context value="e3"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e3"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="encounter"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Encounter"/>
        </parameter>
      </target>
      <target>
        <context value="encounter"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid3"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e3"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Encounter/"/>
        </parameter>
        <parameter>
          <valueId value="uuid3"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Encounter"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e5"/>
      </target>
      <target>
        <context value="e5"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e5"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="DocumentReference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="DocumentReference"/>
        </parameter>
      </target>
      <target>
        <context value="DocumentReference"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid5"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e5"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/DocumentReference/"/>
        </parameter>
        <parameter>
          <valueId value="uuid5"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="DocumentReference"/>
        </parameter>
      </target>
      <rule>
        <name value="cdatobundle"/>
        <source>
          <context value="cda"/>
        </source>
        <dependent>
          <name value="ClinicalDocumentToBundle"/>
          <variable value="cda"/>
          <variable value="patient"/>
          <variable value="composition"/>
          <variable value="encounter"/>
          <variable value="bundle"/>
          <variable value="DocumentReference"/>
        </dependent>
      </rule>
      <rule>
        <name value="patient"/>
        <source>
          <context value="cda"/>
          <element value="recordTarget"/>
          <variable value="recordTarget"/>
        </source>
        <rule>
          <name value="recPat"/>
          <source>
            <context value="recordTarget"/>
            <element value="patientRole"/>
            <variable value="patient"/>
          </source>
          <rule>
            <name value="record"/>
            <source>
              <context value="patient"/>
              <element value="id"/>
              <variable value="id"/>
            </source>
            <target>
              <context value="patient"/>
              <contextType value="variable"/>
              <element value="identifier"/>
              <variable value="identifier"/>
            </target>
            <rule>
              <name value="root1"/>
              <source>
                <context value="id"/>
                <element value="root"/>
                <variable value="r"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="translate"/>
                <parameter>
                  <valueId value="r"/>
                </parameter>
                <parameter>
                  <valueString
                               value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                </parameter>
                <parameter>
                  <valueString value="uri"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="extension"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="ext"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="assigningAuthorityName"/>
              <source>
                <context value="id"/>
                <element value="assigningAuthorityName"/>
                <variable value="s"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="assigner"/>
                <variable value="a"/>
              </target>
              <target>
                <context value="a"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="s"/>
                </parameter>
              </target>
            </rule>
          </rule>
          <rule>
            <name value="ext"/>
            <source>
              <context value="patient"/>
              <element value="id"/>
              <variable value="id"/>
              <condition
                         value="(root = '2.16.840.1.113883.2.9.4.3.2') or (root = '2.16.840.1.113883.2.9.4.3.7') or (root = '2.16.840.1.113883.2.9.4.3.3') or (root = '2.16.840.1.113883.2.9.4.3.17') or (root = '2.16.840.1.113883.2.9.4.3.18') or (root = '2.16.840.1.113883.2.9.2.10.4.1.1') or (root = '2.16.840.1.113883.2.9.2.20.4.1.1') or (root = '2.16.840.1.113883.2.9.2.30.4.1.1') or (root = '2.16.840.1.113883.2.9.2.41.4.1.1') or (root = '2.16.840.1.113883.2.9.2.42.4.1.1') or (root = '2.16.840.1.113883.2.9.2.50.4.1.1') or (root = '2.16.840.1.113883.2.9.2.60.4.1.1') or (root = '2.16.840.1.113883.2.9.2.70.4.1.1') or (root = '2.16.840.1.113883.2.9.2.80.4.1.1') or (root = '2.16.840.1.113883.2.9.2.90.4.1.1') or (root = '2.16.840.1.113883.2.9.2.100.4.1.1') or (root = '2.16.840.1.113883.2.9.2.110.4.1.1') or (root = '2.16.840.1.113883.2.9.2.120.4.1.1') or (root = '2.16.840.1.113883.2.9.2.130.4.1.1') or (root = '2.16.840.1.113883.2.9.2.140.4.1.1') or (root = '2.16.840.1.113883.2.9.2.150.4.1.1') or (root = '2.16.840.1.113883.2.9.2.160.4.1.1') or (root = '2.16.840.1.113883.2.9.2.170.4.1.1') or (root = '2.16.840.1.113883.2.9.2.180.4.1.1') or (root = '2.16.840.1.113883.2.9.2.190.4.1.1') or (root = '2.16.840.1.113883.2.9.2.200.4.1.1') or (root = '2.16.840.1.113883.2.9.2.10.4.1') or (root = '2.16.840.1.113883.2.9.2.20.4.1') or (root = '2.16.840.1.113883.2.9.2.30.4.1') or (root = '2.16.840.1.113883.2.9.2.41.4.1') or (root = '2.16.840.1.113883.2.9.2.42.4.1') or (root = '2.16.840.1.113883.2.9.2.50.4.1') or (root = '2.16.840.1.113883.2.9.2.60.4.1') or (root = '2.16.840.1.113883.2.9.2.70.4.1') or (root = '2.16.840.1.113883.2.9.2.80.4.1') or (root = '2.16.840.1.113883.2.9.2.90.4.1') or (root = '2.16.840.1.113883.2.9.2.100.4.1') or (root = '2.16.840.1.113883.2.9.2.110.4.1') or (root = '2.16.840.1.113883.2.9.2.120.4.1') or (root = '2.16.840.1.113883.2.9.2.130.4.1') or (root = '2.16.840.1.113883.2.9.2.140.4.1') or (root = '2.16.840.1.113883.2.9.2.150.4.1') or (root = '2.16.840.1.113883.2.9.2.160.4.1') or (root = '2.16.840.1.113883.2.9.2.170.4.1') or (root = '2.16.840.1.113883.2.9.2.180.4.1') or (root = '2.16.840.1.113883.2.9.2.190.4.1') or (root = '2.16.840.1.113883.2.9.2.200.4.1') or (root = '2.16.840.1.113883.2.9.4.3.15')"/>
            </source>
            <rule>
              <name value="UUID"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="requestPAT"/>
                <contextType value="variable"/>
                <element value="url"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="Patient?identifier="/>
                </parameter>
                <parameter>
                  <valueId value="ext"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentToBundle"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="Composition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="encounter"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="DocumentReference"/>
      <type value="DocumentReference"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="id"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="uuid"/>
      </target>
    </rule>
    <rule>
      <name value="identifier"/>
      <source>
        <context value="cda"/>
        <element value="id"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="identifier"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="type"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="type"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="transaction"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="date"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="timestamp"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="timestamp.now()"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="composition"/>
      <source>
        <context value="cda"/>
      </source>
      <dependent>
        <name value="ClinicalDocumentComposition"/>
        <variable value="cda"/>
        <variable value="composition"/>
        <variable value="patient"/>
        <variable value="encounter"/>
        <variable value="bundle"/>
        <variable value="DocumentReference"/>
      </dependent>
    </rule>
    <rule>
      <name value="component"/>
      <source>
        <context value="cda"/>
        <element value="component"/>
        <variable value="component"/>
      </source>
      <rule>
        <name value="body"/>
        <source>
          <context value="component"/>
          <element value="structuredBody"/>
          <variable value="body"/>
        </source>
        <rule>
          <name value="component"/>
          <source>
            <context value="body"/>
            <element value="component"/>
            <variable value="component"/>
          </source>
          <rule>
            <name value="section"/>
            <source>
              <context value="component"/>
              <element value="section"/>
              <variable value="srcSection"/>
            </source>
            <rule>
              <name value="motivoRicovero"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '46241-6')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionMotivoRicovero"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="inquadramentoClinico"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '47039-3')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionInquadramentoClinico"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="DecorsoOspedaliero"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '8648-8')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionDecorsoOspedaliero"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="Complicazioni"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '55109-3')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionComplicanze"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="HospitalDischargeStudiesSummary"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '11493-4')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionRiscontri"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="HospitalDischargeStudiesSummary"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '34104-0')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionConsulenza"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="EsamiEseguitiDuranteilRicovero"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '30954-2')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionEsamiEseguitiRicovero"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="HistoryOfProceduresDocument"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '47519-4')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name
                      value="ClinicalDocumentSectionProcedureEseguiteRicovero"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="EsamiEseguitiDuranteIlRicovero"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '48765-2')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionAllergie"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="TerapiaFarmacologicaAllaDimissione"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '10160-0')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name
                      value="ClinicalDocumentSectionTerapiaFarmacologicaDuranteRicovero"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="DiagnosiDiDimissione"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '11535-2')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionDiagnosiDimissione"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="DiagnosiDiDimissione"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '18776-5')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionIstruzioniFollowUp"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <rule>
              <name value="TerapiaFarmacologicaAllaDimissione"/>
              <source>
                <context value="srcSection"/>
                <element value="code"/>
                <condition value="(code = '10183-2')"/>
              </source>
              <target>
                <context value="composition"/>
                <contextType value="variable"/>
                <element value="section"/>
                <variable value="tgtSection"/>
              </target>
              <dependent>
                <name value="ClinicalDocumentSectionTerapiaDimissione"/>
                <variable value="cda"/>
                <variable value="srcSection"/>
                <variable value="patient"/>
                <variable value="tgtSection"/>
                <variable value="bundle"/>
                <variable value="encounter"/>
              </dependent>
            </rule>
            <documentation value="discretizzi il primo livello di component"/>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionMotivoRicovero"/>
    <typeMode value="none"/>
    <documentation
                   value="-------------------------------------------------------------------------------------------------------------------"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cText"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="observation"/>
          <variable value="obs"/>
        </source>
        <dependent>
          <name value="Observation"/>
          <variable value="obs"/>
          <variable value="patient"/>
          <variable value="enc"/>
          <variable value="observation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e8"/>
        </target>
        <target>
          <context value="e8"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e8"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="Observation"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="Observation"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid8"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e8"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid8"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Observation/' + %Observation.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="Observation"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="Observation"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="Observation"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="observation.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="Observation"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="final"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="Observation"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionInquadramentoClinico"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeStatus"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="generated"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeText"/>
        <source>
          <context value="cdaText"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="div"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="t"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="code"/>
        <source>
          <context value="src"/>
          <element value="code"/>
          <variable value="vvv"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="code"/>
          <variable value="vvv"/>
          <transform value="create"/>
        </target>
      </rule>
      <rule>
        <name value="statuscode"/>
        <source>
          <context value="src"/>
          <condition value="observation.statusCode.exists().not()"/>
        </source>
        <rule>
          <name value="status"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="final"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="component"/>
      <source>
        <context value="src"/>
        <element value="component"/>
        <variable value="component"/>
      </source>
      <rule>
        <name value="componentSec"/>
        <source>
          <context value="component"/>
          <element value="section"/>
          <variable value="section2"/>
        </source>
        <rule>
          <name value="sec2fhir"/>
          <source>
            <context value="section2"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="section"/>
            <variable value="sec2"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="section2"/>
              <element value="code"/>
              <variable value="vvv"/>
              <condition value="(code = '11329-0')"/>
            </source>
            <target>
              <context value="sec2"/>
              <contextType value="variable"/>
              <element value="code"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
          <rule>
            <name value="title"/>
            <source>
              <context value="section2"/>
              <element value="title"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="sec2"/>
              <contextType value="variable"/>
              <element value="title"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="t.dataString"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="exist"/>
            <source>
              <context value="src"/>
              <condition value="src.entry.exists()"/>
            </source>
            <rule>
              <name value="cdaText"/>
              <source>
                <context value="section2"/>
                <element value="text"/>
                <variable value="cdaText"/>
              </source>
              <target>
                <context value="sec2"/>
                <contextType value="variable"/>
                <element value="text"/>
                <variable value="fhirText"/>
              </target>
              <rule>
                <name value="narrativeStatus"/>
                <source>
                  <context value="cdaText"/>
                </source>
                <target>
                  <context value="fhirText"/>
                  <contextType value="variable"/>
                  <element value="status"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="generated"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="narrativeText"/>
                <source>
                  <context value="cdaText"/>
                  <variable value="t"/>
                </source>
                <target>
                  <context value="fhirText"/>
                  <contextType value="variable"/>
                  <element value="div"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="t"/>
                  </parameter>
                </target>
              </rule>
            </rule>
            <documentation value="section2.code -&gt; sec2.code;"/>
          </rule>
          <rule>
            <name value="where"/>
            <source>
              <context value="src"/>
              <condition value="src.entry.exists().not()"/>
            </source>
            <rule>
              <name value="cdaText"/>
              <source>
                <context value="section2"/>
                <element value="text"/>
                <variable value="cdaText"/>
              </source>
              <target>
                <context value="bundle"/>
                <contextType value="variable"/>
                <element value="entry"/>
                <variable value="e1"/>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="request"/>
                <variable value="request"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="BackboneElement"/>
                </parameter>
              </target>
              <target>
                <context value="request"/>
                <contextType value="variable"/>
                <element value="method"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="POST"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="resource"/>
                <variable value="condition"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <target>
                <context value="condition"/>
                <contextType value="variable"/>
                <element value="id"/>
                <variable value="uuid1"/>
                <transform value="uuid"/>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="fullUrl"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="https://example/Observation/"/>
                </parameter>
                <parameter>
                  <valueId value="uuid1"/>
                </parameter>
              </target>
              <target>
                <context value="request"/>
                <contextType value="variable"/>
                <element value="url"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <target>
                <context value="sec2"/>
                <contextType value="variable"/>
                <element value="entry"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Observation/' + %condition.id"/>
                </parameter>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="section2"/>
                  <element value="code"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="condition"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <variable value="vvv"/>
                  <transform value="create"/>
                </target>
              </rule>
              <rule>
                <name value="statuscode"/>
                <source>
                  <context value="src"/>
                  <condition value="condition.statusCode.exists().not()"/>
                </source>
                <rule>
                  <name value="status"/>
                  <source>
                    <context value="src"/>
                  </source>
                  <target>
                    <context value="condition"/>
                    <contextType value="variable"/>
                    <element value="status"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="final"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="reference"/>
                <source>
                  <context value="cdaText"/>
                </source>
                <target>
                  <context value="condition"/>
                  <contextType value="variable"/>
                  <element value="note"/>
                  <variable value="note"/>
                </target>
                <rule>
                  <name value="reference"/>
                  <source>
                    <context value="cdaText"/>
                  </source>
                  <target>
                    <context value="condition"/>
                    <contextType value="variable"/>
                    <element value="subject"/>
                    <variable value="reference"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Reference"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="reference"/>
                    <contextType value="variable"/>
                    <element value="reference"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString
                                   value="'https://example/Patient/' + %patient.id"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="reference"/>
                  <source>
                    <context value="cdaText"/>
                  </source>
                  <target>
                    <context value="condition"/>
                    <contextType value="variable"/>
                    <element value="encounter"/>
                    <variable value="reference"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Reference"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="reference"/>
                    <contextType value="variable"/>
                    <element value="reference"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString
                                   value="'https://example/Encounter/' + %enc.id"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="reference"/>
                  <source>
                    <context value="cdaText"/>
                    <variable value="t"/>
                  </source>
                  <target>
                    <context value="note"/>
                    <contextType value="variable"/>
                    <element value="text"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="t"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="subsection1"/>
            <source>
              <context value="section2"/>
              <element value="entry"/>
              <variable value="entry1"/>
            </source>
            <rule>
              <name value="entry"/>
              <source>
                <context value="entry1"/>
                <element value="observation"/>
                <variable value="obs"/>
              </source>
              <rule>
                <name value="observationcondition"/>
                <source>
                  <context value="obs"/>
                  <element value="code"/>
                  <condition value="(code = '75326-9')"/>
                </source>
                <rule>
                  <name value="whereEntryPatologicaProssima"/>
                  <source>
                    <context value="obs"/>
                  </source>
                  <target>
                    <context value="bundle"/>
                    <contextType value="variable"/>
                    <element value="entry"/>
                    <variable value="e1"/>
                  </target>
                  <target>
                    <context value="e1"/>
                    <contextType value="variable"/>
                    <element value="request"/>
                    <variable value="request"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="BackboneElement"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="method"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="POST"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="e1"/>
                    <contextType value="variable"/>
                    <element value="resource"/>
                    <variable value="condition"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Condition"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="condition"/>
                    <contextType value="variable"/>
                    <element value="id"/>
                    <variable value="uuid1"/>
                    <transform value="uuid"/>
                  </target>
                  <target>
                    <context value="e1"/>
                    <contextType value="variable"/>
                    <element value="fullUrl"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="https://example/Condition/"/>
                    </parameter>
                    <parameter>
                      <valueId value="uuid1"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="url"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="Condition"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="sec2"/>
                    <contextType value="variable"/>
                    <element value="entry"/>
                    <variable value="reference"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Reference"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="reference"/>
                    <contextType value="variable"/>
                    <element value="reference"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString
                                   value="'https://example/Condition/' + %condition.id"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="code"/>
                    <source>
                      <context value="obs"/>
                      <element value="code"/>
                      <variable value="vvv"/>
                    </source>
                    <target>
                      <context value="condition"/>
                      <contextType value="variable"/>
                      <element value="category"/>
                      <variable value="vvv"/>
                      <transform value="create"/>
                    </target>
                  </rule>
                  <rule>
                    <name value="reference"/>
                    <source>
                      <context value="obs"/>
                    </source>
                    <target>
                      <context value="condition"/>
                      <contextType value="variable"/>
                      <element value="subject"/>
                      <variable value="reference"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="Reference"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="reference"/>
                      <contextType value="variable"/>
                      <element value="reference"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString
                                     value="'https://example/Patient/' + %patient.id"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="reference"/>
                    <source>
                      <context value="obs"/>
                    </source>
                    <target>
                      <context value="condition"/>
                      <contextType value="variable"/>
                      <element value="encounter"/>
                      <variable value="reference"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="Reference"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="reference"/>
                      <contextType value="variable"/>
                      <element value="reference"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString
                                     value="'https://example/Encounter/' + %enc.id"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="status"/>
                    <source>
                      <context value="obs"/>
                      <element value="statusCode"/>
                      <variable value="status"/>
                      <condition value="(code = 'completed')"/>
                    </source>
                    <target>
                      <context value="condition"/>
                      <contextType value="variable"/>
                      <element value="verificationStatus"/>
                      <variable value="status2"/>
                    </target>
                    <rule>
                      <name value="st3"/>
                      <source>
                        <context value="status"/>
                      </source>
                      <target>
                        <context value="status2"/>
                        <contextType value="variable"/>
                        <element value="coding"/>
                        <variable value="status3"/>
                      </target>
                      <rule>
                        <name value="finald"/>
                        <source>
                          <context value="status"/>
                        </source>
                        <target>
                          <context value="status3"/>
                          <contextType value="variable"/>
                          <element value="code"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueString value="confirmed"/>
                          </parameter>
                        </target>
                      </rule>
                      <rule>
                        <name value="system"/>
                        <source>
                          <context value="status"/>
                        </source>
                        <target>
                          <context value="status3"/>
                          <contextType value="variable"/>
                          <element value="system"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueString
                                         value="http://terminology.hl7.org/CodeSystem/condition-ver-status"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="effectivetime1"/>
                    <source>
                      <context value="obs"/>
                      <element value="effectiveTime"/>
                      <variable value="effective1"/>
                    </source>
                    <rule>
                      <name value="ef"/>
                      <source>
                        <context value="effective1"/>
                        <condition
                                   value="effective1.low.exists() or effective1.high.exists()"/>
                      </source>
                      <rule>
                        <name value="onsetperiod"/>
                        <source>
                          <context value="effective1"/>
                        </source>
                        <target>
                          <context value="condition"/>
                          <contextType value="variable"/>
                          <element value="onset"/>
                          <variable value="periodonset"/>
                          <transform value="create"/>
                          <parameter>
                            <valueString value="Period"/>
                          </parameter>
                        </target>
                        <dependent>
                          <name value="IVLTSPeriod"/>
                          <variable value="effective1"/>
                          <variable value="periodonset"/>
                        </dependent>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="Value"/>
                    <source>
                      <context value="obs"/>
                      <type value="CD"/>
                      <element value="value"/>
                      <variable value="val"/>
                    </source>
                    <rule>
                      <name value="Ce"/>
                      <source>
                        <context value="val"/>
                      </source>
                      <target>
                        <context value="condition"/>
                        <contextType value="variable"/>
                        <element value="code"/>
                        <variable value="ce"/>
                        <transform value="create"/>
                        <parameter>
                          <valueString value="CodeableConcept"/>
                        </parameter>
                      </target>
                      <rule>
                        <name value="originalText"/>
                        <source>
                          <context value="val"/>
                          <element value="originalText"/>
                          <variable value="vvv"/>
                        </source>
                        <target>
                          <context value="ce"/>
                          <contextType value="variable"/>
                          <element value="text"/>
                          <variable value="vvv"/>
                          <transform value="create"/>
                        </target>
                      </rule>
                      <rule>
                        <name value="coding"/>
                        <source>
                          <context value="val"/>
                        </source>
                        <target>
                          <context value="ce"/>
                          <contextType value="variable"/>
                          <element value="coding"/>
                          <variable value="coding"/>
                        </target>
                        <rule>
                          <name value="code"/>
                          <source>
                            <context value="val"/>
                            <element value="code"/>
                            <variable value="code"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="code"/>
                            <transform value="cast"/>
                            <parameter>
                              <valueId value="code"/>
                            </parameter>
                            <parameter>
                              <valueString value="string"/>
                            </parameter>
                          </target>
                        </rule>
                        <rule>
                          <name value="codeSystem"/>
                          <source>
                            <context value="val"/>
                            <element value="codeSystem"/>
                            <variable value="system"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="system"/>
                            <transform value="translate"/>
                            <parameter>
                              <valueId value="system"/>
                            </parameter>
                            <parameter>
                              <valueString
                                           value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                            </parameter>
                            <parameter>
                              <valueString value="uri"/>
                            </parameter>
                          </target>
                        </rule>
                        <rule>
                          <name value="displayName"/>
                          <source>
                            <context value="val"/>
                            <element value="displayName"/>
                            <variable value="display"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="display"/>
                            <transform value="cast"/>
                            <parameter>
                              <valueId value="display"/>
                            </parameter>
                            <parameter>
                              <valueString value="string"/>
                            </parameter>
                          </target>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="EntryRelationship1"/>
                    <source>
                      <context value="obs"/>
                      <element value="entryRelationship"/>
                      <variable value="entriRel"/>
                    </source>
                    <rule>
                      <name value="evidence"/>
                      <source>
                        <context value="entriRel"/>
                      </source>
                      <target>
                        <context value="condition"/>
                        <contextType value="variable"/>
                        <element value="evidence"/>
                        <variable value="evidence"/>
                        <transform value="create"/>
                        <parameter>
                          <valueString value="BackboneElement"/>
                        </parameter>
                      </target>
                      <rule>
                        <name value="Observation2"/>
                        <source>
                          <context value="entriRel"/>
                          <element value="observation"/>
                          <variable value="observation2"/>
                        </source>
                        <rule>
                          <name value="code"/>
                          <source>
                            <context value="observation2"/>
                            <element value="code"/>
                            <variable value="code"/>
                          </source>
                          <rule>
                            <name value="whereDecorsoClinico"/>
                            <source>
                              <context value="code"/>
                              <element value="code"/>
                              <condition value="(code.code = '89261-2')"/>
                            </source>
                            <rule>
                              <name value="obser"/>
                              <source>
                                <context value="obs"/>
                              </source>
                              <target>
                                <context value="bundle"/>
                                <contextType value="variable"/>
                                <element value="entry"/>
                                <variable value="e1"/>
                              </target>
                              <target>
                                <context value="e1"/>
                                <contextType value="variable"/>
                                <element value="request"/>
                                <variable value="request"/>
                                <transform value="create"/>
                                <parameter>
                                  <valueString value="BackboneElement"/>
                                </parameter>
                              </target>
                              <target>
                                <context value="request"/>
                                <contextType value="variable"/>
                                <element value="method"/>
                                <transform value="copy"/>
                                <parameter>
                                  <valueString value="POST"/>
                                </parameter>
                              </target>
                              <target>
                                <context value="e1"/>
                                <contextType value="variable"/>
                                <element value="resource"/>
                                <variable value="observation"/>
                                <transform value="create"/>
                                <parameter>
                                  <valueString value="Observation"/>
                                </parameter>
                              </target>
                              <target>
                                <context value="observation"/>
                                <contextType value="variable"/>
                                <element value="id"/>
                                <variable value="uuid1"/>
                                <transform value="uuid"/>
                              </target>
                              <target>
                                <context value="e1"/>
                                <contextType value="variable"/>
                                <element value="fullUrl"/>
                                <transform value="append"/>
                                <parameter>
                                  <valueString
                                               value="https://example/Observation/"/>
                                </parameter>
                                <parameter>
                                  <valueId value="uuid1"/>
                                </parameter>
                              </target>
                              <target>
                                <context value="request"/>
                                <contextType value="variable"/>
                                <element value="url"/>
                                <transform value="copy"/>
                                <parameter>
                                  <valueString value="Observation"/>
                                </parameter>
                              </target>
                              <rule>
                                <name value="ref"/>
                                <source>
                                  <context value="entriRel"/>
                                </source>
                                <target>
                                  <context value="evidence"/>
                                  <contextType value="variable"/>
                                  <element value="detail"/>
                                  <variable value="reference"/>
                                  <transform value="create"/>
                                  <parameter>
                                    <valueString value="Reference"/>
                                  </parameter>
                                </target>
                                <target>
                                  <context value="reference"/>
                                  <contextType value="variable"/>
                                  <element value="reference"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString
                                                 value="'https://example/Observation/' + %observation.id"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="code"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="code"/>
                                  <variable value="vvv"/>
                                </source>
                                <target>
                                  <context value="observation"/>
                                  <contextType value="variable"/>
                                  <element value="code"/>
                                  <variable value="vvv"/>
                                  <transform value="create"/>
                                </target>
                              </rule>
                              <rule>
                                <name value="statuscode"/>
                                <source>
                                  <context value="observation2"/>
                                  <condition
                                             value="observation.statusCode.exists().not()"/>
                                </source>
                                <rule>
                                  <name value="status"/>
                                  <source>
                                    <context value="observation2"/>
                                  </source>
                                  <target>
                                    <context value="observation"/>
                                    <contextType value="variable"/>
                                    <element value="status"/>
                                    <transform value="copy"/>
                                    <parameter>
                                      <valueString value="final"/>
                                    </parameter>
                                  </target>
                                </rule>
                              </rule>
                              <rule>
                                <name value="Annontation"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="text"/>
                                  <variable value="text"/>
                                </source>
                                <target>
                                  <context value="observation"/>
                                  <contextType value="variable"/>
                                  <element value="note"/>
                                  <variable value="note"/>
                                  <transform value="create"/>
                                  <parameter>
                                    <valueString value="Annotation"/>
                                  </parameter>
                                </target>
                                <rule>
                                  <name value="val"/>
                                  <source>
                                    <context value="text"/>
                                    <element value="reference"/>
                                    <variable value="ref"/>
                                  </source>
                                  <target>
                                    <context value="note"/>
                                    <contextType value="variable"/>
                                    <element value="text"/>
                                    <transform value="evaluate"/>
                                    <parameter>
                                      <valueString value="ref.value"/>
                                    </parameter>
                                  </target>
                                </rule>
                              </rule>
                              <rule>
                                <name value="reference"/>
                                <source>
                                  <context value="obs"/>
                                </source>
                                <target>
                                  <context value="observation"/>
                                  <contextType value="variable"/>
                                  <element value="subject"/>
                                  <variable value="reference"/>
                                  <transform value="create"/>
                                  <parameter>
                                    <valueString value="Reference"/>
                                  </parameter>
                                </target>
                                <target>
                                  <context value="reference"/>
                                  <contextType value="variable"/>
                                  <element value="reference"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString
                                                 value="'https://example/Patient/' + %patient.id"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="reference"/>
                                <source>
                                  <context value="obs"/>
                                </source>
                                <target>
                                  <context value="observation"/>
                                  <contextType value="variable"/>
                                  <element value="encounter"/>
                                  <variable value="reference"/>
                                  <transform value="create"/>
                                  <parameter>
                                    <valueString value="Reference"/>
                                  </parameter>
                                </target>
                                <target>
                                  <context value="reference"/>
                                  <contextType value="variable"/>
                                  <element value="reference"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString
                                                 value="'https://example/Encounter/' + %enc.id"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="statusCode"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="statusCode"/>
                                  <variable value="statusc"/>
                                  <condition value="(code = 'completed')"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="status"/>
                                  <transform value="copy"/>
                                  <parameter>
                                    <valueString value="final"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="statusCode"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="statusCode"/>
                                  <variable value="statusc"/>
                                  <condition value="(code = 'active')"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="status"/>
                                  <transform value="copy"/>
                                  <parameter>
                                    <valueString value="registered"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="statusCode"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="statusCode"/>
                                  <variable value="statusc"/>
                                  <condition value="(code = 'aborted')"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="status"/>
                                  <transform value="copy"/>
                                  <parameter>
                                    <valueString value="cancelled"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="statusCode"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="statusCode"/>
                                  <variable value="statusc"/>
                                  <condition value="(code = 'suspended')"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="status"/>
                                  <transform value="copy"/>
                                  <parameter>
                                    <valueString value="partial"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="value"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="INT"/>
                                  <element value="value"/>
                                  <variable value="int"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="value"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString value="int.value"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="boolean"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="BL"/>
                                  <element value="value"/>
                                  <variable value="boolean"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="value"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString value="boolean.value"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="val"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="CD"/>
                                  <element value="value"/>
                                  <variable value="val"/>
                                </source>
                                <rule>
                                  <name value="coding"/>
                                  <source>
                                    <context value="val"/>
                                  </source>
                                  <target>
                                    <context value="ob"/>
                                    <contextType value="variable"/>
                                    <element value="value"/>
                                    <variable value="ce"/>
                                    <transform value="create"/>
                                    <parameter>
                                      <valueString value="CodeableConcept"/>
                                    </parameter>
                                  </target>
                                  <rule>
                                    <name value="originltext"/>
                                    <source>
                                      <context value="val"/>
                                      <element value="originalText"/>
                                      <variable value="originalText"/>
                                    </source>
                                    <rule>
                                      <name value="reference"/>
                                      <source>
                                        <context value="originalText"/>
                                        <element value="reference"/>
                                        <variable value="reference"/>
                                      </source>
                                      <target>
                                        <context value="ce"/>
                                        <contextType value="variable"/>
                                        <element value="text"/>
                                        <transform value="copy"/>
                                        <parameter>
                                          <valueId value="reference"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                  </rule>
                                  <rule>
                                    <name value="code"/>
                                    <source>
                                      <context value="val"/>
                                    </source>
                                    <target>
                                      <context value="ce"/>
                                      <contextType value="variable"/>
                                      <element value="coding"/>
                                      <variable value="coding"/>
                                    </target>
                                    <rule>
                                      <name value="code"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="code"/>
                                        <variable value="code"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="code"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="code"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="codeSystem"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="codeSystem"/>
                                        <variable value="system"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="system"/>
                                        <transform value="translate"/>
                                        <parameter>
                                          <valueId value="system"/>
                                        </parameter>
                                        <parameter>
                                          <valueString
                                                       value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="uri"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="displayName"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="displayName"/>
                                        <variable value="display"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="display"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="display"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="codeSystemVersion"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="codeSystemVersion"/>
                                        <variable value="version"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="version"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="version"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                  </rule>
                                  <rule>
                                    <name value="translation"/>
                                    <source>
                                      <context value="val"/>
                                      <element value="translation"/>
                                      <variable value="translation"/>
                                    </source>
                                    <target>
                                      <context value="ce"/>
                                      <contextType value="variable"/>
                                      <element value="coding"/>
                                      <variable value="coding"/>
                                    </target>
                                    <rule>
                                      <name value="code"/>
                                      <source>
                                        <context value="translation"/>
                                        <element value="code"/>
                                        <variable value="code"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="code"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="code"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="codeSystem"/>
                                      <source>
                                        <context value="translation"/>
                                        <element value="codeSystem"/>
                                        <variable value="system"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="system"/>
                                        <transform value="translate"/>
                                        <parameter>
                                          <valueId value="system"/>
                                        </parameter>
                                        <parameter>
                                          <valueString
                                                       value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="uri"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="displayName"/>
                                      <source>
                                        <context value="translation"/>
                                        <element value="displayName"/>
                                        <variable value="display"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="display"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="display"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="codeSystemVersion"/>
                                      <source>
                                        <context value="translation"/>
                                        <element value="codeSystemVersion"/>
                                        <variable value="version"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="version"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="version"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="qualifier"/>
                                      <source>
                                        <context value="translation"/>
                                        <element value="qualifier"/>
                                        <variable value="qualifier"/>
                                      </source>
                                      <rule>
                                        <name value="value"/>
                                        <source>
                                          <context value="qualifier"/>
                                          <element value="value"/>
                                          <variable value="value"/>
                                        </source>
                                        <target>
                                          <context value="ce"/>
                                          <contextType value="variable"/>
                                          <element value="coding"/>
                                          <variable value="coding"/>
                                        </target>
                                        <rule>
                                          <name value="code"/>
                                          <source>
                                            <context value="value"/>
                                            <element value="code"/>
                                            <variable value="code"/>
                                          </source>
                                          <target>
                                            <context value="coding"/>
                                            <contextType value="variable"/>
                                            <element value="code"/>
                                            <transform value="cast"/>
                                            <parameter>
                                              <valueId value="code"/>
                                            </parameter>
                                            <parameter>
                                              <valueString value="string"/>
                                            </parameter>
                                          </target>
                                        </rule>
                                        <rule>
                                          <name value="codeSystem"/>
                                          <source>
                                            <context value="value"/>
                                            <element value="codeSystem"/>
                                            <variable value="system"/>
                                          </source>
                                          <target>
                                            <context value="coding"/>
                                            <contextType value="variable"/>
                                            <element value="system"/>
                                            <transform value="translate"/>
                                            <parameter>
                                              <valueId value="system"/>
                                            </parameter>
                                            <parameter>
                                              <valueString
                                                           value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                                            </parameter>
                                            <parameter>
                                              <valueString value="uri"/>
                                            </parameter>
                                          </target>
                                        </rule>
                                        <rule>
                                          <name value="displayName"/>
                                          <source>
                                            <context value="value"/>
                                            <element value="displayName"/>
                                            <variable value="display"/>
                                          </source>
                                          <target>
                                            <context value="coding"/>
                                            <contextType value="variable"/>
                                            <element value="display"/>
                                            <transform value="cast"/>
                                            <parameter>
                                              <valueId value="display"/>
                                            </parameter>
                                            <parameter>
                                              <valueString value="string"/>
                                            </parameter>
                                          </target>
                                        </rule>
                                        <rule>
                                          <name value="codeSystemVersion"/>
                                          <source>
                                            <context value="value"/>
                                            <element
                                                     value="codeSystemVersion"/>
                                            <variable value="version"/>
                                          </source>
                                          <target>
                                            <context value="coding"/>
                                            <contextType value="variable"/>
                                            <element value="version"/>
                                            <transform value="cast"/>
                                            <parameter>
                                              <valueId value="version"/>
                                            </parameter>
                                            <parameter>
                                              <valueString value="string"/>
                                            </parameter>
                                          </target>
                                        </rule>
                                      </rule>
                                    </rule>
                                  </rule>
                                </rule>
                              </rule>
                              <rule>
                                <name value="valueQuantity"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="PQ"/>
                                  <element value="value"/>
                                  <variable value="val"/>
                                </source>
                                <rule>
                                  <name value="quantity"/>
                                  <source>
                                    <context value="val"/>
                                  </source>
                                  <target>
                                    <context value="ob"/>
                                    <contextType value="variable"/>
                                    <element value="value"/>
                                    <variable value="quantity"/>
                                    <transform value="create"/>
                                    <parameter>
                                      <valueString value="Quantity"/>
                                    </parameter>
                                  </target>
                                  <rule>
                                    <name value="value"/>
                                    <source>
                                      <context value="val"/>
                                      <element value="value"/>
                                      <variable value="value"/>
                                    </source>
                                    <target>
                                      <context value="quantity"/>
                                      <contextType value="variable"/>
                                      <element value="value"/>
                                      <transform value="copy"/>
                                      <parameter>
                                        <valueId value="value"/>
                                      </parameter>
                                    </target>
                                  </rule>
                                  <rule>
                                    <name value="unit"/>
                                    <source>
                                      <context value="val"/>
                                      <element value="unit"/>
                                      <variable value="unit"/>
                                    </source>
                                    <target>
                                      <context value="quantity"/>
                                      <contextType value="variable"/>
                                      <element value="unit"/>
                                      <transform value="copy"/>
                                      <parameter>
                                        <valueId value="unit"/>
                                      </parameter>
                                    </target>
                                  </rule>
                                </rule>
                              </rule>
                              <rule>
                                <name value="value"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="ST"/>
                                  <element value="value"/>
                                  <variable value="value"/>
                                </source>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="value"/>
                                  <transform value="create"/>
                                  <parameter>
                                    <valueString value="string"/>
                                  </parameter>
                                </target>
                                <target>
                                  <context value="ob"/>
                                  <contextType value="variable"/>
                                  <element value="value"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString value="value.dataString"/>
                                  </parameter>
                                </target>
                              </rule>
                              <rule>
                                <name value="Value"/>
                                <source>
                                  <context value="observation2"/>
                                  <type value="CE"/>
                                  <element value="value"/>
                                  <variable value="val"/>
                                </source>
                                <rule>
                                  <name value="Ce"/>
                                  <source>
                                    <context value="val"/>
                                  </source>
                                  <target>
                                    <context value="observation"/>
                                    <contextType value="variable"/>
                                    <element value="value"/>
                                    <variable value="ce"/>
                                    <transform value="create"/>
                                    <parameter>
                                      <valueString value="CodeableConcept"/>
                                    </parameter>
                                  </target>
                                  <rule>
                                    <name value="originalText"/>
                                    <source>
                                      <context value="val"/>
                                      <element value="originalText"/>
                                      <variable value="vvv"/>
                                    </source>
                                    <target>
                                      <context value="ce"/>
                                      <contextType value="variable"/>
                                      <element value="text"/>
                                      <variable value="vvv"/>
                                      <transform value="create"/>
                                    </target>
                                  </rule>
                                  <rule>
                                    <name value="coding"/>
                                    <source>
                                      <context value="val"/>
                                    </source>
                                    <target>
                                      <context value="ce"/>
                                      <contextType value="variable"/>
                                      <element value="coding"/>
                                      <variable value="coding"/>
                                    </target>
                                    <rule>
                                      <name value="code"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="code"/>
                                        <variable value="code"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="code"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="code"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="codeSystem"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="codeSystem"/>
                                        <variable value="system"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="system"/>
                                        <transform value="translate"/>
                                        <parameter>
                                          <valueId value="system"/>
                                        </parameter>
                                        <parameter>
                                          <valueString
                                                       value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="uri"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                    <rule>
                                      <name value="displayName"/>
                                      <source>
                                        <context value="val"/>
                                        <element value="displayName"/>
                                        <variable value="display"/>
                                      </source>
                                      <target>
                                        <context value="coding"/>
                                        <contextType value="variable"/>
                                        <element value="display"/>
                                        <transform value="cast"/>
                                        <parameter>
                                          <valueId value="display"/>
                                        </parameter>
                                        <parameter>
                                          <valueString value="string"/>
                                        </parameter>
                                      </target>
                                    </rule>
                                  </rule>
                                </rule>
                              </rule>
                            </rule>
                          </rule>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="entryrelationshipstatus"/>
                    <source>
                      <context value="obs"/>
                      <element value="entryRelationship"/>
                      <variable value="entriRel"/>
                    </source>
                    <rule>
                      <name value="observationstatus"/>
                      <source>
                        <context value="entriRel"/>
                        <element value="observation"/>
                        <variable value="observation2"/>
                      </source>
                      <rule>
                        <name value="codestatus"/>
                        <source>
                          <context value="observation2"/>
                          <element value="code"/>
                          <variable value="code"/>
                        </source>
                        <rule>
                          <name value="whereDecorsoClinico"/>
                          <source>
                            <context value="code"/>
                            <element value="code"/>
                            <condition value="(code.code = '33999-4')"/>
                          </source>
                          <rule>
                            <name value="code"/>
                            <source>
                              <context value="observation2"/>
                            </source>
                            <target>
                              <context value="condition"/>
                              <contextType value="variable"/>
                              <element value="clinicalStatus"/>
                              <variable value="status"/>
                              <transform value="create"/>
                              <parameter>
                                <valueString value="CodeableConcept"/>
                              </parameter>
                            </target>
                            <rule>
                              <name value="textstat"/>
                              <source>
                                <context value="observation2"/>
                                <element value="text"/>
                                <variable value="text"/>
                              </source>
                              <rule>
                                <name value="statref"/>
                                <source>
                                  <context value="text"/>
                                  <element value="reference"/>
                                  <variable value="refstat"/>
                                </source>
                                <target>
                                  <context value="status"/>
                                  <contextType value="variable"/>
                                  <element value="text"/>
                                  <transform value="evaluate"/>
                                  <parameter>
                                    <valueString value="refstat.value"/>
                                  </parameter>
                                </target>
                              </rule>
                            </rule>
                            <rule>
                              <name value="coding"/>
                              <source>
                                <context value="observation2"/>
                              </source>
                              <target>
                                <context value="status"/>
                                <contextType value="variable"/>
                                <element value="coding"/>
                                <variable value="coding"/>
                                <transform value="create"/>
                                <parameter>
                                  <valueString value="Coding"/>
                                </parameter>
                              </target>
                              <rule>
                                <name value="value1"/>
                                <source>
                                  <context value="observation2"/>
                                  <element value="value"/>
                                  <variable value="value"/>
                                </source>
                                <rule>
                                  <name value="active"/>
                                  <source>
                                    <context value="value"/>
                                    <element value="code"/>
                                    <condition
                                               value="(value.code = 'LA16666-2')"/>
                                  </source>
                                  <target>
                                    <context value="coding"/>
                                    <contextType value="variable"/>
                                    <element value="code"/>
                                    <transform value="copy"/>
                                    <parameter>
                                      <valueString value="active"/>
                                    </parameter>
                                  </target>
                                </rule>
                                <rule>
                                  <name value="inactive"/>
                                  <source>
                                    <context value="value"/>
                                    <element value="code"/>
                                    <condition
                                               value="(value.code = 'LA18632-2')"/>
                                  </source>
                                  <target>
                                    <context value="coding"/>
                                    <contextType value="variable"/>
                                    <element value="code"/>
                                    <transform value="copy"/>
                                    <parameter>
                                      <valueString value="inactive"/>
                                    </parameter>
                                  </target>
                                </rule>
                                <rule>
                                  <name value="system"/>
                                  <source>
                                    <context value="value"/>
                                    <element value="codeSystem"/>
                                    <variable value="system"/>
                                  </source>
                                  <target>
                                    <context value="coding"/>
                                    <contextType value="variable"/>
                                    <element value="system"/>
                                    <transform value="copy"/>
                                    <parameter>
                                      <valueString
                                                   value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
                                    </parameter>
                                  </target>
                                </rule>
                                <rule>
                                  <name value="displayName"/>
                                  <source>
                                    <context value="value"/>
                                    <element value="displayName"/>
                                    <variable value="display"/>
                                  </source>
                                  <target>
                                    <context value="coding"/>
                                    <contextType value="variable"/>
                                    <element value="display"/>
                                    <transform value="cast"/>
                                    <parameter>
                                      <valueId value="display"/>
                                    </parameter>
                                    <parameter>
                                      <valueString value="string"/>
                                    </parameter>
                                  </target>
                                </rule>
                              </rule>
                            </rule>
                          </rule>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                </rule>
                <documentation value="EntryRelationship per il Problem"/>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="esameObiettivo"/>
            <source>
              <context value="section2"/>
              <element value="code"/>
              <condition value="(code = '29545-1')"/>
            </source>
            <dependent>
              <name value="ClinicalDocumentSottoSectionOBS"/>
              <variable value="section2"/>
              <variable value="sec2"/>
              <variable value="bundle"/>
              <variable value="enc"/>
              <variable value="patient"/>
            </dependent>
            <documentation value="ESAME PBIETTIVO"/>
          </rule>
          <rule>
            <name value="TerapiaFarmacologicaAllIngresso"/>
            <source>
              <context value="section2"/>
              <element value="code"/>
              <condition value="(code = '42346-7')"/>
            </source>
            <dependent>
              <name value="ClinicalDocumentSottoSectionMS"/>
              <variable value="section2"/>
              <variable value="sec2"/>
              <variable value="bundle"/>
              <variable value="patient"/>
              <variable value="enc"/>
            </dependent>
            <documentation value="TETAPIA FARMACOLOGICA"/>
          </rule>
          <documentation value="ANAMNESI"/>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionDecorsoOspedaliero"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="narrativeStatus"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="generated"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeText"/>
        <source>
          <context value="cdaText"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="div"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="t"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="code"/>
        <source>
          <context value="src"/>
          <element value="code"/>
          <variable value="vvv"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="code"/>
          <variable value="vvv"/>
          <transform value="create"/>
        </target>
      </rule>
      <rule>
        <name value="statuscode"/>
        <source>
          <context value="src"/>
          <condition value="observation.statusCode.exists().not()"/>
        </source>
        <rule>
          <name value="status"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="final"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="2"/>
      <source>
        <context value="src"/>
        <element value="component"/>
        <variable value="component"/>
      </source>
      <rule>
        <name value="1"/>
        <source>
          <context value="component"/>
          <element value="section"/>
          <variable value="section2"/>
        </source>
        <rule>
          <name value="Decorso"/>
          <source>
            <context value="src"/>
          </source>
          <dependent>
            <name value="ClinicalDocumentSottoSectionOBS"/>
            <variable value="section2"/>
            <variable value="tgt"/>
            <variable value="bundle"/>
            <variable value="enc"/>
            <variable value="patient"/>
          </dependent>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionComplicanze"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exist"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="observation"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Observation/' + %observation.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="observation.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="final"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="observation"/>
          <variable value="obs"/>
        </source>
        <dependent>
          <name value="Observation"/>
          <variable value="obs"/>
          <variable value="patient"/>
          <variable value="enc"/>
          <variable value="observation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionRiscontri"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="narrativeStatus"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="generated"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeText"/>
        <source>
          <context value="cdaText"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="div"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="t"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="code"/>
        <source>
          <context value="src"/>
          <element value="code"/>
          <variable value="vvv"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="code"/>
          <variable value="vvv"/>
          <transform value="create"/>
        </target>
      </rule>
      <rule>
        <name value="statuscode"/>
        <source>
          <context value="src"/>
          <condition value="observation.statusCode.exists().not()"/>
        </source>
        <rule>
          <name value="status"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="final"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="2"/>
      <source>
        <context value="src"/>
        <element value="component"/>
        <variable value="component"/>
      </source>
      <rule>
        <name value="1"/>
        <source>
          <context value="component"/>
          <element value="section"/>
          <variable value="section2"/>
        </source>
        <rule>
          <name value="Decorso"/>
          <source>
            <context value="src"/>
          </source>
          <dependent>
            <name value="ClinicalDocumentSottoSectionOBS"/>
            <variable value="section2"/>
            <variable value="tgt"/>
            <variable value="bundle"/>
            <variable value="enc"/>
            <variable value="patient"/>
          </dependent>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionConsulenza"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exist"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="observation"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Observation/' + %observation.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="observation.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="final"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="observation"/>
          <variable value="obs"/>
        </source>
        <dependent>
          <name value="ObservationConsulenza"/>
          <variable value="obs"/>
          <variable value="patient"/>
          <variable value="enc"/>
          <variable value="observation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionEsamiEseguitiRicovero"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exists"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="observation"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Observation/' + %observation.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="observation.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="final"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="observation"/>
          <variable value="obs"/>
        </source>
        <dependent>
          <name value="ObservationEsamiDuranteRicovero"/>
          <variable value="obs"/>
          <variable value="patient"/>
          <variable value="enc"/>
          <variable value="observation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionProcedureEseguiteRicovero"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exists"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="procedure"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Procedure"/>
          </parameter>
        </target>
        <target>
          <context value="procedure"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Procedure/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Procedure"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Procedure/' + %procedure.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="unknown"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="Entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="procedure"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Procedure"/>
        </parameter>
      </target>
      <target>
        <context value="procedure"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Procedure/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Procedure"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Procedure/' + %procedure.id"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="procedure"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="procedure"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="Procedure"/>
        <source>
          <context value="entry1"/>
          <element value="procedure"/>
          <variable value="proceduresrc"/>
        </source>
        <rule>
          <name value="code"/>
          <source>
            <context value="proceduresrc"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="text"/>
          <source>
            <context value="proceduresrc"/>
            <element value="text"/>
            <variable value="txt"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="txt"/>
              <element value="reference"/>
              <variable value="ref"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="ref.value"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="status"/>
          <source>
            <context value="proceduresrc"/>
            <condition value="proc.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="statuscode"/>
            <source>
              <context value="proceduresrc"/>
            </source>
            <target>
              <context value="procedure"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="unknown"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'completed')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="completed"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'active')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="in-progress"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'aborted')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="stopped"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'suspended')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="on-hold"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'cancelled')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="not-done"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'held')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="on-hold"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'new')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="preparation"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'obsolete')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="entered-in-error"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="proceduresrc"/>
            <element value="statusCode"/>
            <variable value="statusc"/>
            <condition value="(code = 'nullified')"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="unknown"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="effectiveTime"/>
          <source>
            <context value="proceduresrc"/>
            <element value="effectiveTime"/>
            <variable value="efft"/>
          </source>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="performed"/>
            <variable value="period"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Period"/>
            </parameter>
          </target>
          <dependent>
            <name value="IVLTSPeriod"/>
            <variable value="efft"/>
            <variable value="period"/>
          </dependent>
        </rule>
        <rule>
          <name value="Observation"/>
          <source>
            <context value="proceduresrc"/>
            <element value="entryRelationship"/>
            <variable value="entriRel"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e1"/>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="request"/>
            <variable value="request"/>
            <transform value="create"/>
            <parameter>
              <valueString value="BackboneElement"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="method"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="POST"/>
            </parameter>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="observation"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid1"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="https://example/Observation/"/>
            </parameter>
            <parameter>
              <valueId value="uuid1"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Observation"/>
            </parameter>
          </target>
          <target>
            <context value="procedure"/>
            <contextType value="variable"/>
            <element value="reasonReference"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString
                           value="'https://example/Observation/' + %observation.id"/>
            </parameter>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="entriRel"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="subject"/>
              <variable value="reference"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="reference"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString
                             value="'https://example/Patient/' + %patient.id"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="reference"/>
            <source>
              <context value="entriRel"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="encounter"/>
              <variable value="reference"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="reference"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="'https://example/Encounter/' + %enc.id"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="ObservationValue"/>
            <source>
              <context value="entriRel"/>
              <element value="observation"/>
              <variable value="obs"/>
            </source>
            <rule>
              <name value="code"/>
              <source>
                <context value="obs"/>
                <element value="code"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="observation"/>
                <contextType value="variable"/>
                <element value="code"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
            <rule>
              <name value="statuscode"/>
              <source>
                <context value="obs"/>
                <condition value="observation.statusCode.exists().not()"/>
              </source>
              <rule>
                <name value="status"/>
                <source>
                  <context value="obs"/>
                </source>
                <target>
                  <context value="observation"/>
                  <contextType value="variable"/>
                  <element value="status"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="final"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionAllergie"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exists"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="allergy"/>
          <transform value="create"/>
          <parameter>
            <valueString value="AllergyIntolerance"/>
          </parameter>
        </target>
        <target>
          <context value="allergy"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/AllergyIntolerance/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="AllergyIntolerance"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/AllergyIntolerance/' + %allergy.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="patient"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="allergy"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="clinicalStatus"/>
            <variable value="status"/>
            <transform value="create"/>
            <parameter>
              <valueString value="CodeableConcept"/>
            </parameter>
          </target>
          <rule>
            <name value="text"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="status"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="coding"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="status"/>
              <contextType value="variable"/>
              <element value="coding"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="active"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="active"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="system"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="allergy"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="allergy"/>
        <transform value="create"/>
        <parameter>
          <valueString value="AllergyIntolerance"/>
        </parameter>
      </target>
      <target>
        <context value="allergy"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/AllergyIntolerance/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="AllergyIntolerance"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/AllergyIntolerance/' + %allergy.id"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="allergy"/>
          <contextType value="variable"/>
          <element value="patient"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="allergy"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="act"/>
          <variable value="actallint"/>
        </source>
        <rule>
          <name value="effectiveTime"/>
          <source>
            <context value="actallint"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="allergy"/>
            <contextType value="variable"/>
            <element value="onset"/>
            <variable value="per"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Period"/>
            </parameter>
          </target>
          <dependent>
            <name value="IVLTSPeriod"/>
            <variable value="eff"/>
            <variable value="per"/>
          </dependent>
        </rule>
        <rule>
          <name value="entryRelationship"/>
          <source>
            <context value="actallint"/>
            <element value="entryRelationship"/>
            <variable value="entryact"/>
          </source>
          <rule>
            <name value="partic"/>
            <source>
              <context value="entryact"/>
              <element value="observation"/>
              <variable value="entryobs"/>
            </source>
            <rule>
              <name value="code"/>
              <source>
                <context value="entryobs"/>
                <element value="value"/>
                <variable value="code"/>
              </source>
              <rule>
                <name value="type"/>
                <source>
                  <context value="code"/>
                  <element value="code"/>
                  <variable value="code1"/>
                </source>
                <target>
                  <context value="allergy"/>
                  <contextType value="variable"/>
                  <element value="type"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="code1"/>
                  </parameter>
                  <parameter>
                    <valueString value="#AllergyTypeMap"/>
                  </parameter>
                  <parameter>
                    <valueString value="code"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="category"/>
                <source>
                  <context value="code"/>
                  <element value="code"/>
                  <variable value="code2"/>
                </source>
                <target>
                  <context value="allergy"/>
                  <contextType value="variable"/>
                  <element value="category"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="code2"/>
                  </parameter>
                  <parameter>
                    <valueString value="#AllergyCategoryMap"/>
                  </parameter>
                  <parameter>
                    <valueString value="code"/>
                  </parameter>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="PratRole"/>
              <source>
                <context value="entryobs"/>
                <element value="participant"/>
                <variable value="partic"/>
              </source>
              <rule>
                <name value="pratentit"/>
                <source>
                  <context value="partic"/>
                  <element value="participantRole"/>
                  <variable value="pratRole"/>
                </source>
                <rule>
                  <name value="react"/>
                  <source>
                    <context value="pratRole"/>
                    <element value="playingEntity"/>
                    <variable value="pratent"/>
                  </source>
                  <rule>
                    <name value="cod"/>
                    <source>
                      <context value="pratent"/>
                    </source>
                    <target>
                      <context value="allergy"/>
                      <contextType value="variable"/>
                      <element value="reaction"/>
                      <variable value="reaction"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="BackboneElement"/>
                      </parameter>
                    </target>
                    <rule>
                      <name value="subs"/>
                      <source>
                        <context value="pratent"/>
                        <element value="code"/>
                        <variable value="vvv"/>
                      </source>
                      <target>
                        <context value="reaction"/>
                        <contextType value="variable"/>
                        <element value="substance"/>
                        <variable value="vvv"/>
                        <transform value="create"/>
                      </target>
                    </rule>
                    <rule>
                      <name value="entry"/>
                      <source>
                        <context value="entryobs"/>
                        <element value="entryRelationship"/>
                        <variable value="entryobs1"/>
                        <condition value="(typeCode = 'MFST')"/>
                      </source>
                      <rule>
                        <name value="observ"/>
                        <source>
                          <context value="entryobs1"/>
                          <element value="observation"/>
                          <variable value="entobs"/>
                        </source>
                        <rule>
                          <name value="eff"/>
                          <source>
                            <context value="entobs"/>
                            <element value="effectiveTime"/>
                            <variable value="eff"/>
                          </source>
                          <rule>
                            <name value="val"/>
                            <source>
                              <context value="eff"/>
                              <element value="low"/>
                              <variable value="l"/>
                            </source>
                            <target>
                              <context value="reaction"/>
                              <contextType value="variable"/>
                              <element value="onset"/>
                              <variable value="start"/>
                              <transform value="create"/>
                              <parameter>
                                <valueString value="dateTime"/>
                              </parameter>
                            </target>
                            <dependent>
                              <name value="TSDateTime"/>
                              <variable value="l"/>
                              <variable value="start"/>
                            </dependent>
                          </rule>
                        </rule>
                        <rule>
                          <name value="manifest"/>
                          <source>
                            <context value="entobs"/>
                            <element value="value"/>
                            <variable value="vvv"/>
                          </source>
                          <target>
                            <context value="reaction"/>
                            <contextType value="variable"/>
                            <element value="manifestation"/>
                            <variable value="vvv"/>
                            <transform value="create"/>
                          </target>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="observ"/>
              <source>
                <context value="entryobs"/>
                <element value="entryRelationship"/>
                <variable value="entryobs2"/>
              </source>
              <rule>
                <name value="severity"/>
                <source>
                  <context value="entryobs2"/>
                  <element value="observation"/>
                  <variable value="entobs"/>
                </source>
                <rule>
                  <name value="sev"/>
                  <source>
                    <context value="entobs"/>
                    <element value="code"/>
                    <variable value="code"/>
                    <condition value="(code = 'SEV')"/>
                  </source>
                  <rule>
                    <name value="entobs"/>
                    <source>
                      <context value="entobs"/>
                      <element value="value"/>
                      <variable value="value"/>
                    </source>
                    <rule>
                      <name value="active"/>
                      <source>
                        <context value="value"/>
                        <element value="code"/>
                        <condition value="(value.code = 'M')"/>
                      </source>
                      <target>
                        <context value="allergy"/>
                        <contextType value="variable"/>
                        <element value="criticality"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="unable-to-assess"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="active"/>
                      <source>
                        <context value="value"/>
                        <element value="code"/>
                        <condition value="(value.code = 'L')"/>
                      </source>
                      <target>
                        <context value="allergy"/>
                        <contextType value="variable"/>
                        <element value="criticality"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="low"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="active"/>
                      <source>
                        <context value="value"/>
                        <element value="code"/>
                        <condition value="(value.code = 'H')"/>
                      </source>
                      <target>
                        <context value="allergy"/>
                        <contextType value="variable"/>
                        <element value="criticality"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="high"/>
                        </parameter>
                      </target>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="entry3"/>
              <source>
                <context value="entryobs"/>
                <element value="entryRelationship"/>
                <variable value="entryobs3"/>
              </source>
              <rule>
                <name value="obobs3serv"/>
                <source>
                  <context value="entryobs3"/>
                  <element value="observation"/>
                  <variable value="entobs"/>
                </source>
                <rule>
                  <name value="stat"/>
                  <source>
                    <context value="entobs"/>
                    <element value="code"/>
                    <variable value="code"/>
                    <condition value="(code = '33999-4')"/>
                  </source>
                  <rule>
                    <name value="clinicalStatus"/>
                    <source>
                      <context value="entobs"/>
                    </source>
                    <target>
                      <context value="allergy"/>
                      <contextType value="variable"/>
                      <element value="clinicalStatus"/>
                      <variable value="status"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="CodeableConcept"/>
                      </parameter>
                    </target>
                    <rule>
                      <name value="coding"/>
                      <source>
                        <context value="entobs"/>
                      </source>
                      <target>
                        <context value="status"/>
                        <contextType value="variable"/>
                        <element value="coding"/>
                        <variable value="coding"/>
                        <transform value="create"/>
                        <parameter>
                          <valueString value="Coding"/>
                        </parameter>
                      </target>
                      <rule>
                        <name value="value1"/>
                        <source>
                          <context value="entobs"/>
                          <element value="value"/>
                          <variable value="value"/>
                        </source>
                        <rule>
                          <name value="active"/>
                          <source>
                            <context value="value"/>
                            <element value="code"/>
                            <condition value="(value.code = 'LA16666-2')"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="code"/>
                            <transform value="copy"/>
                            <parameter>
                              <valueString value="active"/>
                            </parameter>
                          </target>
                        </rule>
                        <rule>
                          <name value="active"/>
                          <source>
                            <context value="value"/>
                            <element value="code"/>
                            <condition value="(value.code = 'LA18632-2')"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="code"/>
                            <transform value="copy"/>
                            <parameter>
                              <valueString value="inactive"/>
                            </parameter>
                          </target>
                        </rule>
                        <rule>
                          <name value="system"/>
                          <source>
                            <context value="value"/>
                            <element value="codeSystem"/>
                            <variable value="system"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="system"/>
                            <transform value="copy"/>
                            <parameter>
                              <valueString
                                           value="http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"/>
                            </parameter>
                          </target>
                        </rule>
                        <rule>
                          <name value="displayName"/>
                          <source>
                            <context value="value"/>
                            <element value="displayName"/>
                            <variable value="display"/>
                          </source>
                          <target>
                            <context value="coding"/>
                            <contextType value="variable"/>
                            <element value="display"/>
                            <transform value="cast"/>
                            <parameter>
                              <valueId value="display"/>
                            </parameter>
                            <parameter>
                              <valueString value="string"/>
                            </parameter>
                          </target>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="entry4"/>
              <source>
                <context value="entryobs"/>
                <element value="entryRelationship"/>
                <variable value="entryobs4"/>
              </source>
              <rule>
                <name value="obobs4serv"/>
                <source>
                  <context value="entryobs4"/>
                  <element value="act"/>
                  <variable value="entact"/>
                </source>
                <rule>
                  <name value="txtact"/>
                  <source>
                    <context value="entact"/>
                    <element value="text"/>
                    <variable value="actext"/>
                  </source>
                  <rule>
                    <name value="notetxt"/>
                    <source>
                      <context value="actext"/>
                      <element value="reference"/>
                      <variable value="reftxt"/>
                    </source>
                    <target>
                      <context value="allergy"/>
                      <contextType value="variable"/>
                      <element value="note"/>
                      <variable value="note"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="BackboneElement"/>
                      </parameter>
                    </target>
                    <rule>
                      <name value="notxt"/>
                      <source>
                        <context value="reftxt"/>
                        <variable value="ref"/>
                      </source>
                      <target>
                        <context value="note"/>
                        <contextType value="variable"/>
                        <element value="text"/>
                        <transform value="evaluate"/>
                        <parameter>
                          <valueString value="ref.value"/>
                        </parameter>
                      </target>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionDiagnosiDimissione"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exists"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="observation"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Observation/' + %observation.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="observation.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="final"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <rule>
        <name value="act"/>
        <source>
          <context value="entry1"/>
          <element value="observation"/>
          <variable value="obs"/>
        </source>
        <dependent>
          <name value="Observation"/>
          <variable value="obs"/>
          <variable value="patient"/>
          <variable value="enc"/>
          <variable value="observation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionIstruzioniFollowUp"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="narrativeStatus"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="generated"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeText"/>
        <source>
          <context value="cdaText"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="div"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="t"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="entry"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="carePlan"/>
        <transform value="create"/>
        <parameter>
          <valueString value="CarePlan"/>
        </parameter>
      </target>
      <target>
        <context value="carePlan"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/CarePlan/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="CarePlan"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/CarePlan/' + %carePlan.id"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="carePlan"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="carePlan"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="carePlan"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="status"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="carePlan"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="active"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="intent"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="carePlan"/>
          <contextType value="variable"/>
          <element value="intent"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="order"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionTerapiaFarmacologicaDuranteRicovero"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exists"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="medicationAdm"/>
          <transform value="create"/>
          <parameter>
            <valueString value="MedicationAdministration"/>
          </parameter>
        </target>
        <target>
          <context value="medicationAdm"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/MedicationAdministration/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="MedicationAdministration"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/MedicationAdministration/' + %medicationAdm.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="context"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="medication"/>
            <variable value="codecon"/>
            <transform value="create"/>
            <parameter>
              <valueString value="CodeableConcept"/>
            </parameter>
          </target>
          <rule>
            <name value="text"/>
            <source>
              <context value="cdaText"/>
            </source>
            <target>
              <context value="codecon"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="Period"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="effective"/>
            <variable value="period"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Period"/>
            </parameter>
          </target>
          <rule>
            <name value="low"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="period"/>
              <contextType value="variable"/>
              <element value="start"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="start.now()"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="high"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="period"/>
              <contextType value="variable"/>
              <element value="end"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="end.now()"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="statuscode"/>
          <source>
            <context value="src"/>
            <condition value="sub.statusCode.exists().not()"/>
          </source>
          <rule>
            <name value="status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="medicationAdm"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="completed"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="sa"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="medicationAdm"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationAdministration"/>
        </parameter>
      </target>
      <target>
        <context value="medicationAdm"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/MedicationAdministration/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="MedicationAdministration"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/MedicationAdministration/' + %medicationAdm.id"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="entry1"/>
        </source>
        <target>
          <context value="medicationAdm"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="entry1"/>
        </source>
        <target>
          <context value="medicationAdm"/>
          <contextType value="variable"/>
          <element value="context"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="entry"/>
        <source>
          <context value="entry1"/>
          <element value="substanceAdministration"/>
          <variable value="sa"/>
        </source>
        <rule>
          <name value="tx"/>
          <source>
            <context value="sa"/>
            <element value="text"/>
            <variable value="tx"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="perf"/>
            <source>
              <context value="sa"/>
              <element value="performer"/>
              <variable value="performer"/>
            </source>
            <target>
              <context value="bundle"/>
              <contextType value="variable"/>
              <element value="entry"/>
              <variable value="e1"/>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="request"/>
              <variable value="request"/>
              <transform value="create"/>
              <parameter>
                <valueString value="BackboneElement"/>
              </parameter>
            </target>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="method"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="PUT"/>
              </parameter>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <variable value="practitioner"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Practitioner"/>
              </parameter>
            </target>
            <rule>
              <name value="time"/>
              <source>
                <context value="performer"/>
                <element value="time"/>
                <variable value="ti"/>
              </source>
              <target>
                <context value="note"/>
                <contextType value="variable"/>
                <element value="time"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="ti.value"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="assEntity"/>
              <source>
                <context value="performer"/>
                <element value="assignedEntity"/>
                <variable value="assEnty"/>
              </source>
              <rule>
                <name value="meta"/>
                <source>
                  <context value="assEnty"/>
                </source>
                <target>
                  <context value="practitioner"/>
                  <contextType value="variable"/>
                  <element value="meta"/>
                  <variable value="meta"/>
                </target>
                <rule>
                  <name value="coding"/>
                  <source>
                    <context value="assEnty"/>
                  </source>
                  <target>
                    <context value="meta"/>
                    <contextType value="variable"/>
                    <element value="tag"/>
                    <variable value="coding"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Coding"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="system"/>
                    <source>
                      <context value="assEnty"/>
                    </source>
                    <target>
                      <context value="coding"/>
                      <contextType value="variable"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://algoritmodiscoring"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="code"/>
                    <source>
                      <context value="assEnty"/>
                    </source>
                    <target>
                      <context value="coding"/>
                      <contextType value="variable"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="ClinicalDocument/body/TerapiaFarmacologicaRicovero/performer"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="identifier"/>
                <source>
                  <context value="assEnty"/>
                  <element value="id"/>
                  <variable value="id"/>
                </source>
                <target>
                  <context value="practitioner"/>
                  <contextType value="variable"/>
                  <element value="identifier"/>
                  <variable value="identifier"/>
                </target>
                <rule>
                  <name value="root1"/>
                  <source>
                    <context value="id"/>
                    <element value="root"/>
                    <variable value="r"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="system"/>
                    <transform value="translate"/>
                    <parameter>
                      <valueId value="r"/>
                    </parameter>
                    <parameter>
                      <valueString
                                   value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                    </parameter>
                    <parameter>
                      <valueString value="uri"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="extension"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="ext"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="assigningAuthorityName"/>
                  <source>
                    <context value="id"/>
                    <element value="assigningAuthorityName"/>
                    <variable value="s"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="assigner"/>
                    <variable value="a"/>
                  </target>
                  <target>
                    <context value="a"/>
                    <contextType value="variable"/>
                    <element value="display"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="s"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="r"/>
                  <source>
                    <context value="id"/>
                    <element value="root"/>
                    <variable value="r"/>
                  </source>
                  <rule>
                    <name value="aut"/>
                    <source>
                      <context value="id"/>
                      <element value="extension"/>
                      <variable value="ext"/>
                    </source>
                    <target>
                      <context value="practitioner"/>
                      <contextType value="variable"/>
                      <element value="id"/>
                      <variable value="uuid2"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="r + '-' + ext"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="e1"/>
                      <contextType value="variable"/>
                      <element value="fullUrl"/>
                      <transform value="append"/>
                      <parameter>
                        <valueString value="https://example/Practitioner/"/>
                      </parameter>
                      <parameter>
                        <valueId value="uuid2"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="request"/>
                      <contextType value="variable"/>
                      <element value="url"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Practitioner"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="medicationAdm"/>
                      <contextType value="variable"/>
                      <element value="performer"/>
                      <variable value="perf"/>
                    </target>
                    <target>
                      <context value="perf"/>
                      <contextType value="variable"/>
                      <element value="actor"/>
                      <variable value="reference"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="Reference"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="reference"/>
                      <contextType value="variable"/>
                      <element value="reference"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString
                                     value="'https://example/Practitioner/' + %practitioner.id"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="2.16.840.1.113883.2.9.4.3.2"/>
                <source>
                  <context value="assEnty"/>
                  <element value="id"/>
                  <variable value="id"/>
                  <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
                </source>
                <rule>
                  <name value="UUID"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="url"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="Practitioner?identifier="/>
                    </parameter>
                    <parameter>
                      <valueId value="ext"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="diverso"/>
                <source>
                  <context value="assEnty"/>
                  <element value="id"/>
                  <variable value="id"/>
                  <condition value="(root != '2.16.840.1.113883.2.9.4.3.2')"/>
                </source>
                <rule>
                  <name value="UUID"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="url"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="Practitioner?identifier="/>
                    </parameter>
                    <parameter>
                      <valueId value="ext"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="assi"/>
                <source>
                  <context value="assEnty"/>
                  <element value="assignedPerson"/>
                  <variable value="assi"/>
                </source>
                <rule>
                  <name value="name"/>
                  <source>
                    <context value="assi"/>
                    <element value="name"/>
                    <variable value="vvv"/>
                  </source>
                  <target>
                    <context value="practitioner"/>
                    <contextType value="variable"/>
                    <element value="name"/>
                    <variable value="vvv"/>
                    <transform value="create"/>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="reference"/>
            <source>
              <context value="tx"/>
              <element value="reference"/>
              <variable value="ref"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="ref.value"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="sa"/>
            <element value="statusCode"/>
            <variable value="st"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="st.code"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="period"/>
          <source>
            <context value="sa"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="effective"/>
            <variable value="period"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Period"/>
            </parameter>
          </target>
          <dependent>
            <name value="IVLTSPeriod"/>
            <variable value="eff"/>
            <variable value="period"/>
          </dependent>
        </rule>
        <rule>
          <name value="dos"/>
          <source>
            <context value="sa"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="dosage"/>
            <variable value="dos"/>
          </target>
          <rule>
            <name value="routeCode"/>
            <source>
              <context value="sa"/>
              <element value="routeCode"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="dos"/>
              <contextType value="variable"/>
              <element value="route"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="dos"/>
          <source>
            <context value="sa"/>
          </source>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="dosage"/>
            <variable value="dos"/>
          </target>
          <rule>
            <name value="approachSiteCode"/>
            <source>
              <context value="sa"/>
              <element value="approachSiteCode"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="dos"/>
              <contextType value="variable"/>
              <element value="site"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="sa"/>
          <source>
            <context value="sa"/>
            <element value="doseQuantity"/>
            <variable value="doseQuant"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e1"/>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="request"/>
            <variable value="request"/>
            <transform value="create"/>
            <parameter>
              <valueString value="BackboneElement"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="method"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="POST"/>
            </parameter>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="medicationRq"/>
            <transform value="create"/>
            <parameter>
              <valueString value="MedicationRequest"/>
            </parameter>
          </target>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid1"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="https://example/MedicationRequest/"/>
            </parameter>
            <parameter>
              <valueId value="uuid1"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="MedicationRequest"/>
            </parameter>
          </target>
          <target>
            <context value="medicationAdm"/>
            <contextType value="variable"/>
            <element value="request"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString
                           value="'https://example/MedicationRequest/' + %medicationRq.id"/>
            </parameter>
          </target>
          <rule>
            <name value="Dosage"/>
            <source>
              <context value="doseQuant"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="dosageInstruction"/>
              <variable value="dosageInstruction"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Dosage"/>
              </parameter>
            </target>
            <rule>
              <name value="ot"/>
              <source>
                <context value="doseQuant"/>
                <element value="originalText"/>
                <variable value="ot"/>
              </source>
              <rule>
                <name value="reference"/>
                <source>
                  <context value="ot"/>
                  <element value="reference"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="dosageInstruction"/>
                  <contextType value="variable"/>
                  <element value="text"/>
                  <variable value="vvv"/>
                  <transform value="create"/>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="dosageRate"/>
              <source>
                <context value="doseQuant"/>
              </source>
              <target>
                <context value="dosageInstruction"/>
                <contextType value="variable"/>
                <element value="doseAndRate"/>
                <variable value="dosageRate"/>
              </target>
              <rule>
                <name value="d"/>
                <source>
                  <context value="doseQuant"/>
                </source>
                <target>
                  <context value="dosageRate"/>
                  <contextType value="variable"/>
                  <element value="dose"/>
                  <variable value="d"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Range"/>
                  </parameter>
                </target>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="doseQuant"/>
                  </source>
                  <target>
                    <context value="d"/>
                    <contextType value="variable"/>
                    <element value="low"/>
                    <variable value="l"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="SimpleQuantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="low"/>
                    <source>
                      <context value="doseQuant"/>
                      <element value="low"/>
                      <variable value="lo"/>
                    </source>
                    <target>
                      <context value="l"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="lo.value"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="low"/>
                    <source>
                      <context value="doseQuant"/>
                      <element value="low"/>
                      <variable value="lo"/>
                    </source>
                    <target>
                      <context value="l"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="lo.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="doseQuant"/>
                  </source>
                  <target>
                    <context value="d"/>
                    <contextType value="variable"/>
                    <element value="high"/>
                    <variable value="h"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="SimpleQuantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="high"/>
                    <source>
                      <context value="doseQuant"/>
                      <element value="high"/>
                      <variable value="hi"/>
                    </source>
                    <target>
                      <context value="h"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="hi.value"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="high"/>
                    <source>
                      <context value="doseQuant"/>
                      <element value="high"/>
                      <variable value="hi"/>
                    </source>
                    <target>
                      <context value="h"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="hi.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="reference"/>
            <source>
              <context value="sa"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="subject"/>
              <variable value="reference"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="reference"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString
                             value="'https://example/Patient/' + %patient.id"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="reference"/>
            <source>
              <context value="sa"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="encounter"/>
              <variable value="reference"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="reference"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="'https://example/Encounter/' + %enc.id"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="status"/>
            <source>
              <context value="sa"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="active"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="intent"/>
            <source>
              <context value="sa"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="intent"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="order"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="Dosage"/>
            <source>
              <context value="sa"/>
              <element value="rateQuantity"/>
              <variable value="rateQuantity"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="dosageInstruction"/>
              <variable value="dosageInstruction1"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Dosage"/>
              </parameter>
            </target>
            <rule>
              <name value="ot"/>
              <source>
                <context value="rateQuantity"/>
                <element value="originalText"/>
                <variable value="ot"/>
              </source>
              <rule>
                <name value="reference"/>
                <source>
                  <context value="ot"/>
                  <element value="reference"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="dosageInstruction1"/>
                  <contextType value="variable"/>
                  <element value="text"/>
                  <variable value="vvv"/>
                  <transform value="create"/>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="dosageRate"/>
              <source>
                <context value="rateQuantity"/>
              </source>
              <target>
                <context value="dosageInstruction1"/>
                <contextType value="variable"/>
                <element value="doseAndRate"/>
                <variable value="dosageRate"/>
              </target>
              <rule>
                <name value="d"/>
                <source>
                  <context value="rateQuantity"/>
                </source>
                <target>
                  <context value="dosageRate"/>
                  <contextType value="variable"/>
                  <element value="rate"/>
                  <variable value="d"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Range"/>
                  </parameter>
                </target>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="rateQuantity"/>
                  </source>
                  <target>
                    <context value="d"/>
                    <contextType value="variable"/>
                    <element value="low"/>
                    <variable value="l"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="SimpleQuantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="low"/>
                    <source>
                      <context value="rateQuantity"/>
                      <element value="low"/>
                      <variable value="lo"/>
                    </source>
                    <target>
                      <context value="l"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="lo.value"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="low"/>
                    <source>
                      <context value="rateQuantity"/>
                      <element value="low"/>
                      <variable value="lo"/>
                    </source>
                    <target>
                      <context value="l"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="lo.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="rateQuantity"/>
                  </source>
                  <target>
                    <context value="d"/>
                    <contextType value="variable"/>
                    <element value="high"/>
                    <variable value="h"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="SimpleQuantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="high"/>
                    <source>
                      <context value="rateQuantity"/>
                      <element value="high"/>
                      <variable value="hi"/>
                    </source>
                    <target>
                      <context value="h"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="hi.value"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="high"/>
                    <source>
                      <context value="rateQuantity"/>
                      <element value="high"/>
                      <variable value="hi"/>
                    </source>
                    <target>
                      <context value="h"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="hi.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="medication"/>
            <source>
              <context value="sa"/>
            </source>
            <target>
              <context value="bundle"/>
              <contextType value="variable"/>
              <element value="entry"/>
              <variable value="e1"/>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="request"/>
              <variable value="request"/>
              <transform value="create"/>
              <parameter>
                <valueString value="BackboneElement"/>
              </parameter>
            </target>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="method"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="POST"/>
              </parameter>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <variable value="medication"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Medication"/>
              </parameter>
            </target>
            <target>
              <context value="medication"/>
              <contextType value="variable"/>
              <element value="id"/>
              <variable value="uuid1"/>
              <transform value="uuid"/>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="fullUrl"/>
              <transform value="append"/>
              <parameter>
                <valueString value="https://example/Medication/"/>
              </parameter>
              <parameter>
                <valueId value="uuid1"/>
              </parameter>
            </target>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Medication"/>
              </parameter>
            </target>
            <target>
              <context value="medicationAdm"/>
              <contextType value="variable"/>
              <element value="medication"/>
              <variable value="reference"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="reference"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString
                             value="'https://example/Medication/' + %medication.id"/>
              </parameter>
            </target>
            <rule>
              <name value="reference"/>
              <source>
                <context value="sa"/>
              </source>
              <target>
                <context value="medicationRq"/>
                <contextType value="variable"/>
                <element value="medication"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Medication/' + %medication.id"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="administrationUnitCode"/>
              <source>
                <context value="sa"/>
                <element value="administrationUnitCode"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="medication"/>
                <contextType value="variable"/>
                <element value="form"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
            <rule>
              <name value="consumable"/>
              <source>
                <context value="sa"/>
                <element value="consumable"/>
                <variable value="consumable"/>
              </source>
              <rule>
                <name value="manufac"/>
                <source>
                  <context value="consumable"/>
                  <element value="manufacturedProduct"/>
                  <variable value="manufac"/>
                </source>
                <rule>
                  <name value="manufactproduct"/>
                  <source>
                    <context value="manufac"/>
                    <element value="manufacturedMaterial"/>
                    <variable value="manuprod"/>
                  </source>
                  <rule>
                    <name value="code"/>
                    <source>
                      <context value="manuprod"/>
                      <element value="code"/>
                      <variable value="vvv"/>
                    </source>
                    <target>
                      <context value="medication"/>
                      <contextType value="variable"/>
                      <element value="code"/>
                      <variable value="vvv"/>
                      <transform value="create"/>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="entryRr"/>
              <source>
                <context value="sa"/>
                <element value="entryRelationship"/>
                <variable value="entryRR"/>
              </source>
              <rule>
                <name value="obs"/>
                <source>
                  <context value="entryRR"/>
                  <element value="observation"/>
                  <variable value="observation"/>
                </source>
                <rule>
                  <name value="ingredient"/>
                  <source>
                    <context value="observation"/>
                    <element value="code"/>
                    <condition value="displayName = 'Grammatura'"/>
                  </source>
                  <target>
                    <context value="medication"/>
                    <contextType value="variable"/>
                    <element value="ingredient"/>
                    <variable value="ingredient"/>
                  </target>
                  <rule>
                    <name value="consumable"/>
                    <source>
                      <context value="sa"/>
                      <element value="consumable"/>
                      <variable value="consumable"/>
                    </source>
                    <rule>
                      <name value="product"/>
                      <source>
                        <context value="consumable"/>
                        <element value="manufacturedProduct"/>
                        <variable value="manufacturedProduct"/>
                      </source>
                      <rule>
                        <name value="material"/>
                        <source>
                          <context value="manufacturedProduct"/>
                          <element value="manufacturedMaterial"/>
                          <variable value="manufacturedMaterial"/>
                        </source>
                        <rule>
                          <name value="CE"/>
                          <source>
                            <context value="manufacturedMaterial"/>
                            <element value="code"/>
                            <variable value="code"/>
                          </source>
                          <target>
                            <context value="ingredient"/>
                            <contextType value="variable"/>
                            <element value="item"/>
                            <variable value="value"/>
                            <transform value="create"/>
                            <parameter>
                              <valueString value="CodeableConcept"/>
                            </parameter>
                          </target>
                          <dependent>
                            <name value="CECodeableConcept"/>
                            <variable value="code"/>
                            <variable value="value"/>
                          </dependent>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="strenght"/>
                    <source>
                      <context value="observation"/>
                      <element value="value"/>
                      <variable value="value"/>
                    </source>
                    <target>
                      <context value="ingredient"/>
                      <contextType value="variable"/>
                      <element value="strength"/>
                      <variable value="strength"/>
                    </target>
                    <rule>
                      <name value="numerator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="strength"/>
                        <contextType value="variable"/>
                        <element value="numerator"/>
                        <variable value="numerator"/>
                      </target>
                      <rule>
                        <name value="valueN"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="numerator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="evaluate"/>
                          <parameter>
                            <valueString value="value.value"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                    <rule>
                      <name value="denominator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="strength"/>
                        <contextType value="variable"/>
                        <element value="denominator"/>
                        <variable value="denominator"/>
                      </target>
                      <rule>
                        <name value="valueD"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="denominator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueInteger value="1"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                  </rule>
                </rule>
                <rule>
                  <name value="quantita"/>
                  <source>
                    <context value="observation"/>
                    <element value="code"/>
                    <condition
                               value="displayName = 'Quantità nella Confezione'"/>
                  </source>
                  <rule>
                    <name value="amount"/>
                    <source>
                      <context value="observation"/>
                      <element value="value"/>
                      <variable value="value"/>
                    </source>
                    <target>
                      <context value="medication"/>
                      <contextType value="variable"/>
                      <element value="amount"/>
                      <variable value="amount"/>
                    </target>
                    <rule>
                      <name value="numerator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="amount"/>
                        <contextType value="variable"/>
                        <element value="numerator"/>
                        <variable value="numerator"/>
                      </target>
                      <rule>
                        <name value="valueN"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="numerator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="evaluate"/>
                          <parameter>
                            <valueString value="value.value"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                    <rule>
                      <name value="denominator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="amount"/>
                        <contextType value="variable"/>
                        <element value="denominator"/>
                        <variable value="denominator"/>
                      </target>
                      <rule>
                        <name value="valueD"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="denominator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueInteger value="1"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="entryR"/>
            <source>
              <context value="sa"/>
              <element value="entryRelationship"/>
              <variable value="entryRelationship"/>
            </source>
            <rule>
              <name value="sub"/>
              <source>
                <context value="entryRelationship"/>
                <element value="supply"/>
                <variable value="sup"/>
              </source>
              <target>
                <context value="medicationRq"/>
                <contextType value="variable"/>
                <element value="dispenseRequest"/>
                <variable value="dispreq"/>
              </target>
              <rule>
                <name value="quantity"/>
                <source>
                  <context value="sup"/>
                </source>
                <target>
                  <context value="dispreq"/>
                  <contextType value="variable"/>
                  <element value="quantity"/>
                  <variable value="quantity"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="SimpleQuantity"/>
                  </parameter>
                </target>
                <rule>
                  <name value="quantity"/>
                  <source>
                    <context value="sup"/>
                    <element value="quantity"/>
                    <variable value="q"/>
                  </source>
                  <target>
                    <context value="quantity"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="q.value"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="Medicationrequest"/>
            <source>
              <context value="sa"/>
              <element value="participant"/>
              <variable value="participant"/>
            </source>
            <rule>
              <name value="time"/>
              <source>
                <context value="participant"/>
                <element value="time"/>
                <variable value="t"/>
              </source>
              <target>
                <context value="medicationRq"/>
                <contextType value="variable"/>
                <element value="authoredOn"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="t.value"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="perf"/>
              <source>
                <context value="participant"/>
                <element value="participantRole"/>
                <variable value="participantR"/>
              </source>
              <target>
                <context value="bundle"/>
                <contextType value="variable"/>
                <element value="entry"/>
                <variable value="e1"/>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="request"/>
                <variable value="request"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="BackboneElement"/>
                </parameter>
              </target>
              <target>
                <context value="request"/>
                <contextType value="variable"/>
                <element value="method"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="PUT"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="resource"/>
                <variable value="practitioner"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Practitioner"/>
                </parameter>
              </target>
              <rule>
                <name value="meta"/>
                <source>
                  <context value="participantR"/>
                </source>
                <target>
                  <context value="practitioner"/>
                  <contextType value="variable"/>
                  <element value="meta"/>
                  <variable value="meta"/>
                </target>
                <rule>
                  <name value="coding"/>
                  <source>
                    <context value="participantR"/>
                  </source>
                  <target>
                    <context value="meta"/>
                    <contextType value="variable"/>
                    <element value="tag"/>
                    <variable value="coding"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Coding"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="system"/>
                    <source>
                      <context value="participantR"/>
                    </source>
                    <target>
                      <context value="coding"/>
                      <contextType value="variable"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://algoritmodiscoring"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="code"/>
                    <source>
                      <context value="participantR"/>
                    </source>
                    <target>
                      <context value="coding"/>
                      <contextType value="variable"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="ClinicalDocument/body/TerapiaFarmacologicaRicovero/participant"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="identifier"/>
                <source>
                  <context value="participantR"/>
                  <element value="id"/>
                  <variable value="id"/>
                </source>
                <target>
                  <context value="practitioner"/>
                  <contextType value="variable"/>
                  <element value="identifier"/>
                  <variable value="identifier"/>
                </target>
                <rule>
                  <name value="root1"/>
                  <source>
                    <context value="id"/>
                    <element value="root"/>
                    <variable value="r"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="system"/>
                    <transform value="translate"/>
                    <parameter>
                      <valueId value="r"/>
                    </parameter>
                    <parameter>
                      <valueString
                                   value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                    </parameter>
                    <parameter>
                      <valueString value="uri"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="extension"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="ext"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="assigningAuthorityName"/>
                  <source>
                    <context value="id"/>
                    <element value="assigningAuthorityName"/>
                    <variable value="s"/>
                  </source>
                  <target>
                    <context value="identifier"/>
                    <contextType value="variable"/>
                    <element value="assigner"/>
                    <variable value="a"/>
                  </target>
                  <target>
                    <context value="a"/>
                    <contextType value="variable"/>
                    <element value="display"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="s"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="r"/>
                  <source>
                    <context value="id"/>
                    <element value="root"/>
                    <variable value="r"/>
                  </source>
                  <rule>
                    <name value="aut"/>
                    <source>
                      <context value="id"/>
                      <element value="extension"/>
                      <variable value="ext"/>
                    </source>
                    <target>
                      <context value="practitioner"/>
                      <contextType value="variable"/>
                      <element value="id"/>
                      <variable value="uuid2"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="r + '-' + ext"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="e1"/>
                      <contextType value="variable"/>
                      <element value="fullUrl"/>
                      <transform value="append"/>
                      <parameter>
                        <valueString value="https://example/Practitioner/"/>
                      </parameter>
                      <parameter>
                        <valueId value="uuid2"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="request"/>
                      <contextType value="variable"/>
                      <element value="url"/>
                      <transform value="append"/>
                      <parameter>
                        <valueString value="Practitioner/"/>
                      </parameter>
                      <parameter>
                        <valueId value="uuid1"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="medicationRq"/>
                      <contextType value="variable"/>
                      <element value="requester"/>
                      <variable value="reference"/>
                      <transform value="create"/>
                      <parameter>
                        <valueString value="Reference"/>
                      </parameter>
                    </target>
                    <target>
                      <context value="reference"/>
                      <contextType value="variable"/>
                      <element value="reference"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString
                                     value="'https://example/Practitioner/' + %practitioner.id"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="2.16.840.1.113883.2.9.4.3.2"/>
                <source>
                  <context value="participantR"/>
                  <element value="id"/>
                  <variable value="id"/>
                  <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
                </source>
                <rule>
                  <name value="UUID"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="url"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="Practitioner?identifier="/>
                    </parameter>
                    <parameter>
                      <valueId value="ext"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="assi"/>
                <source>
                  <context value="participantR"/>
                  <element value="playingEntity"/>
                  <variable value="assi"/>
                </source>
                <rule>
                  <name value="name"/>
                  <source>
                    <context value="assi"/>
                    <element value="name"/>
                    <variable value="vvv"/>
                  </source>
                  <target>
                    <context value="practitioner"/>
                    <contextType value="variable"/>
                    <element value="name"/>
                    <variable value="vvv"/>
                    <transform value="create"/>
                  </target>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="period"/>
              <source>
                <context value="sa"/>
                <type value="EIVL"/>
                <element value="effectiveTime"/>
                <variable value="eff"/>
              </source>
              <target>
                <context value="medicationRq"/>
                <contextType value="variable"/>
                <element value="dosageInstruction"/>
                <variable value="dosage"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Dosage"/>
                </parameter>
              </target>
              <rule>
                <name value="timing"/>
                <source>
                  <context value="eff"/>
                </source>
                <target>
                  <context value="dosage"/>
                  <contextType value="variable"/>
                  <element value="timing"/>
                  <variable value="timing"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Timing"/>
                  </parameter>
                </target>
                <rule>
                  <name value="rep"/>
                  <source>
                    <context value="eff"/>
                  </source>
                  <target>
                    <context value="timing"/>
                    <contextType value="variable"/>
                    <element value="repeat"/>
                    <variable value="rep"/>
                  </target>
                  <rule>
                    <name value="event"/>
                    <source>
                      <context value="eff"/>
                      <element value="event"/>
                      <variable value="ev"/>
                    </source>
                    <target>
                      <context value="rep"/>
                      <contextType value="variable"/>
                      <element value="where"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="ev.code"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="tim"/>
              <source>
                <context value="sa"/>
                <type value="TS"/>
                <element value="effectiveTime"/>
                <variable value="eff"/>
              </source>
              <target>
                <context value="medicationRq"/>
                <contextType value="variable"/>
                <element value="dosageInstruction"/>
                <variable value="dosage"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Dosage"/>
                </parameter>
              </target>
              <target>
                <context value="dosage"/>
                <contextType value="variable"/>
                <element value="timing"/>
                <variable value="timing"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Timing"/>
                </parameter>
              </target>
              <target>
                <context value="timing"/>
                <contextType value="variable"/>
                <element value="event"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="eff.value"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="eff"/>
              <source>
                <context value="sa"/>
                <type value="PIVL_TS"/>
                <element value="effectiveTime"/>
                <variable value="eff"/>
              </source>
              <target>
                <context value="medicationAdm"/>
                <contextType value="variable"/>
                <element value="dosage"/>
                <variable value="dosage"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="BackboneElement"/>
                </parameter>
              </target>
              <rule>
                <name value="ratio"/>
                <source>
                  <context value="eff"/>
                </source>
                <target>
                  <context value="dosage"/>
                  <contextType value="variable"/>
                  <element value="rate"/>
                  <variable value="ratio"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Ratio"/>
                  </parameter>
                </target>
                <rule>
                  <name value="quanti"/>
                  <source>
                    <context value="eff"/>
                  </source>
                  <target>
                    <context value="ratio"/>
                    <contextType value="variable"/>
                    <element value="numerator"/>
                    <variable value="quan"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Quantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="period"/>
                    <source>
                      <context value="eff"/>
                      <element value="period"/>
                      <variable value="per"/>
                    </source>
                    <target>
                      <context value="quan"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="per.value"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="period"/>
                    <source>
                      <context value="eff"/>
                      <element value="period"/>
                      <variable value="per"/>
                    </source>
                    <target>
                      <context value="quan"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="per.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <rule>
                  <name value="quanti"/>
                  <source>
                    <context value="eff"/>
                  </source>
                  <target>
                    <context value="ratio"/>
                    <contextType value="variable"/>
                    <element value="denominator"/>
                    <variable value="quan"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Quantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="period"/>
                    <source>
                      <context value="eff"/>
                      <element value="period"/>
                    </source>
                    <target>
                      <context value="quan"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="1"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="period"/>
                    <source>
                      <context value="eff"/>
                      <element value="period"/>
                      <variable value="per"/>
                    </source>
                    <target>
                      <context value="quan"/>
                      <contextType value="variable"/>
                      <element value="unit"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="per.unit"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSottoSectionOBS"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/Observation/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/Observation/' + %observation.id"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="narrativeStatus"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="generated"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="narrativeText"/>
        <source>
          <context value="cdaText"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="fhirText"/>
          <contextType value="variable"/>
          <element value="div"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="t"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="code"/>
        <source>
          <context value="src"/>
          <element value="code"/>
          <variable value="vvv"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="code"/>
          <variable value="vvv"/>
          <transform value="create"/>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="statuscode"/>
        <source>
          <context value="src"/>
          <condition value="observation.statusCode.exists().not()"/>
        </source>
        <rule>
          <name value="status"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="observation"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="final"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="observation"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSottoSectionMS"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="cdaText"/>
      <source>
        <context value="src"/>
        <element value="text"/>
        <variable value="cdaText"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="Medicationstatement"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationStatement"/>
        </parameter>
      </target>
      <target>
        <context value="Medicationstatement"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/MedicationStatement/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="MedicationStatement"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/MedicationStatement/' + %Medicationstatement.id"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="text"/>
        <variable value="fhirText"/>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="cdaText"/>
        </source>
        <target>
          <context value="Medicationstatement"/>
          <contextType value="variable"/>
          <element value="note"/>
          <variable value="note"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="text"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="Medicationstatement"/>
            <contextType value="variable"/>
            <element value="medication"/>
            <variable value="medication"/>
            <transform value="create"/>
            <parameter>
              <valueString value="CodeableConcept"/>
            </parameter>
          </target>
          <target>
            <context value="medication"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="Medicationstatement"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="status"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="Medicationstatement"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="unknown"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="Observation"/>
    <typeMode value="none"/>
    <input>
      <name value="obs"/>
      <type value="Observation"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="encounter"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="ob"/>
      <type value="Observation"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Patient/' + %patient.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Encounter/' + %encounter.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="obs"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'completed')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'active')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="registered"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'aborted')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="cancelled"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'suspended')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="partial"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statuscode"/>
      <source>
        <context value="obs"/>
        <condition value="obs.statusCode.exists().not()"/>
      </source>
      <rule>
        <name value="status"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="final"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="value2"/>
      <source>
        <context value="obs"/>
        <element value="effectiveTime"/>
        <variable value="effectiveTime"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <variable value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="dateTime"/>
        </parameter>
      </target>
      <dependent>
        <name value="TSDateTime"/>
        <variable value="effectiveTime"/>
        <variable value="value"/>
      </dependent>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="obs"/>
        <condition
                   value="effectiveTime.low.exists() or effectiveTime.high.exists()"/>
      </source>
      <rule>
        <name value="value3"/>
        <source>
          <context value="obs"/>
          <element value="effectiveTime"/>
          <variable value="eff"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="effective"/>
          <variable value="period"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Period"/>
          </parameter>
        </target>
        <dependent>
          <name value="IVLTSPeriod"/>
          <variable value="eff"/>
          <variable value="period"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="INT"/>
        <element value="value"/>
        <variable value="int"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="int.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="boolean"/>
      <source>
        <context value="obs"/>
        <type value="BL"/>
        <element value="value"/>
        <variable value="boolean"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="boolean.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CD"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originalText"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="text"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CE"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originalText"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="text"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="valueQuantity"/>
      <source>
        <context value="obs"/>
        <type value="PQ"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="quantity"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="quantity"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Quantity"/>
          </parameter>
        </target>
        <rule>
          <name value="value"/>
          <source>
            <context value="val"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="value"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="unit"/>
          <source>
            <context value="val"/>
            <element value="unit"/>
            <variable value="unit"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="unit"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="unit"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="ST"/>
        <element value="value"/>
        <variable value="value"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="string"/>
        </parameter>
      </target>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="value.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="interpretationCode"/>
      <source>
        <context value="obs"/>
        <element value="interpretationCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="interpretation"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="methodCode"/>
      <source>
        <context value="obs"/>
        <element value="methodCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="method"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="refRange"/>
      <source>
        <context value="obs"/>
        <element value="referenceRange"/>
        <variable value="refRange"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="referenceRange"/>
        <variable value="ref"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <rule>
        <name value="obsRange"/>
        <source>
          <context value="refRange"/>
          <element value="observationRange"/>
          <variable value="obsRange"/>
        </source>
        <target>
          <context value="ref"/>
          <contextType value="variable"/>
          <element value="low"/>
          <variable value="Low"/>
          <transform value="create"/>
          <parameter>
            <valueString value="SimpleQuantity"/>
          </parameter>
        </target>
        <rule>
          <name value="IVLPQ"/>
          <source>
            <context value="obsRange"/>
            <type value="IVL_PQ"/>
            <element value="value"/>
            <variable value="v"/>
          </source>
          <rule>
            <name value="decValue"/>
            <source>
              <context value="v"/>
              <element value="low"/>
              <variable value="l1"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="l1"/>
                <element value="value"/>
                <variable value="decValue"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="decValue"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="unit"/>
              <source>
                <context value="l1"/>
                <element value="unit"/>
                <variable value="Unit"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="unit"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="Unit"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ObservationConsulenza"/>
    <typeMode value="none"/>
    <input>
      <name value="obs"/>
      <type value="Observation"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="encounter"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="ob"/>
      <type value="Observation"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Patient/' + %patient.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Encounter/' + %encounter.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="obs"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'completed')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'active')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="registered"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'aborted')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="cancelled"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'suspended')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="partial"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statuscode"/>
      <source>
        <context value="obs"/>
        <condition value="obs.statusCode.exists().not()"/>
      </source>
      <rule>
        <name value="status"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="final"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="value2c"/>
      <source>
        <context value="obs"/>
        <element value="effectiveTime"/>
        <variable value="effectiveTime"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <variable value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="dateTime"/>
        </parameter>
      </target>
      <dependent>
        <name value="TSDateTime"/>
        <variable value="effectiveTime"/>
        <variable value="value"/>
      </dependent>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="obs"/>
        <condition
                   value="effectiveTime.low.exists() or effectiveTime.high.exists()"/>
      </source>
      <rule>
        <name value="value3c"/>
        <source>
          <context value="obs"/>
          <element value="effectiveTime"/>
          <variable value="eff"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="effective"/>
          <variable value="period"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Period"/>
          </parameter>
        </target>
        <dependent>
          <name value="IVLTSPeriod"/>
          <variable value="eff"/>
          <variable value="period"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="INT"/>
        <element value="value"/>
        <variable value="int"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="int.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="boolean"/>
      <source>
        <context value="obs"/>
        <type value="BL"/>
        <element value="value"/>
        <variable value="boolean"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="boolean.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CE"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originltext"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="originalText"/>
          </source>
          <rule>
            <name value="reference"/>
            <source>
              <context value="originalText"/>
              <element value="reference"/>
              <variable value="reference"/>
            </source>
            <target>
              <context value="ce"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="reference"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystemVersion"/>
            <source>
              <context value="val"/>
              <element value="codeSystemVersion"/>
              <variable value="version"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="version"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="version"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystemVersion"/>
            <source>
              <context value="translation"/>
              <element value="codeSystemVersion"/>
              <variable value="version"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="version"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="version"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystemVersion"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystemVersion"/>
                  <variable value="version"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="version"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="version"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CD"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originalText"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="text"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="valueQuantity"/>
      <source>
        <context value="obs"/>
        <type value="PQ"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="quantity"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="quantity"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Quantity"/>
          </parameter>
        </target>
        <rule>
          <name value="value"/>
          <source>
            <context value="val"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="value"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="unit"/>
          <source>
            <context value="val"/>
            <element value="unit"/>
            <variable value="unit"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="unit"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="unit"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="ST"/>
        <element value="value"/>
        <variable value="value"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="string"/>
        </parameter>
      </target>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="value.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Patient/' + %patient.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Encounter/' + %encounter.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="interpretationCode"/>
      <source>
        <context value="obs"/>
        <element value="interpretationCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="interpretation"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="methodCode"/>
      <source>
        <context value="obs"/>
        <element value="methodCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="method"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="refRange"/>
      <source>
        <context value="obs"/>
        <element value="referenceRange"/>
        <variable value="refRange"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="referenceRange"/>
        <variable value="ref"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <rule>
        <name value="obsRange"/>
        <source>
          <context value="refRange"/>
          <element value="observationRange"/>
          <variable value="obsRange"/>
        </source>
        <target>
          <context value="ref"/>
          <contextType value="variable"/>
          <element value="low"/>
          <variable value="Low"/>
          <transform value="create"/>
          <parameter>
            <valueString value="SimpleQuantity"/>
          </parameter>
        </target>
        <rule>
          <name value="IVLPQ"/>
          <source>
            <context value="obsRange"/>
            <type value="IVL_PQ"/>
            <element value="value"/>
            <variable value="v"/>
          </source>
          <rule>
            <name value="decValue"/>
            <source>
              <context value="v"/>
              <element value="low"/>
              <variable value="l1"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="l1"/>
                <element value="value"/>
                <variable value="decValue"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="decValue"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="unit"/>
              <source>
                <context value="l1"/>
                <element value="unit"/>
                <variable value="Unit"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="unit"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="Unit"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="perf"/>
      <source>
        <context value="obs"/>
        <element value="performer"/>
        <variable value="performer"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="PUT"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="practitioner"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Practitioner"/>
        </parameter>
      </target>
      <target>
        <context value="practitioner"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <rule>
        <name value="assEntity"/>
        <source>
          <context value="performer"/>
          <element value="assignedEntity"/>
          <variable value="assEntity"/>
        </source>
        <rule>
          <name value="meta"/>
          <source>
            <context value="assEntity"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="meta"/>
            <variable value="meta"/>
          </target>
          <rule>
            <name value="coding"/>
            <source>
              <context value="assEntity"/>
            </source>
            <target>
              <context value="meta"/>
              <contextType value="variable"/>
              <element value="tag"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="system"/>
              <source>
                <context value="assEntity"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="http://algoritmodiscoring"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="code"/>
              <source>
                <context value="assEntity"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="ClinicalDocument/body/Consulenza/performer"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="identifier"/>
          <source>
            <context value="assEntity"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="identifier"/>
            <variable value="identifier"/>
          </target>
          <rule>
            <name value="root1"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="r"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="extension"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="assigningAuthorityName"/>
            <source>
              <context value="id"/>
              <element value="assigningAuthorityName"/>
              <variable value="s"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="assigner"/>
              <variable value="a"/>
            </target>
            <target>
              <context value="a"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="s"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="r"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <rule>
              <name value="aut"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="id"/>
                <variable value="uuid2"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="r + '-' + ext"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="fullUrl"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="https://example/Practitioner/"/>
                </parameter>
                <parameter>
                  <valueId value="uuid2"/>
                </parameter>
              </target>
              <target>
                <context value="ob"/>
                <contextType value="variable"/>
                <element value="performer"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Practitioner/' + %practitioner.id"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="2.16.840.1.113883.2.9.4.3.2"/>
          <source>
            <context value="assEntity"/>
            <element value="id"/>
            <variable value="id"/>
            <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
          </source>
          <rule>
            <name value="UUID"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="append"/>
              <parameter>
                <valueString value="Practitioner?identifier="/>
              </parameter>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="assi"/>
          <source>
            <context value="assEntity"/>
            <element value="assignedPerson"/>
            <variable value="assi"/>
          </source>
          <rule>
            <name value="name"/>
            <source>
              <context value="assi"/>
              <element value="name"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="name"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="participant"/>
      <source>
        <context value="obs"/>
        <element value="participant"/>
        <variable value="participant"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="serviceRequest"/>
        <transform value="create"/>
        <parameter>
          <valueString value="ServiceRequest"/>
        </parameter>
      </target>
      <target>
        <context value="serviceRequest"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/ServiceRequest/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="ServiceRequest"/>
        </parameter>
      </target>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="basedOn"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/ServiceRequest/' + %serviceRequest.id"/>
        </parameter>
      </target>
      <rule>
        <name value="time"/>
        <source>
          <context value="participant"/>
          <element value="time"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="authoredOn"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="t.value"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Encounter/' + %encounter.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="status"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="active"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="intent"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="intent"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="order"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="participantRole"/>
        <source>
          <context value="participant"/>
          <element value="participantRole"/>
          <variable value="participantRole"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="PUT"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="practitioner"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Practitioner"/>
          </parameter>
        </target>
        <rule>
          <name value="meta"/>
          <source>
            <context value="participantRole"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="meta"/>
            <variable value="meta"/>
          </target>
          <rule>
            <name value="coding"/>
            <source>
              <context value="participantRole"/>
            </source>
            <target>
              <context value="meta"/>
              <contextType value="variable"/>
              <element value="tag"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="system"/>
              <source>
                <context value="participantRole"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="http://algoritmodiscoring"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="code"/>
              <source>
                <context value="participantRole"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="ClinicalDocument/body/Consulenza/participant"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="identifier"/>
          <source>
            <context value="participantRole"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="identifier"/>
            <variable value="identifier"/>
          </target>
          <rule>
            <name value="root1"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="r"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="extension"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="assigningAuthorityName"/>
            <source>
              <context value="id"/>
              <element value="assigningAuthorityName"/>
              <variable value="s"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="assigner"/>
              <variable value="a"/>
            </target>
            <target>
              <context value="a"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="s"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="r"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <rule>
              <name value="aut"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="id"/>
                <variable value="uuid3"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="r + '-' + ext"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="fullUrl"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="https://example/Practitioner/"/>
                </parameter>
                <parameter>
                  <valueId value="uuid3"/>
                </parameter>
              </target>
              <target>
                <context value="serviceRequest"/>
                <contextType value="variable"/>
                <element value="performer"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Practitioner/' + %practitioner.id"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="2.16.840.1.113883.2.9.4.3.2"/>
          <source>
            <context value="participantRole"/>
            <element value="id"/>
            <variable value="id"/>
            <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
          </source>
          <rule>
            <name value="UUID"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="append"/>
              <parameter>
                <valueString value="Practitioner?identifier="/>
              </parameter>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="pe"/>
          <source>
            <context value="participantRole"/>
            <element value="playingEntity"/>
            <variable value="pe"/>
          </source>
          <rule>
            <name value="name"/>
            <source>
              <context value="pe"/>
              <element value="name"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="name"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ObservationEsamiDuranteRicovero"/>
    <typeMode value="none"/>
    <input>
      <name value="obs"/>
      <type value="Observation"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="encounter"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="ob"/>
      <type value="Observation"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Patient/' + %patient.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Encounter/' + %encounter.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="obs"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'completed')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'active')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="registered"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'aborted')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="cancelled"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="obs"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'suspended')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="partial"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statuscode"/>
      <source>
        <context value="obs"/>
        <condition value="obs.statusCode.exists().not()"/>
      </source>
      <rule>
        <name value="status"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="final"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="value2r"/>
      <source>
        <context value="obs"/>
        <element value="effectiveTime"/>
        <variable value="effectiveTime"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <variable value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="dateTime"/>
        </parameter>
      </target>
      <dependent>
        <name value="TSDateTime"/>
        <variable value="effectiveTime"/>
        <variable value="value"/>
      </dependent>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="obs"/>
        <condition
                   value="effectiveTime.low.exists() or effectiveTime.high.exists()"/>
      </source>
      <rule>
        <name value="value3r"/>
        <source>
          <context value="obs"/>
          <element value="effectiveTime"/>
          <variable value="eff"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="effective"/>
          <variable value="period"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Period"/>
          </parameter>
        </target>
        <dependent>
          <name value="IVLTSPeriod"/>
          <variable value="eff"/>
          <variable value="period"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="INT"/>
        <element value="value"/>
        <variable value="int"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="int.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="boolean"/>
      <source>
        <context value="obs"/>
        <type value="BL"/>
        <element value="value"/>
        <variable value="boolean"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="boolean.value"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CE"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originltext"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="originalText"/>
          </source>
          <rule>
            <name value="reference"/>
            <source>
              <context value="originalText"/>
              <element value="reference"/>
              <variable value="reference"/>
            </source>
            <target>
              <context value="ce"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="reference"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystemVersion"/>
            <source>
              <context value="val"/>
              <element value="codeSystemVersion"/>
              <variable value="version"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="version"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="version"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystemVersion"/>
            <source>
              <context value="translation"/>
              <element value="codeSystemVersion"/>
              <variable value="version"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="version"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="version"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystemVersion"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystemVersion"/>
                  <variable value="version"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="version"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="version"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="val"/>
      <source>
        <context value="obs"/>
        <type value="CD"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="coding"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="ce"/>
          <transform value="create"/>
          <parameter>
            <valueString value="CodeableConcept"/>
          </parameter>
        </target>
        <rule>
          <name value="originalText"/>
          <source>
            <context value="val"/>
            <element value="originalText"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="text"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="val"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="val"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="val"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="val"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translation"/>
          <source>
            <context value="val"/>
            <element value="translation"/>
            <variable value="translation"/>
          </source>
          <target>
            <context value="ce"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="translation"/>
              <element value="code"/>
              <variable value="code"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="code"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="codeSystem"/>
            <source>
              <context value="translation"/>
              <element value="codeSystem"/>
              <variable value="system"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="system"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="displayName"/>
            <source>
              <context value="translation"/>
              <element value="displayName"/>
              <variable value="display"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="cast"/>
              <parameter>
                <valueId value="display"/>
              </parameter>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="qualifier"/>
            <source>
              <context value="translation"/>
              <element value="qualifier"/>
              <variable value="qualifier"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="qualifier"/>
                <element value="value"/>
                <variable value="value"/>
              </source>
              <target>
                <context value="ce"/>
                <contextType value="variable"/>
                <element value="coding"/>
                <variable value="coding"/>
              </target>
              <rule>
                <name value="code"/>
                <source>
                  <context value="value"/>
                  <element value="code"/>
                  <variable value="code"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="code"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="codeSystem"/>
                <source>
                  <context value="value"/>
                  <element value="codeSystem"/>
                  <variable value="system"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="system"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="displayName"/>
                <source>
                  <context value="value"/>
                  <element value="displayName"/>
                  <variable value="display"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="cast"/>
                  <parameter>
                    <valueId value="display"/>
                  </parameter>
                  <parameter>
                    <valueString value="string"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="valueQuantity"/>
      <source>
        <context value="obs"/>
        <type value="PQ"/>
        <element value="value"/>
        <variable value="val"/>
      </source>
      <rule>
        <name value="quantity"/>
        <source>
          <context value="val"/>
        </source>
        <target>
          <context value="ob"/>
          <contextType value="variable"/>
          <element value="value"/>
          <variable value="quantity"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Quantity"/>
          </parameter>
        </target>
        <rule>
          <name value="value"/>
          <source>
            <context value="val"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="value"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="unit"/>
          <source>
            <context value="val"/>
            <element value="unit"/>
            <variable value="unit"/>
          </source>
          <target>
            <context value="quantity"/>
            <contextType value="variable"/>
            <element value="unit"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="unit"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="value"/>
      <source>
        <context value="obs"/>
        <type value="ST"/>
        <element value="value"/>
        <variable value="value"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="string"/>
        </parameter>
      </target>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="value.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Patient/' + %patient.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="obs"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/Encounter/' + %encounter.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="interpretationCode"/>
      <source>
        <context value="obs"/>
        <element value="interpretationCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="interpretation"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="methodCode"/>
      <source>
        <context value="obs"/>
        <element value="methodCode"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="method"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="effectiveTime"/>
      <source>
        <context value="obs"/>
        <element value="effectiveTime"/>
        <variable value="eff"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <variable value="per"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Period"/>
        </parameter>
      </target>
      <dependent>
        <name value="IVLTSPeriod"/>
        <variable value="eff"/>
        <variable value="per"/>
      </dependent>
    </rule>
    <rule>
      <name value="refRange"/>
      <source>
        <context value="obs"/>
        <element value="referenceRange"/>
        <variable value="refRange"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="referenceRange"/>
        <variable value="ref"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <rule>
        <name value="obsRange"/>
        <source>
          <context value="refRange"/>
          <element value="observationRange"/>
          <variable value="obsRange"/>
        </source>
        <target>
          <context value="ref"/>
          <contextType value="variable"/>
          <element value="low"/>
          <variable value="Low"/>
          <transform value="create"/>
          <parameter>
            <valueString value="SimpleQuantity"/>
          </parameter>
        </target>
        <rule>
          <name value="IVLPQ"/>
          <source>
            <context value="obsRange"/>
            <type value="IVL_PQ"/>
            <element value="value"/>
            <variable value="v"/>
          </source>
          <rule>
            <name value="decValue"/>
            <source>
              <context value="v"/>
              <element value="low"/>
              <variable value="l1"/>
            </source>
            <rule>
              <name value="value"/>
              <source>
                <context value="l1"/>
                <element value="value"/>
                <variable value="decValue"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="decValue"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="unit"/>
              <source>
                <context value="l1"/>
                <element value="unit"/>
                <variable value="Unit"/>
              </source>
              <target>
                <context value="Low"/>
                <contextType value="variable"/>
                <element value="unit"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="Unit"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="perf"/>
      <source>
        <context value="obs"/>
        <element value="performer"/>
        <variable value="performer"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="PUT"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="practitioner"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Practitioner"/>
        </parameter>
      </target>
      <target>
        <context value="practitioner"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <rule>
        <name value="assEntity"/>
        <source>
          <context value="performer"/>
          <element value="assignedEntity"/>
          <variable value="assEntity"/>
        </source>
        <rule>
          <name value="meta"/>
          <source>
            <context value="assEntity"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="meta"/>
            <variable value="meta"/>
          </target>
          <rule>
            <name value="coding"/>
            <source>
              <context value="assEntity"/>
            </source>
            <target>
              <context value="meta"/>
              <contextType value="variable"/>
              <element value="tag"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="system"/>
              <source>
                <context value="assEntity"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="http://algoritmodiscoring"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="code"/>
              <source>
                <context value="assEntity"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="ClinicalDocument/body/EsamiDuranteRicovero/performer"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="identifier"/>
          <source>
            <context value="assEntity"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="identifier"/>
            <variable value="identifier"/>
          </target>
          <rule>
            <name value="root1"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="r"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="extension"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="assigningAuthorityName"/>
            <source>
              <context value="id"/>
              <element value="assigningAuthorityName"/>
              <variable value="s"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="assigner"/>
              <variable value="a"/>
            </target>
            <target>
              <context value="a"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="s"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="r"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <rule>
              <name value="aut"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="id"/>
                <variable value="uuid2"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="r + '-' + ext"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="fullUrl"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="https://example/Practitioner/"/>
                </parameter>
                <parameter>
                  <valueId value="uuid2"/>
                </parameter>
              </target>
              <target>
                <context value="ob"/>
                <contextType value="variable"/>
                <element value="performer"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Practitioner/' + %practitioner.id"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="2.16.840.1.113883.2.9.4.3.2"/>
          <source>
            <context value="assEntity"/>
            <element value="id"/>
            <variable value="id"/>
            <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
          </source>
          <rule>
            <name value="UUID"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="append"/>
              <parameter>
                <valueString value="Practitioner?identifier="/>
              </parameter>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="assi"/>
          <source>
            <context value="assEntity"/>
            <element value="assignedPerson"/>
            <variable value="assi"/>
          </source>
          <rule>
            <name value="name"/>
            <source>
              <context value="assi"/>
              <element value="name"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="name"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="participant"/>
      <source>
        <context value="obs"/>
        <element value="participant"/>
        <variable value="participant"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="serviceRequest"/>
        <transform value="create"/>
        <parameter>
          <valueString value="ServiceRequest"/>
        </parameter>
      </target>
      <target>
        <context value="serviceRequest"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/ServiceRequest/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="ServiceRequest"/>
        </parameter>
      </target>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="basedOn"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/ServiceRequest/' + %serviceRequest.id"/>
        </parameter>
      </target>
      <rule>
        <name value="time"/>
        <source>
          <context value="participant"/>
          <element value="time"/>
          <variable value="t"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="authoredOn"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="t.value"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/Encounter/' + %encounter.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="status"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="active"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="intent"/>
        <source>
          <context value="obs"/>
        </source>
        <target>
          <context value="serviceRequest"/>
          <contextType value="variable"/>
          <element value="intent"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="order"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="participantRole"/>
        <source>
          <context value="participant"/>
          <element value="participantRole"/>
          <variable value="participantRole"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="PUT"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="practitioner"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Practitioner"/>
          </parameter>
        </target>
        <rule>
          <name value="meta"/>
          <source>
            <context value="participantRole"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="meta"/>
            <variable value="meta"/>
          </target>
          <rule>
            <name value="coding"/>
            <source>
              <context value="participantRole"/>
            </source>
            <target>
              <context value="meta"/>
              <contextType value="variable"/>
              <element value="tag"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="system"/>
              <source>
                <context value="participantRole"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="http://algoritmodiscoring"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="code"/>
              <source>
                <context value="participantRole"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="ClinicalDocument/body/EsamiDuranteRicovero/participant"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="identifier"/>
          <source>
            <context value="participantRole"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="identifier"/>
            <variable value="identifier"/>
          </target>
          <rule>
            <name value="root1"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="r"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
              </parameter>
              <parameter>
                <valueString value="uri"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="extension"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="assigningAuthorityName"/>
            <source>
              <context value="id"/>
              <element value="assigningAuthorityName"/>
              <variable value="s"/>
            </source>
            <target>
              <context value="identifier"/>
              <contextType value="variable"/>
              <element value="assigner"/>
              <variable value="a"/>
            </target>
            <target>
              <context value="a"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="s"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="r"/>
            <source>
              <context value="id"/>
              <element value="root"/>
              <variable value="r"/>
            </source>
            <rule>
              <name value="aut"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="id"/>
                <variable value="uuid3"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString value="r + '-' + ext"/>
                </parameter>
              </target>
              <target>
                <context value="e1"/>
                <contextType value="variable"/>
                <element value="fullUrl"/>
                <transform value="append"/>
                <parameter>
                  <valueString value="https://example/Practitioner/"/>
                </parameter>
                <parameter>
                  <valueId value="uuid3"/>
                </parameter>
              </target>
              <target>
                <context value="serviceRequest"/>
                <contextType value="variable"/>
                <element value="performer"/>
                <variable value="reference"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <target>
                <context value="reference"/>
                <contextType value="variable"/>
                <element value="reference"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueString
                               value="'https://example/Practitioner/' + %practitioner.id"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="2.16.840.1.113883.2.9.4.3.2"/>
          <source>
            <context value="participantRole"/>
            <element value="id"/>
            <variable value="id"/>
            <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
          </source>
          <rule>
            <name value="UUID"/>
            <source>
              <context value="id"/>
              <element value="extension"/>
              <variable value="ext"/>
            </source>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="append"/>
              <parameter>
                <valueString value="Practitioner?identifier="/>
              </parameter>
              <parameter>
                <valueId value="ext"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="pe"/>
          <source>
            <context value="participantRole"/>
            <element value="playingEntity"/>
            <variable value="pe"/>
          </source>
          <rule>
            <name value="name"/>
            <source>
              <context value="pe"/>
              <element value="name"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="name"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="periodTiming"/>
    <typeMode value="none"/>
    <input>
      <name value="effectiveTime"/>
      <type value="PIVL_TS"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="timing"/>
      <type value="Timing"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="repeat"/>
      <source>
        <context value="effectiveTime"/>
      </source>
      <target>
        <context value="timing"/>
        <contextType value="variable"/>
        <element value="repeat"/>
        <variable value="r"/>
      </target>
      <rule>
        <name value="period"/>
        <source>
          <context value="effectiveTime"/>
          <element value="period"/>
          <variable value="p"/>
        </source>
        <target>
          <context value="r"/>
          <contextType value="variable"/>
          <element value="period"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="p.value"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="period"/>
        <source>
          <context value="effectiveTime"/>
          <element value="period"/>
          <variable value="p"/>
        </source>
        <target>
          <context value="r"/>
          <contextType value="variable"/>
          <element value="periodUnit"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="p.unit"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="Act"/>
    <typeMode value="none"/>
    <documentation
                   value="---------------------------------------------------------------------------------------"/>
    <input>
      <name value="cda"/>
      <type value="Act"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="pat"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="ac"/>
      <type value="DiagnosticReport"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="code"/>
      <source>
        <context value="cda"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="ac"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="cda"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'completed')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="cda"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'active')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="registered"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="cda"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'aborted')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="cancelled"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="statusCode"/>
      <source>
        <context value="cda"/>
        <element value="statusCode"/>
        <variable value="statusc"/>
        <condition value="(code = 'suspended')"/>
      </source>
      <target>
        <context value="ob"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="partial"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="value2a"/>
      <source>
        <context value="cda"/>
        <element value="effectiveTime"/>
        <variable value="effectiveTime"/>
      </source>
      <target>
        <context value="ac"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <variable value="value"/>
        <transform value="create"/>
        <parameter>
          <valueString value="dateTime"/>
        </parameter>
      </target>
      <dependent>
        <name value="TSDateTime"/>
        <variable value="effectiveTime"/>
        <variable value="value"/>
      </dependent>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="obs"/>
        <condition
                   value="effectiveTime.low.exists() or effectiveTime.high.exists()"/>
      </source>
      <rule>
        <name value="value3a"/>
        <source>
          <context value="cda"/>
          <element value="effectiveTime"/>
          <variable value="eff"/>
        </source>
        <target>
          <context value="ac"/>
          <contextType value="variable"/>
          <element value="effective"/>
          <variable value="period"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Period"/>
          </parameter>
        </target>
        <dependent>
          <name value="IVLTSPeriod"/>
          <variable value="eff"/>
          <variable value="period"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="ac"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/' + %pat.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="reference"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="ac"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="'https://example/' + %enc.id"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="participant"/>
      <source>
        <context value="cda"/>
        <element value="participant"/>
        <variable value="part"/>
      </source>
      <target>
        <context value="enc"/>
        <contextType value="variable"/>
        <element value="participant"/>
        <variable value="participant"/>
      </target>
      <rule>
        <name value="type"/>
        <source>
          <context value="part"/>
        </source>
        <target>
          <context value="participant"/>
          <contextType value="variable"/>
          <element value="type"/>
          <variable value="type"/>
        </target>
        <rule>
          <name value="codeType"/>
          <source>
            <context value="part"/>
          </source>
          <target>
            <context value="type"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <rule>
            <name value="codice"/>
            <source>
              <context value="part"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="part.typeCode"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="system"/>
            <source>
              <context value="part"/>
            </source>
            <target>
              <context value="coding"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="http://terminology.hl7.org/CodeSystem/v3-ParticipationType"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="participantRole"/>
        <source>
          <context value="part"/>
          <element value="participantRole"/>
          <variable value="participantRole"/>
        </source>
        <target>
          <context value="participant"/>
          <contextType value="variable"/>
          <element value="individual"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <rule>
          <name value="participanRoleBund"/>
          <source>
            <context value="participantRole"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="request"/>
            <variable value="request"/>
            <transform value="create"/>
            <parameter>
              <valueString value="BackboneElement"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="method"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="PUT"/>
            </parameter>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="practitioner"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Practitioner"/>
            </parameter>
          </target>
          <target>
            <context value="practitioner"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid1"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="https://example/Practitioner/"/>
            </parameter>
            <parameter>
              <valueId value="uuid1"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString
                           value="'https://example/Practitioner/' + %practitioner.id"/>
            </parameter>
          </target>
          <rule>
            <name value="meta"/>
            <source>
              <context value="participantRole"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="meta"/>
              <variable value="meta"/>
            </target>
            <rule>
              <name value="coding"/>
              <source>
                <context value="participantRole"/>
              </source>
              <target>
                <context value="meta"/>
                <contextType value="variable"/>
                <element value="tag"/>
                <variable value="coding"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Coding"/>
                </parameter>
              </target>
              <rule>
                <name value="system"/>
                <source>
                  <context value="participantRole"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="http://algoritmodiscoring"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="code"/>
                <source>
                  <context value="participantRole"/>
                </source>
                <target>
                  <context value="coding"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString
                                 value="ClinicalDocument/body/Act/participant"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <rule>
            <name value="identifier"/>
            <source>
              <context value="participantRole"/>
              <element value="id"/>
              <variable value="id"/>
            </source>
            <target>
              <context value="practitioner"/>
              <contextType value="variable"/>
              <element value="identifier"/>
              <variable value="identifier"/>
            </target>
            <rule>
              <name value="root1"/>
              <source>
                <context value="id"/>
                <element value="root"/>
                <variable value="r"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="translate"/>
                <parameter>
                  <valueId value="r"/>
                </parameter>
                <parameter>
                  <valueString
                               value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                </parameter>
                <parameter>
                  <valueString value="uri"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="ext"/>
              <source>
                <context value="id"/>
                <element value="extension"/>
                <variable value="ext"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="ext"/>
                </parameter>
              </target>
              <rule>
                <name value="UUID"/>
                <source>
                  <context value="participantRole"/>
                </source>
                <target>
                  <context value="request"/>
                  <contextType value="variable"/>
                  <element value="url"/>
                  <transform value="append"/>
                  <parameter>
                    <valueString value="Practitioner?identifier="/>
                  </parameter>
                  <parameter>
                    <valueId value="ext"/>
                  </parameter>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="assigningAuthorityName"/>
              <source>
                <context value="id"/>
                <element value="assigningAuthorityName"/>
                <variable value="s"/>
              </source>
              <target>
                <context value="identifier"/>
                <contextType value="variable"/>
                <element value="assigner"/>
                <variable value="a"/>
              </target>
              <target>
                <context value="a"/>
                <contextType value="variable"/>
                <element value="display"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="s"/>
                </parameter>
              </target>
            </rule>
          </rule>
          <rule>
            <name value="playingEntity"/>
            <source>
              <context value="participantRole"/>
              <element value="playingEntity"/>
              <variable value="playingEntity"/>
            </source>
            <rule>
              <name value="name"/>
              <source>
                <context value="playingEntity"/>
                <element value="name"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="name"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="entryRelationship"/>
      <source>
        <context value="cda"/>
        <element value="entryRelationship"/>
        <variable value="entryRelationship"/>
      </source>
      <rule>
        <name value="OBS"/>
        <source>
          <context value="entryRelationship"/>
          <element value="observation"/>
          <variable value="observation"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e"/>
        </target>
        <target>
          <context value="e"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="obs"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Observation"/>
          </parameter>
        </target>
        <target>
          <context value="obs"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid2"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid2"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="append"/>
          <parameter>
            <valueString value="Observation/"/>
          </parameter>
          <parameter>
            <valueId value="uuid2"/>
          </parameter>
        </target>
        <target>
          <context value="ac"/>
          <contextType value="variable"/>
          <element value="result"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Observation/' + %obs.id"/>
          </parameter>
        </target>
        <dependent>
          <name value="Observation"/>
          <variable value="observation"/>
          <variable value="pat"/>
          <variable value="enc"/>
          <variable value="obs"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentSectionTerapiaDimissione"/>
    <typeMode value="none"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="enc"/>
      <type value="Encounter"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="title"/>
      <source>
        <context value="src"/>
        <element value="title"/>
        <variable value="t"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="title"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="t.dataString"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="code"/>
      <source>
        <context value="src"/>
        <element value="code"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
    </rule>
    <rule>
      <name value="exist"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="text"/>
          <variable value="fhirText"/>
        </target>
        <rule>
          <name value="narrativeStatus"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="generated"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="narrativeText"/>
          <source>
            <context value="cdaText"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="fhirText"/>
            <contextType value="variable"/>
            <element value="div"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="where"/>
      <source>
        <context value="src"/>
        <condition value="src.entry.exists().not()"/>
      </source>
      <rule>
        <name value="cdaText"/>
        <source>
          <context value="src"/>
          <element value="text"/>
          <variable value="cdaText"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e1"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="request"/>
          <variable value="request"/>
          <transform value="create"/>
          <parameter>
            <valueString value="BackboneElement"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="method"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="POST"/>
          </parameter>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="medicationRq"/>
          <transform value="create"/>
          <parameter>
            <valueString value="MedicationRequest"/>
          </parameter>
        </target>
        <target>
          <context value="medicationRq"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid1"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e1"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="https://example/MedicationRequest/"/>
          </parameter>
          <parameter>
            <valueId value="uuid1"/>
          </parameter>
        </target>
        <target>
          <context value="request"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="MedicationRequest"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString
                         value="'https://example/MedicationRequest/' + %medicationRq.id"/>
          </parameter>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Patient/' + %patient.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="encounter"/>
            <variable value="reference"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <target>
            <context value="reference"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="'https://example/Encounter/' + %enc.id"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="status"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="active"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="intent"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="intent"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="order"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="code"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="medication"/>
            <variable value="codecon"/>
            <transform value="create"/>
            <parameter>
              <valueString value="CodeableConcept"/>
            </parameter>
          </target>
          <rule>
            <name value="text"/>
            <source>
              <context value="cdaText"/>
            </source>
            <target>
              <context value="codecon"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="string"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="reference"/>
          <source>
            <context value="cdaText"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="cdaText"/>
              <variable value="t"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="t"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="substract"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="entry1"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e1"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="request"/>
        <variable value="request"/>
        <transform value="create"/>
        <parameter>
          <valueString value="BackboneElement"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="method"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="POST"/>
        </parameter>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="medicationRq"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationRequest"/>
        </parameter>
      </target>
      <target>
        <context value="medicationRq"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid1"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e1"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="https://example/MedicationRequest/"/>
        </parameter>
        <parameter>
          <valueId value="uuid1"/>
        </parameter>
      </target>
      <target>
        <context value="request"/>
        <contextType value="variable"/>
        <element value="url"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="MedicationRequest"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString
                       value="'https://example/MedicationRequest/' + %medicationRq.id"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="medicationRq"/>
          <contextType value="variable"/>
          <element value="subject"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Patient/' + %patient.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="reference"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="medicationRq"/>
          <contextType value="variable"/>
          <element value="encounter"/>
          <variable value="reference"/>
          <transform value="create"/>
          <parameter>
            <valueString value="Reference"/>
          </parameter>
        </target>
        <target>
          <context value="reference"/>
          <contextType value="variable"/>
          <element value="reference"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="'https://example/Encounter/' + %enc.id"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="status"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="medicationRq"/>
          <contextType value="variable"/>
          <element value="status"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="active"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="intent"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="medicationRq"/>
          <contextType value="variable"/>
          <element value="intent"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="order"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="participant"/>
        <source>
          <context value="entry1"/>
          <element value="substanceAdministration"/>
          <variable value="substract"/>
        </source>
        <rule>
          <name value="cons"/>
          <source>
            <context value="substract"/>
            <element value="consumable"/>
            <variable value="cons"/>
          </source>
          <rule>
            <name value="man1"/>
            <source>
              <context value="cons"/>
              <element value="manufacturedProduct"/>
              <variable value="man1"/>
            </source>
            <target>
              <context value="bundle"/>
              <contextType value="variable"/>
              <element value="entry"/>
              <variable value="e1"/>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="request"/>
              <variable value="request"/>
              <transform value="create"/>
              <parameter>
                <valueString value="BackboneElement"/>
              </parameter>
            </target>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="method"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="POST"/>
              </parameter>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="resource"/>
              <variable value="medication"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Medication"/>
              </parameter>
            </target>
            <target>
              <context value="medication"/>
              <contextType value="variable"/>
              <element value="id"/>
              <variable value="uuid1"/>
              <transform value="uuid"/>
            </target>
            <target>
              <context value="e1"/>
              <contextType value="variable"/>
              <element value="fullUrl"/>
              <transform value="append"/>
              <parameter>
                <valueString value="https://example/Medication/"/>
              </parameter>
              <parameter>
                <valueId value="uuid1"/>
              </parameter>
            </target>
            <target>
              <context value="request"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Medication"/>
              </parameter>
            </target>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="medication"/>
              <variable value="medref"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <target>
              <context value="medref"/>
              <contextType value="variable"/>
              <element value="reference"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString
                             value="'https://example/Medication/' + %medication.id"/>
              </parameter>
            </target>
            <rule>
              <name value="mm"/>
              <source>
                <context value="man1"/>
                <element value="manufacturedMaterial"/>
                <variable value="mm"/>
              </source>
              <rule>
                <name value="code"/>
                <source>
                  <context value="mm"/>
                  <element value="code"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="medication"/>
                  <contextType value="variable"/>
                  <element value="code"/>
                  <variable value="vvv"/>
                  <transform value="create"/>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="administrationUnitCode"/>
              <source>
                <context value="substract"/>
                <element value="administrationUnitCode"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="medication"/>
                <contextType value="variable"/>
                <element value="form"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
            <rule>
              <name value="entryR"/>
              <source>
                <context value="substract"/>
                <element value="entryRelationship"/>
                <variable value="entryR"/>
              </source>
              <rule>
                <name value="obs"/>
                <source>
                  <context value="entryR"/>
                  <element value="observation"/>
                  <variable value="observation"/>
                </source>
                <rule>
                  <name value="ingredient"/>
                  <source>
                    <context value="observation"/>
                    <element value="code"/>
                    <condition value="displayName = 'Grammatura'"/>
                  </source>
                  <target>
                    <context value="medication"/>
                    <contextType value="variable"/>
                    <element value="ingredient"/>
                    <variable value="ingredient"/>
                  </target>
                  <rule>
                    <name value="consumable"/>
                    <source>
                      <context value="substract"/>
                      <element value="consumable"/>
                      <variable value="consumable"/>
                    </source>
                    <rule>
                      <name value="product"/>
                      <source>
                        <context value="consumable"/>
                        <element value="manufacturedProduct"/>
                        <variable value="manufacturedProduct"/>
                      </source>
                      <rule>
                        <name value="material"/>
                        <source>
                          <context value="manufacturedProduct"/>
                          <element value="manufacturedMaterial"/>
                          <variable value="manufacturedMaterial"/>
                        </source>
                        <rule>
                          <name value="CE"/>
                          <source>
                            <context value="manufacturedMaterial"/>
                            <element value="code"/>
                            <variable value="code"/>
                          </source>
                          <target>
                            <context value="ingredient"/>
                            <contextType value="variable"/>
                            <element value="item"/>
                            <variable value="value"/>
                            <transform value="create"/>
                            <parameter>
                              <valueString value="CodeableConcept"/>
                            </parameter>
                          </target>
                          <dependent>
                            <name value="CECodeableConcept"/>
                            <variable value="code"/>
                            <variable value="value"/>
                          </dependent>
                        </rule>
                      </rule>
                    </rule>
                  </rule>
                  <rule>
                    <name value="strenght"/>
                    <source>
                      <context value="observation"/>
                      <element value="value"/>
                      <variable value="value"/>
                    </source>
                    <target>
                      <context value="ingredient"/>
                      <contextType value="variable"/>
                      <element value="strength"/>
                      <variable value="strength"/>
                    </target>
                    <rule>
                      <name value="numerator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="strength"/>
                        <contextType value="variable"/>
                        <element value="numerator"/>
                        <variable value="numerator"/>
                      </target>
                      <rule>
                        <name value="valueN"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="numerator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="evaluate"/>
                          <parameter>
                            <valueString value="value.value"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                    <rule>
                      <name value="denominator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="strength"/>
                        <contextType value="variable"/>
                        <element value="denominator"/>
                        <variable value="denominator"/>
                      </target>
                      <rule>
                        <name value="valueD"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="denominator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueInteger value="1"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                  </rule>
                </rule>
                <rule>
                  <name value="quantita"/>
                  <source>
                    <context value="observation"/>
                    <element value="code"/>
                    <condition
                               value="displayName = 'Quantità nella Confezione'"/>
                  </source>
                  <rule>
                    <name value="amount"/>
                    <source>
                      <context value="observation"/>
                      <element value="value"/>
                      <variable value="value"/>
                    </source>
                    <target>
                      <context value="medication"/>
                      <contextType value="variable"/>
                      <element value="amount"/>
                      <variable value="amount"/>
                    </target>
                    <rule>
                      <name value="numerator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="amount"/>
                        <contextType value="variable"/>
                        <element value="numerator"/>
                        <variable value="numerator"/>
                      </target>
                      <rule>
                        <name value="valueN"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="numerator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="evaluate"/>
                          <parameter>
                            <valueString value="value.value"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                    <rule>
                      <name value="denominator"/>
                      <source>
                        <context value="value"/>
                      </source>
                      <target>
                        <context value="amount"/>
                        <contextType value="variable"/>
                        <element value="denominator"/>
                        <variable value="denominator"/>
                      </target>
                      <rule>
                        <name value="valueD"/>
                        <source>
                          <context value="value"/>
                        </source>
                        <target>
                          <context value="denominator"/>
                          <contextType value="variable"/>
                          <element value="value"/>
                          <transform value="copy"/>
                          <parameter>
                            <valueInteger value="1"/>
                          </parameter>
                        </target>
                      </rule>
                    </rule>
                  </rule>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="entry"/>
              <source>
                <context value="substract"/>
                <element value="entryRelationship"/>
                <variable value="entryRelationship"/>
              </source>
              <rule>
                <name value="sub"/>
                <source>
                  <context value="entryRelationship"/>
                  <element value="supply"/>
                  <variable value="sup"/>
                </source>
                <target>
                  <context value="medicationRq"/>
                  <contextType value="variable"/>
                  <element value="dispenseRequest"/>
                  <variable value="dispreq"/>
                </target>
                <rule>
                  <name value="quantity"/>
                  <source>
                    <context value="sup"/>
                  </source>
                  <target>
                    <context value="dispreq"/>
                    <contextType value="variable"/>
                    <element value="quantity"/>
                    <variable value="quantity"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="SimpleQuantity"/>
                    </parameter>
                  </target>
                  <rule>
                    <name value="quantity"/>
                    <source>
                      <context value="sup"/>
                      <element value="quantity"/>
                      <variable value="q"/>
                    </source>
                    <target>
                      <context value="quantity"/>
                      <contextType value="variable"/>
                      <element value="value"/>
                      <transform value="evaluate"/>
                      <parameter>
                        <valueString value="q.value"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="tx"/>
          <source>
            <context value="substract"/>
            <element value="text"/>
            <variable value="tx"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="tx"/>
              <element value="reference"/>
              <variable value="ref"/>
            </source>
            <target>
              <context value="note"/>
              <contextType value="variable"/>
              <element value="text"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="ref.value"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="statusCode"/>
          <source>
            <context value="substract"/>
            <element value="statusCode"/>
            <variable value="st"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="status"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="st.code"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="period"/>
          <source>
            <context value="substract"/>
            <type value="IVL_TS"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="timing"/>
            <source>
              <context value="eff"/>
            </source>
            <target>
              <context value="dosage"/>
              <contextType value="variable"/>
              <element value="timing"/>
              <variable value="timing"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Timing"/>
              </parameter>
            </target>
            <rule>
              <name value="rep"/>
              <source>
                <context value="eff"/>
              </source>
              <target>
                <context value="timing"/>
                <contextType value="variable"/>
                <element value="repeat"/>
                <variable value="rep"/>
              </target>
              <rule>
                <name value="period"/>
                <source>
                  <context value="eff"/>
                </source>
                <target>
                  <context value="rep"/>
                  <contextType value="variable"/>
                  <element value="bounds"/>
                  <variable value="period"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Period"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="IVLTSPeriod"/>
                  <variable value="eff"/>
                  <variable value="period"/>
                </dependent>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="period"/>
          <source>
            <context value="substract"/>
            <type value="EIVL_TS"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="timing"/>
            <source>
              <context value="eff"/>
            </source>
            <target>
              <context value="dosage"/>
              <contextType value="variable"/>
              <element value="timing"/>
              <variable value="timing"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Timing"/>
              </parameter>
            </target>
            <rule>
              <name value="rep"/>
              <source>
                <context value="eff"/>
              </source>
              <target>
                <context value="timing"/>
                <contextType value="variable"/>
                <element value="repeat"/>
                <variable value="rep"/>
              </target>
              <rule>
                <name value="event"/>
                <source>
                  <context value="eff"/>
                  <element value="event"/>
                  <variable value="ev"/>
                </source>
                <target>
                  <context value="rep"/>
                  <contextType value="variable"/>
                  <element value="when"/>
                  <transform value="evaluate"/>
                  <parameter>
                    <valueString value="ev.code"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="tim"/>
          <source>
            <context value="substract"/>
            <type value="IVL_TS"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <target>
            <context value="dosage"/>
            <contextType value="variable"/>
            <element value="timing"/>
            <variable value="timing"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Timing"/>
            </parameter>
          </target>
          <target>
            <context value="timing"/>
            <contextType value="variable"/>
            <element value="event"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="eff.value"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="eff"/>
          <source>
            <context value="substract"/>
            <type value="PIVL_TS"/>
            <element value="effectiveTime"/>
            <variable value="eff"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="cod"/>
            <source>
              <context value="eff"/>
            </source>
            <target>
              <context value="dosage"/>
              <contextType value="variable"/>
              <element value="timing"/>
              <variable value="timing"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Timing"/>
              </parameter>
            </target>
            <dependent>
              <name value="periodTiming"/>
              <variable value="eff"/>
              <variable value="timing"/>
            </dependent>
          </rule>
        </rule>
        <rule>
          <name value="dosage"/>
          <source>
            <context value="substract"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="routeCode"/>
            <source>
              <context value="substract"/>
              <element value="routeCode"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="dosage"/>
              <contextType value="variable"/>
              <element value="route"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="dosage"/>
          <source>
            <context value="substract"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosage"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="approachSiteCode"/>
            <source>
              <context value="substract"/>
              <element value="approachSiteCode"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="dosage"/>
              <contextType value="variable"/>
              <element value="site"/>
              <variable value="vvv"/>
              <transform value="create"/>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="Dosage"/>
          <source>
            <context value="substract"/>
            <element value="doseQuantity"/>
            <variable value="doseQuant"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosageInstruction"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="ot"/>
            <source>
              <context value="doseQuant"/>
              <element value="originalText"/>
              <variable value="ot"/>
            </source>
            <rule>
              <name value="reference"/>
              <source>
                <context value="ot"/>
                <element value="reference"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="dosageInstruction"/>
                <contextType value="variable"/>
                <element value="text"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
          </rule>
          <rule>
            <name value="dosageRate"/>
            <source>
              <context value="doseQuant"/>
            </source>
            <target>
              <context value="dosageInstruction"/>
              <contextType value="variable"/>
              <element value="doseAndRate"/>
              <variable value="dosageRate"/>
            </target>
            <rule>
              <name value="d"/>
              <source>
                <context value="doseQuant"/>
              </source>
              <target>
                <context value="dosageRate"/>
                <contextType value="variable"/>
                <element value="dose"/>
                <variable value="d"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Range"/>
                </parameter>
              </target>
              <rule>
                <name value="low"/>
                <source>
                  <context value="doseQuant"/>
                </source>
                <target>
                  <context value="d"/>
                  <contextType value="variable"/>
                  <element value="low"/>
                  <variable value="l"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="SimpleQuantity"/>
                  </parameter>
                </target>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="doseQuant"/>
                    <element value="low"/>
                    <variable value="lo"/>
                  </source>
                  <target>
                    <context value="l"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="lo.value"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="doseQuant"/>
                    <element value="low"/>
                    <variable value="lo"/>
                  </source>
                  <target>
                    <context value="l"/>
                    <contextType value="variable"/>
                    <element value="unit"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="lo.unit"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="low"/>
                <source>
                  <context value="doseQuant"/>
                </source>
                <target>
                  <context value="d"/>
                  <contextType value="variable"/>
                  <element value="high"/>
                  <variable value="h"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="SimpleQuantity"/>
                  </parameter>
                </target>
                <rule>
                  <name value="high"/>
                  <source>
                    <context value="doseQuant"/>
                    <element value="high"/>
                    <variable value="hi"/>
                  </source>
                  <target>
                    <context value="h"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="hi.value"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="high"/>
                  <source>
                    <context value="doseQuant"/>
                    <element value="high"/>
                    <variable value="hi"/>
                  </source>
                  <target>
                    <context value="h"/>
                    <contextType value="variable"/>
                    <element value="unit"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="hi.unit"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="rateq"/>
          <source>
            <context value="substract"/>
            <element value="rateQuantity"/>
            <variable value="rateQuantity"/>
          </source>
          <target>
            <context value="medicationRq"/>
            <contextType value="variable"/>
            <element value="dosageInstruction"/>
            <variable value="dosageInstruction1"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Dosage"/>
            </parameter>
          </target>
          <rule>
            <name value="ot"/>
            <source>
              <context value="rateQuantity"/>
              <element value="originalText"/>
              <variable value="ot"/>
            </source>
            <rule>
              <name value="reference"/>
              <source>
                <context value="ot"/>
                <element value="reference"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="dosageInstruction1"/>
                <contextType value="variable"/>
                <element value="text"/>
                <variable value="vvv"/>
                <transform value="create"/>
              </target>
            </rule>
          </rule>
          <rule>
            <name value="dosageRate"/>
            <source>
              <context value="rateQuantity"/>
            </source>
            <target>
              <context value="dosageInstruction1"/>
              <contextType value="variable"/>
              <element value="doseAndRate"/>
              <variable value="dosageRate"/>
            </target>
            <rule>
              <name value="d"/>
              <source>
                <context value="rateQuantity"/>
              </source>
              <target>
                <context value="dosageRate"/>
                <contextType value="variable"/>
                <element value="rate"/>
                <variable value="d"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Range"/>
                </parameter>
              </target>
              <rule>
                <name value="low"/>
                <source>
                  <context value="rateQuantity"/>
                </source>
                <target>
                  <context value="d"/>
                  <contextType value="variable"/>
                  <element value="low"/>
                  <variable value="l"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="SimpleQuantity"/>
                  </parameter>
                </target>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="rateQuantity"/>
                    <element value="low"/>
                    <variable value="lo"/>
                  </source>
                  <target>
                    <context value="l"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="lo.value"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="low"/>
                  <source>
                    <context value="rateQuantity"/>
                    <element value="low"/>
                    <variable value="lo"/>
                  </source>
                  <target>
                    <context value="l"/>
                    <contextType value="variable"/>
                    <element value="unit"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="lo.unit"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="low"/>
                <source>
                  <context value="rateQuantity"/>
                </source>
                <target>
                  <context value="d"/>
                  <contextType value="variable"/>
                  <element value="high"/>
                  <variable value="h"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="SimpleQuantity"/>
                  </parameter>
                </target>
                <rule>
                  <name value="high"/>
                  <source>
                    <context value="rateQuantity"/>
                    <element value="high"/>
                    <variable value="hi"/>
                  </source>
                  <target>
                    <context value="h"/>
                    <contextType value="variable"/>
                    <element value="value"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="hi.value"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="high"/>
                  <source>
                    <context value="rateQuantity"/>
                    <element value="high"/>
                    <variable value="hi"/>
                  </source>
                  <target>
                    <context value="h"/>
                    <contextType value="variable"/>
                    <element value="unit"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="hi.unit"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
        </rule>
        <rule>
          <name value="partRole"/>
          <source>
            <context value="substract"/>
            <element value="participant"/>
            <variable value="part"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e1"/>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="request"/>
            <variable value="request"/>
            <transform value="create"/>
            <parameter>
              <valueString value="BackboneElement"/>
            </parameter>
          </target>
          <target>
            <context value="request"/>
            <contextType value="variable"/>
            <element value="method"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="PUT"/>
            </parameter>
          </target>
          <target>
            <context value="e1"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="practitioner"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Practitioner"/>
            </parameter>
          </target>
          <rule>
            <name value="time"/>
            <source>
              <context value="part"/>
              <element value="time"/>
              <variable value="time"/>
            </source>
            <target>
              <context value="medicationRq"/>
              <contextType value="variable"/>
              <element value="authoredOn"/>
              <transform value="evaluate"/>
              <parameter>
                <valueString value="time.value"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="perf"/>
            <source>
              <context value="part"/>
              <element value="participantRole"/>
              <variable value="partRole"/>
            </source>
            <rule>
              <name value="meta"/>
              <source>
                <context value="partRole"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="meta"/>
                <variable value="meta"/>
              </target>
              <rule>
                <name value="coding"/>
                <source>
                  <context value="partRole"/>
                </source>
                <target>
                  <context value="meta"/>
                  <contextType value="variable"/>
                  <element value="tag"/>
                  <variable value="coding"/>
                  <transform value="create"/>
                  <parameter>
                    <valueString value="Coding"/>
                  </parameter>
                </target>
                <rule>
                  <name value="system"/>
                  <source>
                    <context value="partRole"/>
                  </source>
                  <target>
                    <context value="coding"/>
                    <contextType value="variable"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://algoritmodiscoring"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="code"/>
                  <source>
                    <context value="partRole"/>
                  </source>
                  <target>
                    <context value="coding"/>
                    <contextType value="variable"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString
                                   value="ClinicalDocument/body/TerapiaFarmacologicaRicovero/participant"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="identifier"/>
              <source>
                <context value="partRole"/>
                <element value="id"/>
                <variable value="id"/>
              </source>
              <target>
                <context value="practitioner"/>
                <contextType value="variable"/>
                <element value="identifier"/>
                <variable value="identifier"/>
              </target>
              <rule>
                <name value="root1"/>
                <source>
                  <context value="id"/>
                  <element value="root"/>
                  <variable value="r"/>
                </source>
                <target>
                  <context value="identifier"/>
                  <contextType value="variable"/>
                  <element value="system"/>
                  <transform value="translate"/>
                  <parameter>
                    <valueId value="r"/>
                  </parameter>
                  <parameter>
                    <valueString
                                 value="http://hl7.org/fhir/ConceptMap/special-oid2uri"/>
                  </parameter>
                  <parameter>
                    <valueString value="uri"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="extension"/>
                <source>
                  <context value="id"/>
                  <element value="extension"/>
                  <variable value="ext"/>
                </source>
                <target>
                  <context value="identifier"/>
                  <contextType value="variable"/>
                  <element value="value"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="ext"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="assigningAuthorityName"/>
                <source>
                  <context value="id"/>
                  <element value="assigningAuthorityName"/>
                  <variable value="s"/>
                </source>
                <target>
                  <context value="identifier"/>
                  <contextType value="variable"/>
                  <element value="assigner"/>
                  <variable value="a"/>
                </target>
                <target>
                  <context value="a"/>
                  <contextType value="variable"/>
                  <element value="display"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="s"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="r"/>
                <source>
                  <context value="id"/>
                  <element value="root"/>
                  <variable value="r"/>
                </source>
                <rule>
                  <name value="aut"/>
                  <source>
                    <context value="id"/>
                    <element value="extension"/>
                    <variable value="ext"/>
                  </source>
                  <target>
                    <context value="practitioner"/>
                    <contextType value="variable"/>
                    <element value="id"/>
                    <variable value="uuid2"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString value="r + '-' + ext"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="e1"/>
                    <contextType value="variable"/>
                    <element value="fullUrl"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="https://example/Practitioner/"/>
                    </parameter>
                    <parameter>
                      <valueId value="uuid2"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="request"/>
                    <contextType value="variable"/>
                    <element value="url"/>
                    <transform value="append"/>
                    <parameter>
                      <valueString value="Practitioner/"/>
                    </parameter>
                    <parameter>
                      <valueId value="uuid1"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="medicationRq"/>
                    <contextType value="variable"/>
                    <element value="performer"/>
                    <variable value="reference"/>
                    <transform value="create"/>
                    <parameter>
                      <valueString value="Reference"/>
                    </parameter>
                  </target>
                  <target>
                    <context value="reference"/>
                    <contextType value="variable"/>
                    <element value="reference"/>
                    <transform value="evaluate"/>
                    <parameter>
                      <valueString
                                   value="'https://example/Practitioner/' + %practitioner.id"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="2.16.840.1.113883.2.9.4.3.2"/>
              <source>
                <context value="partRole"/>
                <element value="id"/>
                <variable value="id"/>
                <condition value="(root = '2.16.840.1.113883.2.9.4.3.2')"/>
              </source>
              <rule>
                <name value="UUID"/>
                <source>
                  <context value="id"/>
                  <element value="extension"/>
                  <variable value="ext"/>
                </source>
                <target>
                  <context value="request"/>
                  <contextType value="variable"/>
                  <element value="url"/>
                  <transform value="append"/>
                  <parameter>
                    <valueString value="Practitioner?identifier="/>
                  </parameter>
                  <parameter>
                    <valueId value="ext"/>
                  </parameter>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="assi"/>
              <source>
                <context value="partRole"/>
                <element value="playingEntity"/>
                <variable value="assi"/>
              </source>
              <rule>
                <name value="name"/>
                <source>
                  <context value="assi"/>
                  <element value="name"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="practitioner"/>
                  <contextType value="variable"/>
                  <element value="name"/>
                  <variable value="vvv"/>
                  <transform value="create"/>
                </target>
              </rule>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
</StructureMap>