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 - PSS - JSON Representation

Draft as of 2024-04-11

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "cda2fhirPs",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n         <pre>map &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirPs&quot; = &quot;cda2fhirPs&quot;\n\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument&quot; alias ClinicalDocument as source\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor&quot; alias AssignedAuthor as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity&quot; alias AssignedEntity as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity&quot; alias AssociatedEntity as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization&quot; alias CustodianOrganization as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf&quot; alias OrganizationPartOf as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Organization&quot; alias rapresentedOrganization as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Section&quot; alias Section as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/PatientRole&quot; alias PatientRole as queried\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/AD&quot; alias AD as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Composition&quot; alias Composition as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/Encounter&quot; alias Encounter as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/Person&quot; alias Patient as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/List&quot; alias List as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as produced\nuses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as produced\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/Act&quot; alias Act as produced\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ&quot; alias IVL_PQ as source\nuses &quot;http://hl7.org/fhir/cda/StructureDefinition/PQ&quot; alias PQ as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/SimpleQuantity&quot; alias SimpleQuantity as target\n\nimports &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes&quot;\nimports &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader&quot;\n\ngroup CdaToBundle(source cda : ClinicalDocument, target bundle : Bundle) {\n  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 e4,  e4.request = create('BackboneElement') as request,  request.method = 'POST',  e4.resource = create('DocumentReference') as DocumentReference,  DocumentReference.id = uuid() as uuid4,  e4.fullUrl = append('https://example/DocumentReference/', uuid4),  request.url = 'DocumentReference' then {\n    cda then ClinicalDocumentToBundle(cda, patient, composition, encounter, bundle, DocumentReference) &quot;cdatobundle&quot;;\n    cda.recordTarget as recordTarget then {\n      recordTarget.patientRole as patient then {\n        patient.id as id -&gt; patient.identifier as identifier then {\n          id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n          id.extension as ext1 -&gt; identifier.value = ext1 &quot;value&quot;;\n          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n        } &quot;idfr&quot;;\n        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 {\n          id.extension as ext -&gt; requestPAT.url = append('Patient?identifier=', ext) &quot;UUID&quot;;\n        } &quot;ext&quot;;\n      } &quot;recPat&quot;;\n    } &quot;patient&quot;;\n  } &quot;ClinicalDocumentToBody&quot;;\n}\n\ngroup ClinicalDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target encounter : Encounter, target bundle : Bundle, target DocumentReference : DocumentReference) {\n  cda -&gt; encounter.status = 'finished' &quot;finished&quot;;\n  cda -&gt; encounter.class = create('Coding') as coding then {\n    cda -&gt; coding.code = 'summary' &quot;code&quot;;\n  } &quot;coding&quot;;\n  cda -&gt; bundle.id = uuid() &quot;id&quot;;\n  cda.id -&gt; bundle.identifier &quot;identifier&quot;;\n  cda -&gt; bundle.type = 'transaction' &quot;type&quot;;\n  // cda.effectiveTime -&gt; bundle.timestamp;\n  cda -&gt; bundle.timestamp = (timestamp.now()) &quot;date&quot;;\n  cda then ClinicalDocumentComposition(cda, composition, patient, encounter, bundle, DocumentReference) &quot;composition&quot;;\n  cda.component as component then {\n    component.structuredBody as body then {\n      body.component as component then {\n        component.section as srcSection then {\n          srcSection.code -&gt; composition.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle, encounter, composition);\n        };\n      };\n    } &quot;body&quot;;\n  } &quot;diagnostic&quot;;\n}\n\ngroup ClinicalDocumentSection(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target composition : Composition) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.entry as entry then {\n    src.text as cdaText -&gt; tgt.text as fhirText then {\n      cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;\n      cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;\n    } &quot;cdaText&quot;;\n    // sezioni che sono strutturate\n    src.code where (code = '30954-2') then {\n      entry.organizer as organizer -&gt;  bundle.entry as e0,  e0.request = create('BackboneElement') as request,  request.method = 'POST',  e0.resource = create('DiagnosticReport') as dia,  dia.id = uuid() as uuid0,  e0.fullUrl = append('https://example/DiagnosticReport/', uuid0),  request.url = 'DiagnosticReport',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/DiagnosticReport/' + %dia.id) then DiagnosticReportFunction(organizer, patient, enc, dia, bundle) &quot;diagnostic&quot;;\n    } &quot;entryObs&quot;;\n    src.code where (code = '29762-2') or (code = '10162-6') then {\n      entry.observation as observation -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as obs1,  obs1.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/' + %obs1.id) then Observation(observation, patient, enc, obs1, bundle) &quot;obs1&quot;;\n    } &quot;entryObs&quot;;\n    src.code where (code = '8716-3') or (code = '47420-5') then {\n      entry.organizer as organizer -&gt;  bundle.entry as e2,  e2.request = create('BackboneElement') as request,  request.method = 'POST',  e2.resource = create('Observation') as obs2,  obs2.id = uuid() as uuid2,  e2.fullUrl = append('https://example/Observation/', uuid2),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs2.id) then ObservationOrganizer(src, organizer, patient, enc, obs2, bundle) &quot;obs2&quot;;\n      entry.observation as organizer -&gt;  bundle.entry as e2,  e2.request = create('BackboneElement') as request,  request.method = 'POST',  e2.resource = create('Observation') as obs2,  obs2.id = uuid() as uuid2,  e2.fullUrl = append('https://example/Observation/', uuid2),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs2.id) then ObservationOrganizer(src, organizer, patient, enc, obs2, bundle) &quot;obs2&quot;;\n    } &quot;organizer&quot;;\n    src.code where code = '11450-4' then {\n      entry.act as act -&gt;  bundle.entry as e3,  e3.request = create('BackboneElement') as request,  request.method = 'POST',  e3.resource = create('Condition') as condition,  condition.id = uuid() as uuid3,  e3.fullUrl = append('https://example/Condition/', uuid3),  request.url = 'Condition',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Condition/' + %condition.id) then ConditionFunction(act, condition, patient, enc, bundle) &quot;condition&quot;;\n    } &quot;listaDeiProblemi&quot;;\n    src.code where (code = '48765-2') then {\n      entry.act as act -&gt;  bundle.entry as e5,  e5.request = create('BackboneElement') as request,  request.method = 'POST',  e5.resource = create('AllergyIntolerance') as allergy,  allergy.id = uuid() as uuid5,  e5.fullUrl = append('https://example/AllergyIntolerance/', uuid5),  request.url = 'AllergyIntolerance',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/AllergyIntolerance/' + %allergy.id) then allergyFunction(act, allergy, patient, enc) &quot;allergy&quot;;\n    } &quot;entryAct&quot;;\n    src.code where code = '10160-0' then {\n      entry.substanceAdministration as subAdmin -&gt;  bundle.entry as e6,  e6.request = create('BackboneElement') as request,  request.method = 'POST',  e6.resource = create('MedicationStatement') as medicationstatement,  medicationstatement.id = uuid() as uuid6,  e6.fullUrl = append('https://example/MedicationStatement/', uuid6),  request.url = 'MedicationStatement',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationStatement/' + %medicationstatement.id) then MedicationStatement(subAdmin, medicationstatement, patient, enc, bundle) &quot;TerapiaFarmacologica&quot;;\n    } &quot;terapia&quot;;\n    src.code where code = '11369-6' then {\n      entry.substanceAdministration as subVACC -&gt;  bundle.entry as e7,  e7.request = create('BackboneElement') as request,  request.method = 'POST',  e7.resource = create('Immunization') as immunization,  immunization.id = uuid() as uuid7,  e7.fullUrl = append('https://example/Immunization/', uuid7),  request.url = 'Immunization',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Immunization/' + %immunization.id) then Immunization(subVACC, patient, enc, immunization, bundle) &quot;immunization&quot;;\n    } &quot;vacc&quot;;\n    src.code where code = '10157-6' then {\n      entry.organizer as organizer -&gt;  bundle.entry as e12,  e12.request = create('BackboneElement') as request,  request.method = 'POST',  e12.resource = create('FamilyMemberHistory') as familyMember,  familyMember.id = uuid() as uuid12,  e12.fullUrl = append('https://example/FamilyMemberHistory/', uuid12),  request.url = 'FamilyMemberHistory',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/FamilyMemberHistory/' + %familyMember.id) then FamilyMemberFunction(organizer, familyMember, patient) &quot;family&quot;;\n    } &quot;family&quot;;\n    src.code where code = '46264-8' then {\n      entry.supply as supply -&gt;  bundle.entry as e8,  e8.request = create('BackboneElement') as request,  request.method = 'POST',  e8.resource = create('Procedure') as procedure,  procedure.id = uuid() as uuid8,  e8.fullUrl = append('https://example/Procedure/', uuid8),  request.url = 'Procedure',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Procedure/' + %procedure.id) then Procedure(supply, patient, enc, procedure, bundle) &quot;protesi&quot;;\n    } &quot;impianti&quot;;\n    src.code where code = '47519-4' then {\n      entry.procedure as procedure -&gt;  bundle.entry as e9,  e9.request = create('BackboneElement') as request,  request.method = 'POST',  e9.resource = create('Procedure') as procedure2,  procedure2.id = uuid() as uuid9,  e9.fullUrl = append('https://example/Procedure/', uuid9),  request.url = 'Procedure',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Procedure/' + %procedure2.id) then Procedure(procedure, patient, enc, procedure2, bundle) &quot;tratt&quot;;\n    } &quot;trattamentiProcedure&quot;;\n    src.code where code = '46240-8' then {\n      // entry.encounter as encounter -&gt; enc then{\n      entry.encounter as encounter -&gt;  bundle.entry as e9,  e9.request = create('BackboneElement') as request,  request.method = 'POST',  e9.resource = create('Encounter') as encounterF,  encounterF.id = uuid() as uuid9,  e9.fullUrl = append('https://example/Encounter/', uuid9),  request.url = 'Encounter',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounterF.id) then EncounterFunction(encounter, patient, enc, encounterF, bundle);\n    } &quot;visiteRicoveri&quot;;\n    src.code where code = '57827-8' then {\n      entry.act as act -&gt;  bundle.entry as e13,  e13.request = create('BackboneElement') as request,  request.method = 'POST',  e13.resource = create('Coverage') as coverage,  coverage.id = uuid() as uuid13,  e13.fullUrl = append('https://example/Coverage/', uuid13),  request.url = 'Coverage',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Coverage/' + %coverage.id) then Coverage(act, patient, enc, coverage, bundle) &quot;esen&quot;;\n    } &quot;esenzioni&quot;;\n    src.code where code = 'PSSIT99' then {\n      entry.act as act -&gt;  bundle.entry as e14,  e14.request = create('BackboneElement') as request,  request.method = 'POST',  e14.resource = create('OrganizationAffiliation') as affiliation,  affiliation.id = uuid() as uuid14,  e14.fullUrl = append('https://example/OrganizationAffiliation/', uuid14),  request.url = 'OrganizationAffiliation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/OrganizationAffiliation/' + %affiliation.id) then OrganizationAffiliation(act, patient, enc, affiliation, bundle) &quot;OrgAffiliation&quot;;\n    } &quot;retiPatologia&quot;;\n  };\n  src where src.entry.exists() then {\n    src.code where code = '18776-5' then {\n      src -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('CarePlan') as careplan,  careplan.id = uuid() as uuid11,  e11.fullUrl = append('https://example/CarePlan/', uuid11),  request.url = 'CarePlan',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/CarePlan/' + %careplan.id) then {\n        src.entry as entry then CarePlanFunction(entry, careplan, patient, enc, bundle) &quot;prestazioni&quot;;\n      } &quot;pianiCura&quot;;\n    } &quot;raccoglitore&quot;;\n  } &quot;esiste&quot;;\n  src where src.entry.exists().not() then {\n    // Anmanesi Familiare narrativa\n    src.code where code = '10157-6' then {\n      src.text as text -&gt;  bundle.entry as e12,  e12.request = create('BackboneElement') as request,  request.method = 'POST',  e12.resource = create('FamilyMemberHistory') as familyMember,  familyMember.id = uuid() as uuid12,  e12.fullUrl = append('https://example/FamilyMemberHistory/', uuid12),  request.url = 'FamilyMemberHistory',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/FamilyMemberHistory/' + %familyMember.id) then {\n        src -&gt;  familyMember.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n        src -&gt; familyMember.status = 'health-unknown' &quot;statusS&quot;;\n        text -&gt; familyMember.note as note then {\n          text as t -&gt; note.text = t &quot;reference&quot;;\n        } &quot;reference&quot;;\n        text -&gt; familyMember.relationship = create('CodeableConcept') as relation then {\n          text as txt -&gt; relation.text = txt &quot;text&quot;;\n        } &quot;medication&quot;;\n      } &quot;family&quot;;\n    } &quot;familyraccoglitore&quot;;\n    // Piano di cura narrativa\n    src.code where code = '18776-5' then {\n      src.text as text -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('CarePlan') as careplan,  careplan.id = uuid() as uuid11,  e11.fullUrl = append('https://example/CarePlan/', uuid11),  request.url = 'CarePlan',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/CarePlan/' + %careplan.id) then {\n        src -&gt;  careplan.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n        // src-&gt; careplan.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n        src -&gt; careplan.status = 'active' &quot;status&quot;;\n        src -&gt; careplan.intent = 'order' &quot;intent&quot;;\n        text -&gt; careplan.note as note then {\n          text as t -&gt; note.text = t &quot;reference&quot;;\n        } &quot;reference&quot;;\n      } &quot;pianiCura&quot;;\n    } &quot;raccoglitore&quot;;\n    // sezioni che sono narrative\n    src.code where (code = '30954-2') or (code = '29762-2') or (code = '8716-3') or (code = '47420-5') or (code = '42348-3') then {\n      src.text as text -&gt;  bundle.entry as e13,  e13.request = create('BackboneElement') as request,  request.method = 'POST',  e13.resource = create('Observation') as obs1,  obs1.id = uuid() as uuid13,  e13.fullUrl = append('https://example/Observation/', uuid13),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs1.id) then {\n        src -&gt;  obs1.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n        // src -&gt; obs1.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n        src -&gt; obs1.status = 'preliminary' &quot;obsst&quot;;\n        src.code -&gt; obs1.code &quot;obscde&quot;;\n        src -&gt; obs1.status = 'final' &quot;statusS&quot;;\n        text -&gt; obs1.note as note then {\n          text as t -&gt; note.text = create('string') as textNote then EDstring(t, textNote) &quot;note&quot;;\n        } &quot;narrative&quot;;\n      } &quot;txtsec&quot;;\n    } &quot;narrative&quot;;\n  } &quot;code&quot;;\n  src.component as component then {\n    component.section as sec -&gt; tgt.section as tgtSection then ClinicalDocumentSection(cda, sec, patient, tgtSection, bundle, enc, dReport);\n  };\n}\n\ngroup Procedure(source src : cdaElement, target patient : Patient, target encounter : Encounter, target tgt : Procedure, target bundle : Bundle) {\n  // toASK\n  src.text as tx -&gt; tgt.note as note then {\n    tx.reference as reff -&gt; note.text = (reff.value) &quot;r&quot;;\n  } &quot;tx&quot;;\n  src.templateId where root = '2.16.840.1.113883.2.9.10.1.4.3.10.3' then {\n    src.effectiveTime as effectiveTime -&gt; tgt.performed = (effectiveTime.value);\n    src.code -&gt; tgt.code;\n  } &quot;ref&quot;;\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  src.statusCode as s then {\n    s.code as cos -&gt; tgt.status = translate(cos, '#EventStatus', 'code') &quot;codeS&quot;;\n  } &quot;status&quot;;\n  src where statusCode.exists().not() -&gt; tgt.status = 'unknown' &quot;status2&quot;;\n  src.templateId where root = '2.16.840.1.113883.2.9.10.1.4.3.9.1' then {\n    src -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Device') as deviceRes,  deviceRes.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Device/', uuid1),  request.url = 'Device',  tgt.usedReference = create('Reference') as reference,  reference.reference = ('https://example/Device/' + %deviceRes.id) then {\n      src -&gt;  deviceRes.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n      src.code -&gt; deviceRes.type;\n    } &quot;device&quot;;\n    src.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.performed = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n    src.effectiveTime as effectiveTime where (low.exists()) -&gt; tgt.performed = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  } &quot;presenzaProtesiImpianto&quot;;\n  src.templateId where root = '2.16.840.1.113883.2.9.10.1.4.3.9.2' then {\n    src.code as code -&gt; tgt.note as note then {\n      code.displayName as displayName -&gt; note.text = (displayName) &quot;text&quot;;\n    } &quot;note&quot;;\n  } &quot;assenza&quot;;\n  src.templateId where root = '2.16.840.1.113883.2.9.10.1.4.3.11.1' then {\n    src.id -&gt; tgt.identifier;\n    src.code -&gt; tgt.code;\n    src.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.performed = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n    src.effectiveTime as effectiveTime where (low.exists()) -&gt; tgt.performed = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n    src.entryRelationship as entryR then {\n      entryR.observation as observation -&gt;  bundle.entry as e3,  e3.request = create('BackboneElement') as request,  request.method = 'POST',  e3.resource = create('Observation') as obs1,  obs1.id = uuid() as uuid3,  e3.fullUrl = append('https://example/Observation/', uuid3),  request.url = 'Observation',  tgt.reasonReference = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs1.id) then Observation(observation, patient, encounter, obs1, bundle);\n    } &quot;entryRelProcedure&quot;;\n  } &quot;procedureTrattamenti&quot;;\n}\n\ngroup Observation(source cda, target patient : Patient, target encounter : Encounter, target ob : Observation, target bundle : Bundle) {\n  cda -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // cda-&gt; ob.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  cda.id -&gt; ob.identifier;\n  cda.code -&gt; ob.code;\n  cda -&gt; ob.status = 'final' &quot;Stats&quot;;\n  // value datatype\n  cda.value : ST as st -&gt;  ob.value = create('string'),  ob.value = (st.dataString);\n  cda.value : BL as boolean -&gt; ob.value = (boolean.value) &quot;boolean&quot;;\n  cda.value : INT as int -&gt; ob.value = (int.value) &quot;intval&quot;;\n  cda.value : CE as val then {\n    val -&gt; ob.value = create('CodeableConcept') as ce then {\n      val.originalText as originalText then {\n        originalText.reference as reference -&gt; ce.text = (reference.value);\n      };\n      val -&gt; ce.coding as coding then {\n        val.code as code -&gt; coding.code = cast(code, 'string');\n        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n        val.displayName as display -&gt; coding.display = cast(display, 'string');\n      } &quot;code&quot;;\n      val.translation as translation -&gt; ce.coding as coding then {\n        translation.code as code -&gt; coding.code = cast(code, 'string');\n        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n        translation.displayName as display -&gt; coding.display = cast(display, 'string');\n        translation.qualifier as qualifier then {\n          qualifier.value as value -&gt; ce.coding as coding then {\n            value.code as code -&gt; coding.code = cast(code, 'string');\n            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n            value.displayName as display -&gt; coding.display = cast(display, 'string');\n          };\n        };\n      };\n    } &quot;coding&quot;;\n  } &quot;val&quot;;\n  cda.value : CD as val then {\n    val -&gt; ob.value = create('CodeableConcept') as ce then {\n      val.originalText as originalText then {\n        originalText.reference as reference -&gt; ce.text = (reference.value);\n      };\n      val -&gt; ce.coding as coding then {\n        val.code as code -&gt; coding.code = cast(code, 'string');\n        val.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n        val.displayName as display -&gt; coding.display = cast(display, 'string');\n      } &quot;code&quot;;\n      val.translation as translation -&gt; ce.coding as coding then {\n        translation.code as code -&gt; coding.code = cast(code, 'string');\n        translation.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n        translation.displayName as display -&gt; coding.display = cast(display, 'string');\n        translation.qualifier as qualifier then {\n          qualifier.value as value -&gt; ce.coding as coding then {\n            value.code as code -&gt; coding.code = cast(code, 'string');\n            value.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n            value.displayName as display -&gt; coding.display = cast(display, 'string');\n          };\n        };\n      };\n    } &quot;coding&quot;;\n  } &quot;val&quot;;\n  cda.value : PQ as val then {\n    val -&gt; ob.value = create('Quantity') as quantity then {\n      val.value as value -&gt; quantity.value = value;\n      val.unit as unit -&gt; quantity.unit = unit;\n    } &quot;quantity&quot;;\n  } &quot;valueQuantity&quot;;\n  cda.effectiveTime as effectiveTime where (value.exists()) -&gt; ob.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n  cda.effectiveTime as effectiveTime where (low.exists()) -&gt; ob.effective = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  cda.text as text -&gt; ob.note as note then {\n    text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n  } &quot;note&quot;;\n  cda.statusCode as s then {\n    s.code as cos -&gt; ob.status = translate(cos, '#OBSstatus', 'code') &quot;codeS&quot;;\n  } &quot;status&quot;;\n  // toASK è giusto siano invertiti?\n  cda.methodCode -&gt; ob.method;\n  cda.interpretationCode -&gt; ob.interpretation;\n  cda.targetSiteCode -&gt; ob.bodySite;\n  // added\n  cda.referenceRange as refrange then {\n    refrange.observationRange as obsrange then {\n      obsrange.value as val -&gt; ob.referenceRange = create('BackboneElement') as refrangeFH then {\n        val -&gt; refrangeFH.low = create('SimpleQuantity') as lowfhir then {\n          val.low as l -&gt; lowfhir.value = (l.value) &quot;val&quot;;\n          val.low as l -&gt; lowfhir.unit = (l.unit) &quot;val&quot;;\n        } &quot;de&quot;;\n        val -&gt; refrangeFH.high = create('SimpleQuantity') as highfhir then {\n          val.high as h -&gt; highfhir.value = (h.value) &quot;val&quot;;\n          val.high as h -&gt; highfhir.unit = (h.unit) &quot;val&quot;;\n        } &quot;de&quot;;\n      } &quot;refFhir&quot;;\n    } &quot;obsrange&quot;;\n  } &quot;regrange&quot;;\n}\n\ngroup ObservationOrganizer(source section : section, source cda : organizer, target patient : Patient, target encounter : Encounter, target ob : Observation, target bundle : Bundle) {\n  cda -&gt;  ob.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // cda-&gt; ob.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  cda.id -&gt; ob.identifier;\n  section.code -&gt; ob.code;\n  cda -&gt; ob.status = 'final' &quot;Stats&quot;;\n  cda.effectiveTime as effectiveTime where (value.exists()) -&gt; ob.effective = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n  cda.effectiveTime as effectiveTime where (low.exists()) -&gt; ob.effective = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  cda.text as text -&gt; ob.note as note then {\n    text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n  } &quot;note&quot;;\n  cda.statusCode as s then {\n    s.code as cos -&gt; ob.status = translate(cos, '#OBSstatus', 'code') &quot;codeS&quot;;\n  } &quot;status&quot;;\n  cda.component as component then {\n    component.observation as observation -&gt;  bundle.entry as ei,  ei.request = create('BackboneElement') as request,  request.method = 'POST',  ei.resource = create('Observation') as obsi,  obsi.id = uuid() as uuidi,  ei.fullUrl = append('https://example/Observation/', uuidi),  request.url = 'Observation',  ob.hasMember = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obsi.id) then Observation(observation, patient, encounter, obsi, bundle) &quot;hasMember&quot;;\n  };\n}\n\ngroup Coverage(source src : act, target patient : Patient, target encounter : Encounter, target tgt : Coverage, target bundle : Bundle) {\n  src -&gt;  tgt.beneficiary = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  src -&gt;  tgt.payor = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  src.id as id -&gt; tgt.identifier as idf then {\n    id -&gt; idf.value = (id.root) &quot;ID&quot;;\n  };\n  src.code -&gt; tgt.type;\n  src.statusCode as statusCode then {\n    statusCode.code as s -&gt; tgt.status = translate(s, '#FinancialStatus', 'code') &quot;status&quot;;\n  } &quot;sc&quot;;\n  src where statusCode.exists().not() -&gt; tgt.status = 'active' &quot;statusAbsent&quot;;\n  // src.effectiveTime as effectiveTime -&gt; tgt.period as period then{\n  src.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.period = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n  src.effectiveTime as effectiveTime where (low.exists()) -&gt; tgt.period = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  src.entryRelationship as entryRelationship then {\n    entryRelationship.act as ac -&gt; tgt.class as class then {\n      ac.text as text -&gt; class.type as type then {\n        text.reference as reference -&gt; type.text = (reference.value) &quot;value&quot;;\n      } &quot;ref&quot;;\n      ac -&gt; class.value = 'commenti' &quot;note&quot;;\n    } &quot;QUI&quot;;\n  } &quot;entryr&quot;;\n}\n\ngroup allergyFunction(source src : cdaElement, target tgt : AllergyIntolerance, target patient : Patient, target encounter : Encounter) {\n  src -&gt;  tgt.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  src.effectiveTime as effTime then {\n    effTime.low as l -&gt; tgt.recordedDate as r then TSDateTime(l, r) &quot;value&quot;;\n  } &quot;efftime&quot;;\n  src.entryRelationship as entryRelationship1 then {\n    entryRelationship1.observation as observation1 then {\n      observation1.id -&gt; tgt.identifier;\n      observation1.templateId where root = '2.16.840.1.113883.2.9.10.1.4.3.1.4' -&gt; tgt.code as code then {\n        observation1 -&gt; code.coding as coding then {\n          observation1 -&gt; coding.code = 'No known allergy' &quot;code&quot;;\n        } &quot;code&quot;;\n        src.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.onset = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n        src.effectiveTime as effectiveTime -&gt; tgt.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n      } &quot;Noallergy&quot;;\n      observation1.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.onset = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n      observation1.effectiveTime as effectiveTime -&gt; tgt.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n      observation1.value as code then {\n        code.code as code1 -&gt; tgt.type = translate(code1, '#AllergyTypeMap', 'code') &quot;type&quot;;\n        code.code as code1 -&gt; tgt.category = translate(code1, '#AllergyCategoryMap', 'code') &quot;category&quot;;\n      } &quot;code&quot;;\n      // toASK qui dovrei fare un controllo sul code\n      observation1.value -&gt; tgt.code;\n      observation1.participant as participant -&gt; tgt.reaction as reaction then {\n        observation1.entryRelationship as entryRelationship2 where (typeCode = 'MFST') then {\n          entryRelationship2.observation as observation2 then {\n            observation2.value -&gt; reaction.manifestation &quot;manifestation&quot;;\n            observation2.code -&gt; reaction.manifestation &quot;manifestation&quot;;\n            observation2.text as tx then {\n              tx.reference as reff -&gt; reaction.description = (reff.value) &quot;tx&quot;;\n            } &quot;tx&quot;;\n            observation2.effectiveTime as effectiveTime then {\n              effectiveTime.low as low -&gt; reaction.onset = create('dateTime') as value then TSDateTime(low, value) &quot;valuePeriodLow&quot;;\n              effectiveTime.high as high -&gt; tgt.lastOccurrence = create('dateTime') as value then TSDateTime(high, value) &quot;valuePeriodHigh&quot;;\n            } &quot;low&quot;;\n          } &quot;observ2&quot;;\n        } &quot;entryR2&quot;;\n        participant.participantRole as participantRole then {\n          participantRole.playingEntity as playingEntity then {\n            playingEntity.code -&gt; reaction.substance &quot;reaction&quot;;\n          };\n        };\n      };\n      observation1.entryRelationship as entryRelationship2 where (typeCode = 'MFST') then {\n        entryRelationship2.observation as observation2 where observation1.participant.exists().not() -&gt; tgt.reaction as reaction then {\n          observation2.value -&gt; reaction.manifestation &quot;manifestation&quot;;\n          observation2.text as tx then {\n            tx.reference as reff -&gt; reaction.description = (reff.value) &quot;tx&quot;;\n          } &quot;tx&quot;;\n          observation2.effectiveTime as effectiveTime then {\n            effectiveTime.low as low -&gt; reaction.onset = create('dateTime') as value then TSDateTime(low, value) &quot;valuePeriodLow&quot;;\n          } &quot;low&quot;;\n        } &quot;observ2&quot;;\n      } &quot;entryR2&quot;;\n      observation1.entryRelationship as entryRelationship3 where (typeCode = 'SUBJ') then {\n        entryRelationship3.observation as observation3 then {\n          observation3.value as value then {\n            value.code as c -&gt; tgt.criticality = translate(c, '#CricalityMap', 'code') &quot;value&quot;;\n          } &quot;criticality&quot;;\n        } &quot;observ3&quot;;\n        entryRelationship3.act as act -&gt; tgt.note as note then {\n          act.text as text then {\n            text.reference as reference -&gt; note.text = (reference.value);\n          } &quot;note&quot;;\n        };\n      } &quot;entryR3&quot;;\n      observation1.entryRelationship as entryRelationship4 where (typeCode = 'REFR') then {\n        entryRelationship4.observation as observation4 then {\n          observation4 -&gt; tgt.clinicalStatus as clinicalStatus then {\n            observation4.value as value then {\n              value as valu -&gt; clinicalStatus.coding = create('Coding') as coding then {\n                valu where (code = 'LA9041-0') -&gt; coding.code = 'resolved' &quot;code&quot;;\n                valu where (code = 'LA18632-2') -&gt; coding.code = 'inactive' &quot;code&quot;;\n                valu where (code = 'LA16666-2') -&gt; coding.code = 'active' &quot;code&quot;;\n                valu -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical' &quot;system&quot;;\n                valu.displayName as display -&gt; coding.display = cast(display, 'string') &quot;display&quot;;\n              } &quot;coding&quot;;\n            };\n            observation4.text as tx then {\n              tx.reference as ref -&gt; clinicalStatus.text = (ref.value);\n            } &quot;tx&quot;;\n          } &quot;clinicalStatus&quot;;\n        } &quot;observ4&quot;;\n      } &quot;entryR4&quot;;\n    };\n  } &quot;entryrelationship&quot;;\n}\n\ngroup MedicationStatement(source src : substanceAdministration, target tgt : MedicationStatement, target patient : Patient, target encounter : Encounter, target bundle : Bundle) {\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.context = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  src.statusCode -&gt; tgt.status &quot;status&quot;;\n  src.id -&gt; tgt.identifier;\n  src.text as text -&gt; tgt.note as note then {\n    text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n  } &quot;note&quot;;\n  src.effectiveTime as eff where (value.exists()) -&gt; tgt.effective = create('dateTime') as value then TSDateTime(eff, value) &quot;value1&quot;;\n  src.effectiveTime : IVL_TS as eff -&gt; tgt.effective = create('Period') as value then IVLTSPeriod(eff, value) &quot;valuePeriod&quot;;\n  src -&gt; tgt.dosage = create('Dosage') as dosage then {\n    src.effectiveTime : PIVL_TS as eff then {\n      eff -&gt; dosage.timing = create('Timing') as timing then periodTiming(eff, timing) &quot;cod&quot;;\n    } &quot;eff&quot;;\n    src where (src.doseQuantity.exists() or src.rateQuantity.exists() or src.routeCode.exists() or src.approachSiteCode.exists()) then {\n      src.doseQuantity as doseQuant then {\n        doseQuant.originalText as ot then {\n          ot.reference -&gt; dosage.text;\n        } &quot;ot&quot;;\n        doseQuant -&gt; dosage.doseAndRate as dosageRate then {\n          doseQuant -&gt; dosageRate.dose = create('Range') as d then {\n            doseQuant -&gt; d.low = create('SimpleQuantity') as l then {\n              doseQuant.low as lo -&gt; l.value = (lo.value);\n              doseQuant.low as lo -&gt; l.unit = (lo.unit);\n            } &quot;low&quot;;\n            doseQuant -&gt; d.high = create('SimpleQuantity') as h then {\n              doseQuant.high as hi -&gt; h.value = (hi.value);\n              doseQuant.high as hi -&gt; h.unit = (hi.unit);\n            } &quot;low&quot;;\n          } &quot;d&quot;;\n        } &quot;dosageRate&quot;;\n      };\n      src.rateQuantity as rateQuantity then {\n        rateQuantity.originalText as ot then {\n          ot.reference -&gt; dosage.text;\n        } &quot;ot&quot;;\n        rateQuantity -&gt; dosage.doseAndRate as dosageRate then {\n          rateQuantity -&gt; dosageRate.rate = create('Range') as d then {\n            rateQuantity -&gt; d.low = create('SimpleQuantity') as l then {\n              rateQuantity.low as lo -&gt; l.value = (lo.value);\n              rateQuantity.low as lo -&gt; l.unit = (lo.unit);\n            } &quot;low&quot;;\n            rateQuantity -&gt; d.high = create('SimpleQuantity') as h then {\n              rateQuantity.high as hi -&gt; h.value = (hi.value);\n              rateQuantity.high as hi -&gt; h.unit = (hi.unit);\n            } &quot;high&quot;;\n          } &quot;r&quot;;\n        } &quot;dosageRate&quot;;\n      } &quot;rate&quot;;\n      src.routeCode -&gt; dosage.route &quot;route&quot;;\n      src.approachSiteCode -&gt; dosage.site &quot;site&quot;;\n      src.targetSiteCode -&gt; dosage.site &quot;site&quot;;\n    } &quot;route&quot;;\n  } &quot;dos&quot;;\n  src.consumable as consumable then {\n    consumable.manufacturedProduct as manufacturedProduct -&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',  tgt.medication = create('Reference') as medref,  medref.reference = ('https://example/Medication/' + %medication.id) then Medication(src, medication, patient, bundle) &quot;medication&quot;;\n  };\n}\n\ngroup periodTiming(source effectiveTime : PIVL_TS, target timing : Timing) {\n  effectiveTime -&gt; timing.repeat as r then {\n    effectiveTime.period as p -&gt; r.period = (p.value);\n    effectiveTime.period as p -&gt; r.periodUnit = (p.unit);\n  } &quot;repeat&quot;;\n}\n\ngroup Medication(source src : substanceAdministration, target tgt : Medication, target patient : Patient, target bundle : Bundle) {\n  src.consumable as consumable then {\n    consumable.manufacturedProduct as manufacturedProduct then {\n      manufacturedProduct.manufacturedMaterial as manufacturedMaterial then {\n        manufacturedMaterial.code -&gt; tgt.code &quot;CE&quot;;\n        src.administrationUnitCode -&gt; tgt.form &quot;form&quot;;\n      } &quot;material&quot;;\n    } &quot;product&quot;;\n  };\n  src.entryRelationship as entryR then {\n    entryR.observation as observation then {\n      observation.code where displayName = 'Grammatura' -&gt; tgt.ingredient as ingredient then {\n        src.consumable as consumable then {\n          consumable.manufacturedProduct as manufacturedProduct then {\n            manufacturedProduct.manufacturedMaterial as manufacturedMaterial then {\n              manufacturedMaterial.code as code -&gt; ingredient.item = create('CodeableConcept') as value then CECodeableConcept(code, value) &quot;CE&quot;;\n            } &quot;material&quot;;\n          } &quot;product&quot;;\n        };\n        observation.value as value -&gt; ingredient.strength as strength then {\n          value -&gt; strength.numerator as numerator then {\n            value -&gt; numerator.value = (value.value) &quot;valueN&quot;;\n          } &quot;numerator&quot;;\n          value -&gt; strength.denominator as denominator then {\n            value -&gt; denominator.value = 1 &quot;valueD&quot;;\n          } &quot;denominator&quot;;\n        } &quot;strenght&quot;;\n      } &quot;ingredient&quot;;\n      observation.code where displayName = 'Quantità nella Confezione' then {\n        observation.value as value -&gt; tgt.amount as amount then {\n          value -&gt; amount.numerator as numerator then {\n            value -&gt; numerator.value = (value.value) &quot;valueN&quot;;\n          } &quot;numerator&quot;;\n          value -&gt; amount.denominator as denominator then {\n            value -&gt; denominator.value = 1 &quot;valueD&quot;;\n          } &quot;denominator&quot;;\n        } &quot;amount&quot;;\n      } &quot;quantita&quot;;\n    } &quot;obs&quot;;\n  } &quot;entryR&quot;;\n}\n\ngroup Immunization(source substance : substanceAdministration, target patient : Patient, target encounter : Encounter, target tgt : Immunization, target bundle : Bundle) {\n  substance -&gt;  tgt.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;patientRef&quot;;\n  // substance -&gt; tgt.encounter  = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;encounterRef&quot;;\n  substance.id as id -&gt; tgt.identifier as idf then {\n    id.root as r -&gt; idf.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n  };\n  substance.text as text -&gt; tgt.note as note then {\n    text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n  } &quot;note&quot;;\n  substance.statusCode as statusc where (code = 'completed') -&gt; tgt.status = 'completed';\n  substance.statusCode as statusc where (code = 'aborted') -&gt; tgt.status = 'final';\n  substance.statusCode as statusc where (code = 'suspended') -&gt; tgt.status = 'enterer-in-error';\n  substance.statusCode as statusc where (code = 'cancelled') -&gt; tgt.status = 'not-done';\n  substance.effectiveTime as time -&gt; tgt.occurrence = create('dateTime') as value then TSDateTime(time, value) &quot;efftime&quot;;\n  substance.routeCode -&gt; tgt.route;\n  substance.approachSiteCode -&gt; tgt.site;\n  substance -&gt; tgt.doseQuantity = create('SimpleQuantity') as quantity then {\n    substance.doseQuantity as q then {\n      q -&gt; quantity.value = (q.value) &quot;val&quot;;\n      q -&gt; quantity.unit = (q.unit) &quot;uni&quot;;\n    } &quot;qua&quot;;\n  } &quot;q&quot;;\n  substance.consumable as cons then {\n    cons.manufacturedProduct as manufact then {\n      manufact.manufacturedMaterial as manufactmat then {\n        manufactmat.code -&gt; tgt.vaccineCode;\n        manufactmat.lotNumberText as t -&gt; tgt.lotNumber = (t.dataString);\n      } &quot;manufactmat&quot;;\n      manufact.manufacturerOrganization as manufactOrg -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Organization') as organization then {\n        manufactOrg.id as id -&gt; organization.identifier as identifier then {\n          id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n          id.extension as ext -&gt; identifier.value = ext then {\n            manufactOrg -&gt; request.url = append('Organization?identifier=', ext) &quot;UUID&quot;;\n          } &quot;ext&quot;;\n          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n          id.root as r then {\n            id.extension as ext -&gt;  organization.id = (r + '-' + ext) as uuid,  e1.fullUrl = append('https://example/', uuid),  tgt.manufacturer = create('Reference') as reference,  reference.reference = ('https://example/' + %organization.id) &quot;idasi&quot;;\n          } &quot;r&quot;;\n        } &quot;identifier&quot;;\n        manufactOrg.name as n -&gt; organization.name = (n.other);\n        manufactOrg -&gt; organization.meta as meta then {\n          manufactOrg -&gt; meta.tag = create('Coding') as coding then {\n            manufactOrg -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;\n            manufactOrg -&gt; coding.code = 'ClinicalDocument/body/Vaccinazioni/manufacturerOrganization' &quot;code&quot;;\n          } &quot;coding&quot;;\n        } &quot;meta&quot;;\n      } &quot;manufactOrg&quot;;\n    } &quot;manufact&quot;;\n  } &quot;cons&quot;;\n  substance.participant as part -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'PUT',  e1.resource = create('Location') as location,  location.id = uuid() as uuid1 then {\n    part -&gt; location.meta as meta then {\n      part -&gt; meta.tag = create('Coding') as coding then {\n        part -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;\n        part -&gt; coding.code = 'ClinicalDocument/body/Vaccinazione/participant' &quot;code&quot;;\n      } &quot;coding&quot;;\n    } &quot;meta&quot;;\n    part.participantRole as partRole then {\n      partRole.id as id -&gt; location.identifier as identifier then {\n        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n        id.extension as ext -&gt; identifier.value = ext then {\n          partRole -&gt; request.url = append('Location?identifier=', ext) &quot;UUID&quot;;\n        } &quot;ext&quot;;\n        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n        id.root as r then {\n          id.extension as ext -&gt;  location.id = (r + '-' + ext) as uuid,  e1.fullUrl = append('https://example/Location', uuid),  tgt.location = create('Reference') as reference,  reference.reference = ('https://example/' + %location.id) &quot;idasi&quot;;\n        } &quot;r&quot;;\n      } &quot;identifier&quot;;\n    } &quot;role&quot;;\n  } &quot;part&quot;;\n  substance.entryRelationship as entrirel1 then {\n    entrirel1.observation as obs then {\n      obs.code where (code = '30973-2') then {\n        obs -&gt; tgt.protocolApplied = create('BackboneElement') as prot then {\n          obs.value as v then {\n            v.value as int -&gt; prot.doseNumber = (int.toString());\n          };\n        } &quot;val&quot;;\n      } &quot;codecontrol&quot;;\n    } &quot;obs&quot;;\n  } &quot;entrirel1&quot;;\n  substance.entryRelationship as entrirel2 then {\n    entrirel2.observation as obs then {\n      obs.code where (code = '59781-5') then {\n        obs.value as value then {\n          value.high as h then {\n            h.value as value -&gt; tgt.expirationDate = truncate(value, 10);\n          } &quot;val&quot;;\n        };\n      } &quot;codecontrol&quot;;\n    } &quot;obs&quot;;\n  } &quot;entrirel2&quot;;\n  substance.entryRelationship as entrirel4 then {\n    entrirel4.observation as obs then {\n      obs.code where (code = '59785-6') -&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.reasonReference = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then {\n        obs then Observation1(entrirel4, patient, tgt, bundle, enc, observation) &quot;observation&quot;;\n      } &quot;codecontrol&quot;;\n    } &quot;obs&quot;;\n  } &quot;entrirel4&quot;;\n  substance.entryRelationship as entrirel5 then {\n    entrirel5.observation as obs then {\n      obs.code where (code = '75321-0') or (code = '5321-0') -&gt; tgt.reaction as reaction then {\n        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',  reaction.detail = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %observation.id) then Observation(obs, patient, encounter, observation, bundle) &quot;observation&quot;;\n      } &quot;codecontrol&quot;;\n    } &quot;obs&quot;;\n  } &quot;entrirel5&quot;;\n  substance.entryRelationship as entrirel5 then {\n    entrirel5.act as act then {\n      act.text as tx -&gt; tgt.note as note then {\n        tx.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n      } &quot;note&quot;;\n    } &quot;obs&quot;;\n  } &quot;entrirel5&quot;;\n}\n\ngroup ConditionFunction(source src : cdaElement, target tgt : Condition, target patient : patient, target encounter : encounter, target bundle : Bundle) {\n  src.id -&gt; tgt.identifier;\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  src.statusCode as stscode -&gt; tgt.verificationStatus as verifstatus then {\n    stscode as codeS -&gt; verifstatus.coding = create('Coding') as coding then {\n      codeS.code -&gt; coding.code = 'confirmed';\n      codeS -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status' &quot;system&quot;;\n      codeS -&gt; coding.display = cast('Confirmed', 'string') &quot;display&quot;;\n    } &quot;coding&quot;;\n  } &quot;verifstatus&quot;;\n  src where entryRelationship.exists().not() then {\n    src.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.onset = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n    src.effectiveTime as effectiveTime -&gt; tgt.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  } &quot;onset&quot;;\n  src.entryRelationship as entryRelationship then {\n    entryRelationship.observation as obsentry then {\n      // toASK\n      obsentry.value -&gt; tgt.code;\n      obsentry.code -&gt; tgt.category;\n      obsentry.effectiveTime as effectiveTime where (value.exists()) -&gt; tgt.onset = create('dateTime') as value then TSDateTime(effectiveTime, value) &quot;value1&quot;;\n      obsentry.effectiveTime as effectiveTime -&gt; tgt.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n      obsentry.text as text -&gt; tgt.note as note then {\n        text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n      } &quot;note&quot;;\n      obsentry.entryRelationship as entryR2 then {\n        entryR2.observation as obsentry2 then {\n          obsentry2.code where code = '89261-2' then {\n            obsentry2 -&gt;  tgt.evidence as evidence,  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as obsy,  obsy.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  evidence.detail = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obsy.id) then Observation(obsentry2, patient, encounter, obsy, bundle) &quot;observation&quot;;\n          } &quot;observation&quot;;\n          obsentry2.code where code = '33999-4' then {\n            obsentry2.value as value -&gt; tgt.clinicalStatus as clinicalstatus then {\n              value as val -&gt; clinicalstatus.coding = create('Coding') as coding then {\n                val where (code = 'LA9041-0') -&gt; coding.code = 'resolved' &quot;code&quot;;\n                val where (code = 'LA18632-2') -&gt; coding.code = 'inactive' &quot;code&quot;;\n                val where (code = 'LA16666-2') -&gt; coding.code = 'active' &quot;code&quot;;\n                val -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical' &quot;system&quot;;\n                val.displayName as display -&gt; coding.display = cast(display, 'string') &quot;display&quot;;\n              } &quot;coding&quot;;\n              obsentry2.text as text then {\n                text.reference as reference -&gt; clinicalstatus.text = (reference.value) &quot;text&quot;;\n              };\n            } &quot;clinicalstatus&quot;;\n          } &quot;clinicalStatus2&quot;;\n          obsentry2.code where code = 'SEV' then {\n            obsentry2.value -&gt; tgt.severity;\n          } &quot;severity&quot;;\n        };\n        entryR2.act as act then {\n          act.text as text -&gt; tgt.note as note then {\n            text.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n          } &quot;note&quot;;\n        };\n      } &quot;entryR&quot;;\n    } &quot;EntryRelObsevation&quot;;\n  } &quot;entryR&quot;;\n}\n\ngroup FamilyMemberFunction(source src : organizer, target tgt : FamilyMemberHistory, target patient : patient) {\n  src -&gt;  tgt.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;patReference&quot;;\n  src.id -&gt; tgt.identifier;\n  src.statusCode -&gt; tgt.status;\n  src.effectiveTime as effectiveTime -&gt; tgt.date = create('date') as value then TSDate(effectiveTime, value) &quot;date&quot;;\n  src.subject as subject then {\n    subject.relatedSubject as relatedSubject then {\n      relatedSubject.code -&gt; tgt.relationship &quot;relationshipCode&quot;;\n      relatedSubject.subject as subject -&gt; tgt.sex as sex then {\n        subject.administrativeGenderCode as administrativeGenderCode -&gt; sex.coding as coding then {\n          administrativeGenderCode.code as sexCode -&gt; coding.code = translate(sexCode, '#cm-v3-administrative-gender', 'code') &quot;gender&quot;;\n          administrativeGenderCode -&gt; coding.system = 'http://hl7.org/fhir/administrative-gender' &quot;system&quot;;\n          administrativeGenderCode.displayName as dn -&gt; coding.display = dn;\n        } &quot;coding&quot;;\n      };\n    } &quot;relatedSub&quot;;\n  } &quot;relationship&quot;;\n  src.component as component -&gt; tgt.condition as condition then {\n    component.observation as observation then {\n      observation.code -&gt; condition.code;\n      observation.text as text -&gt; tgt.note as note then {\n        text.reference as reference -&gt; note.text = (reference.value) &quot;value&quot;;\n      } &quot;reference&quot;;\n      observation.statusCode -&gt; tgt.status;\n      // observation.effectiveTime as effectiveTime -&gt; condition.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n      observation.value -&gt; condition.outcome &quot;codeable&quot;;\n      observation.entryRelationship as entryR then {\n        entryR.observation as obs then {\n          obs where (code.code = '35267-4') then {\n            obs.value as value -&gt; condition.onset = create('Age') as Age then {\n              value.value as valueAge -&gt; Age.value = valueAge &quot;age&quot;;\n              value.unit as unit -&gt; Age.code = unit;\n              value.unit as unit -&gt; Age.unit = unit;\n              value -&gt; Age.system = 'http://unitsofmeasure.org' &quot;system&quot;;\n            };\n          } &quot;insorgenza&quot;;\n          obs where (code.code = '39016-1') then {\n            obs.value as value -&gt; tgt.deceased = create('Age') as Age then {\n              value.value as valueAge -&gt; Age.value = valueAge &quot;age&quot;;\n              value.unit as unit -&gt; Age.code = unit;\n              value.unit as unit -&gt; Age.unit = unit;\n              value -&gt; Age.system = 'http://unitsofmeasure.org' &quot;system&quot;;\n            };\n          } &quot;death&quot;;\n        } &quot;obser&quot;;\n      } &quot;EntryRel&quot;;\n    };\n  };\n}\n\ngroup Practitioner(source src : performer, target tgt : Encounter, target bundle : Bundle) {\n  src -&gt;  bundle.entry as e22,  e22.request = create('BackboneElement') as request,  request.method = 'PUT',  e22.resource = create('Practitioner') as practitioner1 then {\n    src.assignedEntity as assignedEntity -&gt; tgt.participant as participant then {\n      src.time as time where (value.exists()) -&gt; participant.period = create('dateTime') as value then TSDateTime(time, value) &quot;value1&quot;;\n      src.time as time where (low.exists()) -&gt; participant.period = create('Period') as value then IVLTSPeriod(time, value) &quot;valuePeriod&quot;;\n      // src.time as time -&gt; participant.period as period then{\n      assignedEntity.id as id -&gt; practitioner1.identifier as identifier then {\n        id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n        id.extension as ext -&gt; identifier.value = ext &quot;ext&quot;;\n        id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n        id.root as r then {\n          id.extension as ext -&gt;  practitioner1.id = (r + '-' + ext) as uuid22,  e22.fullUrl = append('https://example/Practitioner/', uuid22),  participant.individual = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner1.id) &quot;id&quot;;\n        } &quot;r&quot;;\n      } &quot;identifier&quot;;\n      assignedEntity.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {\n        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;\n      } &quot;2&quot;;\n      assignedEntity.id as id where (root != '2.16.840.1.113883.2.9.4.3.2') then {\n        id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;\n      } &quot;diverso&quot;;\n      assignedEntity -&gt; practitioner1.meta as meta then {\n        src -&gt; meta.tag = create('Coding') as coding then {\n          src -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;\n          src -&gt; coding.code = 'ClinicalDocument/body/VisiteRicoveri/performer/' &quot;code&quot;;\n        } &quot;coding&quot;;\n      } &quot;meta&quot;;\n      assignedEntity.addr -&gt; practitioner1.address;\n      assignedEntity.telecom -&gt; practitioner1.telecom;\n      assignedEntity.assignedPerson as person then {\n        person.name -&gt; practitioner1.name;\n        person.birthTime -&gt; practitioner1.birthDate;\n      } &quot;partname&quot;;\n    } &quot;participant&quot;;\n  } &quot;resurceCreation&quot;;\n}\n\ngroup CarePlanFunction(source src : entry, target tgt : CarePlan, target patient : Patient, target encounter : Encounter, target bundle : Bundle) {\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  src -&gt; tgt.status = 'unknown' &quot;status&quot;;\n  src -&gt; tgt.intent = 'plan' &quot;intent&quot;;\n  src -&gt; tgt.activity as activity then {\n    src -&gt; activity.detail as detail then {\n      src.observation as observation then {\n        observation then {\n          observation -&gt; detail.status = 'unknown' &quot;status&quot;;\n          observation -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Observation') as obs1,  obs1.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Observation/', uuid1),  request.url = 'Observation',  detail.reasonReference = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obs1.id) then Observation(observation, patient, encounter, obs1, bundle) &quot;obs1&quot;;\n        } &quot;activity&quot;;\n      } &quot;entryObs&quot;;\n      src.substanceAdministration as substanceAdministration -&gt; tgt.activity as activity then {\n        substanceAdministration -&gt;  bundle.entry as e2,  e2.request = create('BackboneElement') as request,  request.method = 'POST',  e2.resource = create('MedicationRequest') as medre1,  medre1.id = uuid() as uuid2,  e2.fullUrl = append('https://example/MedicationRequest/', uuid2),  request.url = 'MedicationRequest',  activity.reference = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medre1.id) then MedicationRequest(substanceAdministration, patient, encounter, medre1, bundle) &quot;Terapie&quot;;\n      } &quot;entrySub&quot;;\n      src.procedure as procedureC -&gt;  bundle.entry as e8,  e8.request = create('BackboneElement') as request,  request.method = 'POST',  e8.resource = create('Procedure') as procedure,  procedure.id = uuid() as uuid8,  e8.fullUrl = append('https://example/Procedure/', uuid8),  request.url = 'Procedure',  activity.outcomeReference = create('Reference') as reference,  reference.reference = ('https://example/Procedure/' + %procedure.id) then Procedure(procedureC, patient, encounter, procedure, bundle) &quot;proc&quot;;\n      src.encounter as encounterCDA -&gt;  bundle.entry as e3,  e3.request = create('BackboneElement') as request,  request.method = 'POST',  e3.resource = create('Encounter') as encounterFHIR,  encounterFHIR.id = uuid() as uuid3,  e3.fullUrl = append('https://example/Encounter/', uuid3),  request.url = 'Encounter',  tgt.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounterFHIR.id) then {\n        // encounterCDA -&gt; encounterFHIR.partOf = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;encounterHeader&quot;;\n        encounterCDA -&gt;  encounterFHIR.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;refPatient&quot;;\n        encounterCDA.id -&gt; encounterFHIR.identifier;\n        encounterCDA.statusCode -&gt; encounterFHIR.status;\n        encounterCDA where statusCode.exists().not() -&gt; encounterFHIR.status = 'unknown' &quot;status&quot;;\n        encounterCDA.code as code -&gt; encounterFHIR.class as class then {\n          code.code as code -&gt; class.code = cast(code, 'string');\n          code.codeSystem as system -&gt; class.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n          code.displayName as display -&gt; class.display = cast(display, 'string');\n        } &quot;class&quot;;\n        encounterCDA.text as text -&gt; encounterFHIR.type as type then {\n          text.reference as reference -&gt; type.text = (reference.value) &quot;value&quot;;\n        };\n        encounterCDA.effectiveTime as effectiveTime -&gt; encounterFHIR.period = create('Period') as period then {\n          effectiveTime -&gt; period.start = create('dateTime') as start then TSDateTime(effectiveTime, start) &quot;val&quot;;\n        } &quot;efft&quot;;\n      } &quot;viste&quot;;\n      src.act as act then {\n        act.id -&gt; tgt.identifier;\n        act.code -&gt; activity.outcomeCodeableConcept;\n        act.text as text -&gt; activity.progress = create('Annotation') as progress then {\n          text.reference as reference -&gt; progress.text = (reference.value) &quot;value&quot;;\n        };\n        act.effectiveTime as effectiveTime -&gt; detail.scheduled = create('Period') as period then {\n          effectiveTime -&gt; period.start = create('dateTime') as start then TSDateTime(effectiveTime, start) &quot;val&quot;;\n        } &quot;efft&quot;;\n        act -&gt; detail.status = 'completed' &quot;status&quot;;\n      };\n    } &quot;detail&quot;;\n  } &quot;activityIni&quot;;\n}\n\ngroup MedicationRequest(source src : substanceAdministration, target patient : Patient, target encounter : Encounter, target tgt : MedicationRequest, target bundle : Bundle) {\n  // default  + mandatory\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) &quot;reference&quot;;\n  src -&gt; tgt.intent = 'order' &quot;intent&quot;;\n  src where statusCode.exists().not() -&gt; tgt.status = 'unknown' &quot;st&quot;;\n  src.statusCode as sc then {\n    sc.code as cos -&gt; tgt.status = translate(cos, '#MedicationStatusMap', 'code') &quot;codeS&quot;;\n  } &quot;status&quot;;\n  src.id -&gt; tgt.identifier;\n  src.text as txt -&gt; tgt.note as note then {\n    txt.reference as reference -&gt; note.text = (reference.value) &quot;text&quot;;\n  } &quot;note&quot;;\n  src.effectiveTime : IVL_TS as eff -&gt; tgt.dosageInstruction = create('Dosage') as dosage then {\n    eff -&gt; dosage.timing = create('Timing') as timing then {\n      eff -&gt; timing.repeat as rep then {\n        eff -&gt; rep.bounds = create('Period') as value then IVLTSPeriod(eff, value) &quot;valuePeriod&quot;;\n      } &quot;rep&quot;;\n    } &quot;timing&quot;;\n  } &quot;period&quot;;\n  src.effectiveTime : EIVL_TS as effe -&gt; tgt.dosageInstruction = create('Dosage') as dosage then {\n    effe -&gt; dosage.timing = create('Timing') as timing then {\n      effe -&gt; timing.repeat as rep then {\n        effe.eventCode as ev -&gt; rep.when = (ev.code);\n      } &quot;rep&quot;;\n    } &quot;timing&quot;;\n  } &quot;period&quot;;\n  src.effectiveTime : IVL_TS as eff -&gt;  tgt.dosageInstruction = create('Dosage') as dosage,  dosage.timing = create('Timing') as timing,  timing.event = (eff.value) &quot;tim&quot;;\n  src.effectiveTime : PIVL_TS as eff -&gt; tgt.dosageInstruction = create('Dosage') as dosage then {\n    eff -&gt; dosage.timing = create('Timing') as timing then periodTiming(eff, timing) &quot;cod&quot;;\n  } &quot;eff&quot;;\n  src where (src.doseQuantity.exists() or src.rateQuantity.exists()) then {\n    src -&gt; tgt.dosageInstruction = create('Dosage') as dosageInstruction then {\n      src.doseQuantity as doseQuant then {\n        doseQuant.originalText as ot then {\n          ot.reference -&gt; dosageInstruction.text;\n        } &quot;ot&quot;;\n        doseQuant -&gt; dosageInstruction.doseAndRate as dosageRate then {\n          doseQuant -&gt; dosageRate.dose = create('Range') as d then {\n            doseQuant -&gt; d.low = create('SimpleQuantity') as l then {\n              doseQuant.low as lo -&gt; l.value = (lo.value);\n              doseQuant.low as lo -&gt; l.unit = (lo.unit);\n            } &quot;low&quot;;\n            doseQuant -&gt; d.high = create('SimpleQuantity') as h then {\n              doseQuant.high as hi -&gt; h.value = (hi.value);\n              doseQuant.high as hi -&gt; h.unit = (hi.unit);\n            } &quot;low&quot;;\n          } &quot;d&quot;;\n        } &quot;dosageRate&quot;;\n      };\n      src.rateQuantity as rateQuantity then {\n        rateQuantity.originalText as ot then {\n          ot.reference -&gt; dosageInstruction.text;\n        } &quot;ot&quot;;\n        rateQuantity -&gt; dosageInstruction.doseAndRate as dosageRate then {\n          rateQuantity -&gt; dosageRate.rate = create('Range') as d then {\n            rateQuantity -&gt; d.low = create('SimpleQuantity') as l then {\n              rateQuantity.low as lo -&gt; l.value = (lo.value);\n              rateQuantity.low as lo -&gt; l.unit = (lo.unit);\n            } &quot;low&quot;;\n            rateQuantity -&gt; d.high = create('SimpleQuantity') as h then {\n              rateQuantity.high as hi -&gt; h.value = (hi.value);\n              rateQuantity.high as hi -&gt; h.unit = (hi.unit);\n            } &quot;high&quot;;\n          } &quot;r&quot;;\n        } &quot;dosageRate&quot;;\n      } &quot;rate&quot;;\n      src.routeCode -&gt; dosageInstruction.route &quot;route&quot;;\n      src.approachSiteCode -&gt; dosageInstruction.site &quot;site&quot;;\n      src.targetSiteCode -&gt; dosageInstruction.site &quot;site&quot;;\n    } &quot;dosageIn&quot;;\n  } &quot;condition&quot;;\n  src.consumable as consumable -&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',  tgt.medication = create('Reference') as medref,  medref.reference = ('https://example/Medication/' + %medication.id) then Medication(src, medication, patient, bundle) &quot;medication&quot;;\n  src.entryRelationship as entryRelationship then {\n    entryRelationship.supply as supply -&gt; tgt.dispenseRequest as dispenseRequest then {\n      supply.quantity as quantityCDA -&gt; dispenseRequest.quantity as quantityFHIR then {\n        quantityCDA -&gt; quantityFHIR.value = (quantityCDA.value) &quot;value&quot;;\n      };\n    };\n  } &quot;entryR&quot;;\n  src.participant as participant then {\n    participant then Practitioner(participant, tgt, bundle) &quot;function&quot;;\n    participant.effectiveTime -&gt; tgt.authoredOn &quot;autor&quot;;\n  } &quot;Partecipant&quot;;\n}\n\ngroup OrganizationAffiliation(source src : act, target patient : Patient, target enc : Encounter, target tgt : OrganizationAffiliation, target bundle : Bundle) {\n  src.id -&gt; tgt.identifier;\n  // src.code -&gt; tgt.specialty as specialty then{\n  src.statusCode where code = 'active' -&gt; tgt.active = true;\n  src.statusCode where (code = 'active').not() -&gt; tgt.active = false;\n  src.effectiveTime as eff -&gt; tgt.period;\n  // src.code -&gt; tgt.specialty;\n  src -&gt; tgt.specialty = create('CodeableConcept') as spec then {\n    src.code as code then {\n      code -&gt; spec.coding = create('Coding') as cd then {\n        code -&gt; cd.code = (code.code) &quot;code&quot;;\n        code -&gt; cd.display = (code.displayName) &quot;code&quot;;\n        code.codeSystem as r -&gt; cd.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n      } &quot;cd&quot;;\n    } &quot;spec&quot;;\n    src.entryRelationship as entry then {\n      entry.act as a then {\n        a.text as tx then {\n          tx.reference as reff -&gt; spec.text = (reff.value);\n        } &quot;ref&quot;;\n      };\n    } &quot;entry&quot;;\n  } &quot;a&quot;;\n}\n\ngroup DiagnosticReportFunction(source src : organizer, target patient : Patient, target enc : Encounter, target tgt : DiagnosticReport, target bundle : Bundle) {\n  src -&gt;  tgt.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n  // src -&gt; tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n  src.code -&gt; tgt.code;\n  src.statusCode where code = 'completed' -&gt; tgt.status = 'final';\n  src.effectiveTime as eff where (value.exists()) -&gt; tgt.effective = create('dateTime') as value then TSDateTime(eff, value) &quot;value1&quot;;\n  src.effectiveTime as eff where (low.exists()) -&gt; tgt.effective = create('Period') as value then IVLTSPeriod(effectiveTime, value) &quot;valuePeriod&quot;;\n  src.component as component then {\n    component.observation as observation -&gt;  bundle.entry as ei,  ei.request = create('BackboneElement') as request,  request.method = 'POST',  ei.resource = create('Observation') as obsi,  obsi.id = uuid() as uuidi,  ei.fullUrl = append('https://example/Observation/', uuidi),  request.url = 'Observation',  tgt.result = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %obsi.id) then Observation(observation, patient, enc, obsi, bundle) &quot;hasMember&quot;;\n  };\n}\n\ngroup EncounterFunction(source src : cdaElement, target patient : Patient, target encounter : Encounter, target tgt : Encounter, target bundle : Bundle) {\n  src.id -&gt; tgt.identifier;\n  src.statusCode -&gt; tgt.status;\n  src where statusCode.exists().not() -&gt; tgt.status = 'unknown' &quot;status&quot;;\n  src.code as code -&gt; tgt.class as class then {\n    code -&gt; class.code = (code.code) &quot;code&quot;;\n    code -&gt; class.display = (code.displayName) &quot;display&quot;;\n    code.codeSystem as r -&gt; class.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n  } &quot;co&quot;;\n  // src.effectiveTime as effective -&gt; tgt.period as period then{\n  src where effectiveTime.low.exists() or effectiveTime.high.exists() then {\n    src.effectiveTime as eff -&gt; tgt.period = create('Period') as period then IVLTSPeriod(eff, period);\n  } &quot;where&quot;;\n  // effectiveTime = time-stamp\n  src where effectiveTime.low.exists().not() or effectiveTime.high.exists().not() then {\n    src.effectiveTime as effectivetime1 -&gt; tgt.period = create('Period') as period then {\n      effectivetime1 -&gt; period.start = create('dateTime') as start then TSDateTime(effectivetime1, start) &quot;val&quot;;\n    } &quot;efft&quot;;\n  } &quot;where&quot;;\n  // src.effectiveTime as eff where (value.exists()) -&gt; tgt.period = create('dateTime') as value then TSDateTime(eff, value) &quot;value1&quot;;\n  src.text as tx -&gt; tgt.type as ty then {\n    tx.reference as reff -&gt; ty.text = (reff.value) &quot;textType&quot;;\n  };\n  src.performer as performer -&gt; tgt.participant as part then {\n    performer -&gt; part.period as period then {\n      performer.time as time -&gt; period.start as start then TSDateTime(time, start) &quot;val&quot;;\n    } &quot;period&quot;;\n    performer.assignedEntity as assentity -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('PractitionerRole') as practitionerRole,  practitionerRole.id = uuid() as uuid1,  e1.fullUrl = append('https://example/PractitionerRole/', uuid1),  request.url = 'PractitionerRole',  tgt.participant = create('BackboneElement') as participant1,  participant1.individual = create('Reference') as referencepart,  referencepart.reference = ('https://example/PractitionerRole/' + %practitionerRole.id) then {\n      assentity.code -&gt; practitionerRole.code;\n      assentity -&gt;  bundle.entry as e2,  e2.request = create('BackboneElement') as request,  request.method = 'PUT',  e2.resource = create('Practitioner') as practitioner then {\n        assentity -&gt; practitioner.meta as meta then {\n          assentity -&gt; meta.tag = create('Coding') as coding then {\n            assentity -&gt; coding.system = 'http://algoritmodiscoring' &quot;system&quot;;\n            assentity -&gt; coding.code = 'ClinicalDocument/body/encounter/performer' &quot;code&quot;;\n          } &quot;coding&quot;;\n        } &quot;meta&quot;;\n        assentity.id as id -&gt; practitioner.identifier as identifier then {\n          id.root as r -&gt; identifier.system = translate(r, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri') &quot;root1&quot;;\n          id.extension as ext -&gt; identifier.value = ext then {\n            assentity -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;\n          } &quot;ext&quot;;\n          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n          id.root as r then {\n            id.extension as ext -&gt;  practitioner.id = (r + '-' + ext) as uuid2,  e2.fullUrl = append('https://example/Practitioner/', uuid2),  practitionerRole.practitioner = create('Reference') as reference,  reference.reference = ('https://example/Practitioner/' + %practitioner.id) &quot;performer&quot;;\n          } &quot;r&quot;;\n        } &quot;identifier&quot;;\n        assentity.id as id where (root = '2.16.840.1.113883.2.9.4.3.2') then {\n          id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;\n        } &quot;2&quot;;\n        assentity.id as id where (root != '2.16.840.1.113883.2.9.4.3.2') then {\n          id.extension as ext -&gt; request.url = append('Practitioner?identifier=', ext) &quot;UUID&quot;;\n        } &quot;2&quot;;\n        assentity.addr -&gt; practitioner.address;\n        assentity.telecom -&gt; practitioner.telecom;\n        assentity.assignedPerson as person then {\n          person.name -&gt; practitioner.name;\n          person.birthTime as birthTime then {\n            birthTime.value as date -&gt; practitioner.birthDate = truncate(date, 10);\n          } &quot;birth&quot;;\n        } &quot;name&quot;;\n      } &quot;assignedEntity&quot;;\n    } &quot;performer&quot;;\n  } &quot;01&quot;;\n}\n\n</pre>\n      </div>"
  },
  "url" : "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirPs",
  "version" : "0.1.0",
  "name" : "cda2fhirPs",
  "status" : "draft",
  "date" : "2024-04-11T15:38:19+02:00",
  "publisher" : "HL7 Italy",
  "contact" : [
    {
      "name" : "HL7 Italy",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://hl7.it"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "IT",
          "display" : "Italy"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument",
      "mode" : "source",
      "alias" : "ClinicalDocument"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor",
      "mode" : "queried",
      "alias" : "AssignedAuthor"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity",
      "mode" : "queried",
      "alias" : "AssignedEntity"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity",
      "mode" : "queried",
      "alias" : "AssociatedEntity"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization",
      "mode" : "queried",
      "alias" : "CustodianOrganization"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf",
      "mode" : "queried",
      "alias" : "OrganizationPartOf"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/Organization",
      "mode" : "queried",
      "alias" : "rapresentedOrganization"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/Section",
      "mode" : "queried",
      "alias" : "Section"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/PatientRole",
      "mode" : "queried",
      "alias" : "PatientRole"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/AD",
      "mode" : "source",
      "alias" : "AD"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "Bundle"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Composition",
      "mode" : "produced",
      "alias" : "Composition"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
      "mode" : "produced",
      "alias" : "Patient"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Encounter",
      "mode" : "produced",
      "alias" : "Encounter"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Person",
      "mode" : "produced",
      "alias" : "Patient"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/List",
      "mode" : "produced",
      "alias" : "List"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
      "mode" : "produced",
      "alias" : "Practitioner"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Organization",
      "mode" : "produced",
      "alias" : "Organization"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/Act",
      "mode" : "produced",
      "alias" : "Act"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ",
      "mode" : "source",
      "alias" : "IVL_PQ"
    },
    {
      "url" : "http://hl7.org/fhir/cda/StructureDefinition/PQ",
      "mode" : "source",
      "alias" : "PQ"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/SimpleQuantity",
      "mode" : "target",
      "alias" : "SimpleQuantity"
    }
  ],
  "import" : [
    🔗 "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes"🔗 ,
    "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader"
  ],
  "group" : [
    {
      "name" : "CdaToBundle",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "cda",
          "type" : "ClinicalDocument",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "ClinicalDocumentToBody",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "POST"
                }
              ]
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "composition",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Composition"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid1",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Composition/"
                },
                {
                  "valueId" : "uuid1"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Composition"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "requestPAT",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "requestPAT",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "PUT"
                }
              ]
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "patient",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Patient"
                }
              ]
            },
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Patient/"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "POST"
                }
              ]
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "encounter",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Encounter"
                }
              ]
            },
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Encounter/"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Encounter"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "POST"
                }
              ]
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "DocumentReference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "DocumentReference"
                }
              ]
            },
            {
              "context" : "DocumentReference",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/DocumentReference/"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "DocumentReference"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "cdatobundle",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentToBundle",
                  "variable" : [
                    "cda",
                    "patient",
                    "composition",
                    "encounter",
                    "bundle",
                    "DocumentReference"
                  ]
                }
              ]
            },
            {
              "name" : "patient",
              "source" : [
                {
                  "context" : "cda",
                  "element" : "recordTarget",
                  "variable" : "recordTarget"
                }
              ],
              "rule" : [
                {
                  "name" : "recPat",
                  "source" : [
                    {
                      "context" : "recordTarget",
                      "element" : "patientRole",
                      "variable" : "patient"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "idfr",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "id",
                          "variable" : "id"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "patient",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "identifier"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "root1",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "root",
                              "variable" : "r"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "r"
                                },
                                {
                                  "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                },
                                {
                                  "valueString" : "uri"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext1"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "ext1"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "assigningAuthorityName",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "assigningAuthorityName",
                              "variable" : "s"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "assigner",
                              "variable" : "a"
                            },
                            {
                              "context" : "a",
                              "contextType" : "variable",
                              "element" : "display",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "s"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "ext",
                      "source" : [
                        {
                          "context" : "patient",
                          "element" : "id",
                          "variable" : "id",
                          "condition" : "(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')"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "UUID",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "requestPAT",
                              "contextType" : "variable",
                              "element" : "url",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "Patient?identifier="
                                },
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ClinicalDocumentToBundle",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "cda",
          "type" : "ClinicalDocument",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "DocumentReference",
          "type" : "DocumentReference",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "finished",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "finished"
                }
              ]
            }
          ]
        },
        {
          "name" : "coding",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "class",
              "variable" : "coding",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coding"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "summary"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "id",
              "transform" : "uuid"
            }
          ]
        },
        {
          "name" : "identifier",
          "source" : [
            {
              "context" : "cda",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "type",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "type",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "transaction"
                }
              ]
            }
          ]
        },
        {
          "name" : "date",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "timestamp",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "timestamp.now()"
                }
              ]
            }
          ],
          "documentation" : "cda.effectiveTime -> bundle.timestamp;"
        },
        {
          "name" : "composition",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "dependent" : [
            {
              "name" : "ClinicalDocumentComposition",
              "variable" : [
                "cda",
                "composition",
                "patient",
                "encounter",
                "bundle",
                "DocumentReference"
              ]
            }
          ]
        },
        {
          "name" : "diagnostic",
          "source" : [
            {
              "context" : "cda",
              "element" : "component",
              "variable" : "component"
            }
          ],
          "rule" : [
            {
              "name" : "body",
              "source" : [
                {
                  "context" : "component",
                  "element" : "structuredBody",
                  "variable" : "body"
                }
              ],
              "rule" : [
                {
                  "name" : "component",
                  "source" : [
                    {
                      "context" : "body",
                      "element" : "component",
                      "variable" : "component"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "section",
                      "source" : [
                        {
                          "context" : "component",
                          "element" : "section",
                          "variable" : "srcSection"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "code",
                          "source" : [
                            {
                              "context" : "srcSection",
                              "element" : "code"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "composition",
                              "contextType" : "variable",
                              "element" : "section",
                              "variable" : "tgtSection"
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "ClinicalDocumentSection",
                              "variable" : [
                                "cda",
                                "srcSection",
                                "patient",
                                "tgtSection",
                                "bundle",
                                "encounter",
                                "composition"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ClinicalDocumentSection",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "cda",
          "type" : "ClinicalDocument",
          "mode" : "source"
        },
        {
          "name" : "src",
          "type" : "Section",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "enc",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "title",
          "source" : [
            {
              "context" : "src",
              "element" : "title",
              "variable" : "t"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "title",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "t.dataString"
                }
              ]
            }
          ]
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "entry",
          "source" : [
            {
              "context" : "src",
              "element" : "entry",
              "variable" : "entry"
            }
          ],
          "rule" : [
            {
              "name" : "cdaText",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "text",
                  "variable" : "fhirText"
                }
              ],
              "rule" : [
                {
                  "name" : "narrativeStatus",
                  "source" : [
                    {
                      "context" : "cdaText"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "fhirText",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "generated"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "narrativeText",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "t"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "fhirText",
                      "contextType" : "variable",
                      "element" : "div",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "t"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "entryObs",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "(code = '30954-2')"
                }
              ],
              "rule" : [
                {
                  "name" : "diagnostic",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "organizer",
                      "variable" : "organizer"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e0"
                    },
                    {
                      "context" : "e0",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e0",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "dia",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "DiagnosticReport"
                        }
                      ]
                    },
                    {
                      "context" : "dia",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid0",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e0",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/DiagnosticReport/"
                        },
                        {
                          "valueId" : "uuid0"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "DiagnosticReport"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/DiagnosticReport/' + %dia.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "DiagnosticReportFunction",
                      "variable" : [
                        "organizer",
                        "patient",
                        "enc",
                        "dia",
                        "bundle"
                      ]
                    }
                  ]
                }
              ],
              "documentation" : "sezioni che sono strutturate"
            },
            {
              "name" : "entryObs",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "(code = '29762-2') or (code = '10162-6')"
                }
              ],
              "rule" : [
                {
                  "name" : "obs1",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "observation",
                      "variable" : "observation"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e1"
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "obs1",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "obs1",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid1",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid1"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %obs1.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Observation",
                      "variable" : [
                        "observation",
                        "patient",
                        "enc",
                        "obs1",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "organizer",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "(code = '8716-3') or (code = '47420-5')"
                }
              ],
              "rule" : [
                {
                  "name" : "obs2",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "organizer",
                      "variable" : "organizer"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e2"
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "obs2",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "obs2",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid2",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %obs2.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ObservationOrganizer",
                      "variable" : [
                        "src",
                        "organizer",
                        "patient",
                        "enc",
                        "obs2",
                        "bundle"
                      ]
                    }
                  ]
                },
                {
                  "name" : "obs2",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "observation",
                      "variable" : "organizer"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e2"
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "obs2",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "obs2",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid2",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid2"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %obs2.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ObservationOrganizer",
                      "variable" : [
                        "src",
                        "organizer",
                        "patient",
                        "enc",
                        "obs2",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "listaDeiProblemi",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '11450-4'"
                }
              ],
              "rule" : [
                {
                  "name" : "condition",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e3"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "condition",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Condition"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid3",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Condition/"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Condition"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Condition/' + %condition.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ConditionFunction",
                      "variable" : [
                        "act",
                        "condition",
                        "patient",
                        "enc",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "entryAct",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "(code = '48765-2')"
                }
              ],
              "rule" : [
                {
                  "name" : "allergy",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e5"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "allergy",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "AllergyIntolerance"
                        }
                      ]
                    },
                    {
                      "context" : "allergy",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid5",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/AllergyIntolerance/"
                        },
                        {
                          "valueId" : "uuid5"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "AllergyIntolerance"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/AllergyIntolerance/' + %allergy.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "allergyFunction",
                      "variable" : [
                        "act",
                        "allergy",
                        "patient",
                        "enc"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "terapia",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '10160-0'"
                }
              ],
              "rule" : [
                {
                  "name" : "TerapiaFarmacologica",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "substanceAdministration",
                      "variable" : "subAdmin"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e6"
                    },
                    {
                      "context" : "e6",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e6",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "medicationstatement",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "MedicationStatement"
                        }
                      ]
                    },
                    {
                      "context" : "medicationstatement",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid6",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e6",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/MedicationStatement/"
                        },
                        {
                          "valueId" : "uuid6"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "MedicationStatement"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/MedicationStatement/' + %medicationstatement.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "MedicationStatement",
                      "variable" : [
                        "subAdmin",
                        "medicationstatement",
                        "patient",
                        "enc",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "vacc",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '11369-6'"
                }
              ],
              "rule" : [
                {
                  "name" : "immunization",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "substanceAdministration",
                      "variable" : "subVACC"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e7"
                    },
                    {
                      "context" : "e7",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e7",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "immunization",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Immunization"
                        }
                      ]
                    },
                    {
                      "context" : "immunization",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid7",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e7",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Immunization/"
                        },
                        {
                          "valueId" : "uuid7"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Immunization"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Immunization/' + %immunization.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Immunization",
                      "variable" : [
                        "subVACC",
                        "patient",
                        "enc",
                        "immunization",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "family",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '10157-6'"
                }
              ],
              "rule" : [
                {
                  "name" : "family",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "organizer",
                      "variable" : "organizer"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e12"
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "familyMember",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "FamilyMemberHistory"
                        }
                      ]
                    },
                    {
                      "context" : "familyMember",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid12",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/FamilyMemberHistory/"
                        },
                        {
                          "valueId" : "uuid12"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "FamilyMemberHistory"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/FamilyMemberHistory/' + %familyMember.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "FamilyMemberFunction",
                      "variable" : [
                        "organizer",
                        "familyMember",
                        "patient"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "impianti",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '46264-8'"
                }
              ],
              "rule" : [
                {
                  "name" : "protesi",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "supply",
                      "variable" : "supply"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e8"
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "procedure",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "procedure",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid8",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Procedure/"
                        },
                        {
                          "valueId" : "uuid8"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Procedure/' + %procedure.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Procedure",
                      "variable" : [
                        "supply",
                        "patient",
                        "enc",
                        "procedure",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "trattamentiProcedure",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '47519-4'"
                }
              ],
              "rule" : [
                {
                  "name" : "tratt",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "procedure",
                      "variable" : "procedure"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e9"
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "procedure2",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "procedure2",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid9",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Procedure/"
                        },
                        {
                          "valueId" : "uuid9"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Procedure/' + %procedure2.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Procedure",
                      "variable" : [
                        "procedure",
                        "patient",
                        "enc",
                        "procedure2",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "visiteRicoveri",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '46240-8'"
                }
              ],
              "rule" : [
                {
                  "name" : "encounter",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "encounter",
                      "variable" : "encounter"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e9"
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "encounterF",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Encounter"
                        }
                      ]
                    },
                    {
                      "context" : "encounterF",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid9",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e9",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Encounter/"
                        },
                        {
                          "valueId" : "uuid9"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Encounter"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Encounter/' + %encounterF.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "EncounterFunction",
                      "variable" : [
                        "encounter",
                        "patient",
                        "enc",
                        "encounterF",
                        "bundle"
                      ]
                    }
                  ],
                  "documentation" : "entry.encounter as encounter -> enc then{"
                }
              ]
            },
            {
              "name" : "esenzioni",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '57827-8'"
                }
              ],
              "rule" : [
                {
                  "name" : "esen",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e13"
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "coverage",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coverage"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid13",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Coverage/"
                        },
                        {
                          "valueId" : "uuid13"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Coverage"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Coverage/' + %coverage.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Coverage",
                      "variable" : [
                        "act",
                        "patient",
                        "enc",
                        "coverage",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "retiPatologia",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = 'PSSIT99'"
                }
              ],
              "rule" : [
                {
                  "name" : "OrgAffiliation",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e14"
                    },
                    {
                      "context" : "e14",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e14",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "affiliation",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "OrganizationAffiliation"
                        }
                      ]
                    },
                    {
                      "context" : "affiliation",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid14",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e14",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/OrganizationAffiliation/"
                        },
                        {
                          "valueId" : "uuid14"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "OrganizationAffiliation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/OrganizationAffiliation/' + %affiliation.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "OrganizationAffiliation",
                      "variable" : [
                        "act",
                        "patient",
                        "enc",
                        "affiliation",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "esiste",
          "source" : [
            {
              "context" : "src",
              "condition" : "src.entry.exists()"
            }
          ],
          "rule" : [
            {
              "name" : "raccoglitore",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '18776-5'"
                }
              ],
              "rule" : [
                {
                  "name" : "pianiCura",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e11"
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "careplan",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CarePlan"
                        }
                      ]
                    },
                    {
                      "context" : "careplan",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid11",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/CarePlan/"
                        },
                        {
                          "valueId" : "uuid11"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "CarePlan"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/CarePlan/' + %careplan.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "prestazioni",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "entry",
                          "variable" : "entry"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "CarePlanFunction",
                          "variable" : [
                            "entry",
                            "careplan",
                            "patient",
                            "enc",
                            "bundle"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "src",
              "condition" : "src.entry.exists().not()"
            }
          ],
          "rule" : [
            {
              "name" : "familyraccoglitore",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '10157-6'"
                }
              ],
              "rule" : [
                {
                  "name" : "family",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e12"
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "familyMember",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "FamilyMemberHistory"
                        }
                      ]
                    },
                    {
                      "context" : "familyMember",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid12",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e12",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/FamilyMemberHistory/"
                        },
                        {
                          "valueId" : "uuid12"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "FamilyMemberHistory"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/FamilyMemberHistory/' + %familyMember.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "familyMember",
                          "contextType" : "variable",
                          "element" : "patient",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/Patient/' + %patient.id"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "statusS",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "familyMember",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "health-unknown"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "familyMember",
                          "contextType" : "variable",
                          "element" : "note",
                          "variable" : "note"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "text",
                              "variable" : "t"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "note",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "t"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "medication",
                      "source" : [
                        {
                          "context" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "familyMember",
                          "contextType" : "variable",
                          "element" : "relationship",
                          "variable" : "relation",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "CodeableConcept"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "text",
                          "source" : [
                            {
                              "context" : "text",
                              "variable" : "txt"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "relation",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "txt"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation" : "Anmanesi Familiare narrativa"
            },
            {
              "name" : "raccoglitore",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "code = '18776-5'"
                }
              ],
              "rule" : [
                {
                  "name" : "pianiCura",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e11"
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "careplan",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CarePlan"
                        }
                      ]
                    },
                    {
                      "context" : "careplan",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid11",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e11",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/CarePlan/"
                        },
                        {
                          "valueId" : "uuid11"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "CarePlan"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/CarePlan/' + %careplan.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "careplan",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/Patient/' + %patient.id"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "status",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "careplan",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "active"
                            }
                          ]
                        }
                      ],
                      "documentation" : "src-> careplan.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) \"reference\";"
                    },
                    {
                      "name" : "intent",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "careplan",
                          "contextType" : "variable",
                          "element" : "intent",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "order"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "careplan",
                          "contextType" : "variable",
                          "element" : "note",
                          "variable" : "note"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "text",
                              "variable" : "t"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "note",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "t"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation" : "Piano di cura narrativa"
            },
            {
              "name" : "narrative",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "condition" : "(code = '30954-2') or (code = '29762-2') or (code = '8716-3') or (code = '47420-5') or (code = '42348-3')"
                }
              ],
              "rule" : [
                {
                  "name" : "txtsec",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e13"
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "obs1",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "obs1",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid13",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e13",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid13"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %obs1.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obs1",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/Patient/' + %patient.id"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "obsst",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obs1",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "preliminary"
                            }
                          ]
                        }
                      ],
                      "documentation" : "src -> obs1.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) \"reference\";"
                    },
                    {
                      "name" : "obscde",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obs1",
                          "contextType" : "variable",
                          "element" : "code",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "statusS",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obs1",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "final"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "narrative",
                      "source" : [
                        {
                          "context" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obs1",
                          "contextType" : "variable",
                          "element" : "note",
                          "variable" : "note"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "note",
                          "source" : [
                            {
                              "context" : "text",
                              "variable" : "t"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "note",
                              "contextType" : "variable",
                              "element" : "text",
                              "variable" : "textNote",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "string"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "EDstring",
                              "variable" : [
                                "t",
                                "textNote"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ],
              "documentation" : "sezioni che sono narrative"
            }
          ]
        },
        {
          "name" : "component",
          "source" : [
            {
              "context" : "src",
              "element" : "component",
              "variable" : "component"
            }
          ],
          "rule" : [
            {
              "name" : "section",
              "source" : [
                {
                  "context" : "component",
                  "element" : "section",
                  "variable" : "sec"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "section",
                  "variable" : "tgtSection"
                }
              ],
              "dependent" : [
                {
                  "name" : "ClinicalDocumentSection",
                  "variable" : [
                    "cda",
                    "sec",
                    "patient",
                    "tgtSection",
                    "bundle",
                    "enc",
                    "dReport"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Procedure",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "cdaElement",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Procedure",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "tx",
          "source" : [
            {
              "context" : "src",
              "element" : "text",
              "variable" : "tx"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "r",
              "source" : [
                {
                  "context" : "tx",
                  "element" : "reference",
                  "variable" : "reff"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reff.value"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "toASK"
        },
        {
          "name" : "ref",
          "source" : [
            {
              "context" : "src",
              "element" : "templateId",
              "condition" : "root = '2.16.840.1.113883.2.9.10.1.4.3.10.3'"
            }
          ],
          "rule" : [
            {
              "name" : "effectiveTime",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "performed",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "effectiveTime.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            }
          ]
        },
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "s"
            }
          ],
          "rule" : [
            {
              "name" : "codeS",
              "source" : [
                {
                  "context" : "s",
                  "element" : "code",
                  "variable" : "cos"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "cos"
                    },
                    {
                      "valueString" : "#EventStatus"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "src -> tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "status2",
          "source" : [
            {
              "context" : "src",
              "condition" : "statusCode.exists().not()"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "unknown"
                }
              ]
            }
          ]
        },
        {
          "name" : "presenzaProtesiImpianto",
          "source" : [
            {
              "context" : "src",
              "element" : "templateId",
              "condition" : "root = '2.16.840.1.113883.2.9.10.1.4.3.9.1'"
            }
          ],
          "rule" : [
            {
              "name" : "device",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e1"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "request",
                  "variable" : "request",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "method",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "POST"
                    }
                  ]
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "deviceRes",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Device"
                    }
                  ]
                },
                {
                  "context" : "deviceRes",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid1",
                  "transform" : "uuid"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/Device/"
                    },
                    {
                      "valueId" : "uuid1"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Device"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "usedReference",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Device/' + %deviceRes.id"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "deviceRes",
                      "contextType" : "variable",
                      "element" : "patient",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Patient/' + %patient.id"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "code",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "deviceRes",
                      "contextType" : "variable",
                      "element" : "type",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "value1",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime",
                  "condition" : "(value.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "performed",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "dateTime"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            },
            {
              "name" : "valuePeriod",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime",
                  "condition" : "(low.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "performed",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "IVLTSPeriod",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "assenza",
          "source" : [
            {
              "context" : "src",
              "element" : "templateId",
              "condition" : "root = '2.16.840.1.113883.2.9.10.1.4.3.9.2'"
            }
          ],
          "rule" : [
            {
              "name" : "note",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "code"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "note",
                  "variable" : "note"
                }
              ],
              "rule" : [
                {
                  "name" : "text",
                  "source" : [
                    {
                      "context" : "code",
                      "element" : "displayName",
                      "variable" : "displayName"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "note",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "displayName"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "procedureTrattamenti",
          "source" : [
            {
              "context" : "src",
              "element" : "templateId",
              "condition" : "root = '2.16.840.1.113883.2.9.10.1.4.3.11.1'"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            },
            {
              "name" : "value1",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime",
                  "condition" : "(value.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "performed",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "dateTime"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            },
            {
              "name" : "valuePeriod",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime",
                  "condition" : "(low.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "performed",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "IVLTSPeriod",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            },
            {
              "name" : "entryRelProcedure",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entryRelationship",
                  "variable" : "entryR"
                }
              ],
              "rule" : [
                {
                  "name" : "observation",
                  "source" : [
                    {
                      "context" : "entryR",
                      "element" : "observation",
                      "variable" : "observation"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e3"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "obs1",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "obs1",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid3",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "reasonReference",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %obs1.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Observation",
                      "variable" : [
                        "observation",
                        "patient",
                        "encounter",
                        "obs1",
                        "bundle"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Observation",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "cda",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "ob",
          "type" : "Observation",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "cda",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ],
          "documentation" : "cda-> ob.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "cda",
              "element" : "code",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "Stats",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "value",
          "source" : [
            {
              "context" : "cda",
              "type" : "ST",
              "element" : "value",
              "variable" : "st"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "string"
                }
              ]
            },
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "st.dataString"
                }
              ]
            }
          ],
          "documentation" : "value datatype"
        },
        {
          "name" : "boolean",
          "source" : [
            {
              "context" : "cda",
              "type" : "BL",
              "element" : "value",
              "variable" : "boolean"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "boolean.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "intval",
          "source" : [
            {
              "context" : "cda",
              "type" : "INT",
              "element" : "value",
              "variable" : "int"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "int.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "val",
          "source" : [
            {
              "context" : "cda",
              "type" : "CE",
              "element" : "value",
              "variable" : "val"
            }
          ],
          "rule" : [
            {
              "name" : "coding",
              "source" : [
                {
                  "context" : "val"
                }
              ],
              "target" : [
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "ce",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "originalText",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "originalText",
                      "variable" : "originalText"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "originalText",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ce",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "val"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "ce",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "code",
                          "variable" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "code"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "codeSystem",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "codeSystem",
                          "variable" : "system"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "system"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "displayName",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "displayName",
                          "variable" : "display"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "display"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "translation",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "translation",
                      "variable" : "translation"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "ce",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "code",
                          "variable" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "code"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "codeSystem",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "codeSystem",
                          "variable" : "system"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "system"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "displayName",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "displayName",
                          "variable" : "display"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "display"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "qualifier",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "qualifier",
                          "variable" : "qualifier"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "qualifier",
                              "element" : "value",
                              "variable" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "ce",
                              "contextType" : "variable",
                              "element" : "coding",
                              "variable" : "coding"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "code",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "code",
                                  "variable" : "code"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "code",
                                  "transform" : "cast",
                                  "parameter" : [
                                    {
                                      "valueId" : "code"
                                    },
                                    {
                                      "valueString" : "string"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "codeSystem",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "codeSystem",
                                  "variable" : "system"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "system",
                                  "transform" : "translate",
                                  "parameter" : [
                                    {
                                      "valueId" : "system"
                                    },
                                    {
                                      "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                    },
                                    {
                                      "valueString" : "uri"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "displayName",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "displayName",
                                  "variable" : "display"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "display",
                                  "transform" : "cast",
                                  "parameter" : [
                                    {
                                      "valueId" : "display"
                                    },
                                    {
                                      "valueString" : "string"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "val",
          "source" : [
            {
              "context" : "cda",
              "type" : "CD",
              "element" : "value",
              "variable" : "val"
            }
          ],
          "rule" : [
            {
              "name" : "coding",
              "source" : [
                {
                  "context" : "val"
                }
              ],
              "target" : [
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "ce",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "originalText",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "originalText",
                      "variable" : "originalText"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "originalText",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ce",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "val"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "ce",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "code",
                          "variable" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "code"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "codeSystem",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "codeSystem",
                          "variable" : "system"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "system"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "displayName",
                      "source" : [
                        {
                          "context" : "val",
                          "element" : "displayName",
                          "variable" : "display"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "display"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "translation",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "translation",
                      "variable" : "translation"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "ce",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "code",
                          "variable" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "code"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "codeSystem",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "codeSystem",
                          "variable" : "system"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "system"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "displayName",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "displayName",
                          "variable" : "display"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "cast",
                          "parameter" : [
                            {
                              "valueId" : "display"
                            },
                            {
                              "valueString" : "string"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "qualifier",
                      "source" : [
                        {
                          "context" : "translation",
                          "element" : "qualifier",
                          "variable" : "qualifier"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "qualifier",
                              "element" : "value",
                              "variable" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "ce",
                              "contextType" : "variable",
                              "element" : "coding",
                              "variable" : "coding"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "code",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "code",
                                  "variable" : "code"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "code",
                                  "transform" : "cast",
                                  "parameter" : [
                                    {
                                      "valueId" : "code"
                                    },
                                    {
                                      "valueString" : "string"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "codeSystem",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "codeSystem",
                                  "variable" : "system"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "system",
                                  "transform" : "translate",
                                  "parameter" : [
                                    {
                                      "valueId" : "system"
                                    },
                                    {
                                      "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                    },
                                    {
                                      "valueString" : "uri"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "displayName",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "displayName",
                                  "variable" : "display"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "display",
                                  "transform" : "cast",
                                  "parameter" : [
                                    {
                                      "valueId" : "display"
                                    },
                                    {
                                      "valueString" : "string"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "valueQuantity",
          "source" : [
            {
              "context" : "cda",
              "type" : "PQ",
              "element" : "value",
              "variable" : "val"
            }
          ],
          "rule" : [
            {
              "name" : "quantity",
              "source" : [
                {
                  "context" : "val"
                }
              ],
              "target" : [
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "value",
                  "variable" : "quantity",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Quantity"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "value",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "value",
                      "variable" : "value"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "quantity",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "unit",
                  "source" : [
                    {
                      "context" : "val",
                      "element" : "unit",
                      "variable" : "unit"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "quantity",
                      "contextType" : "variable",
                      "element" : "unit",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "unit"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "value1",
          "source" : [
            {
              "context" : "cda",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(value.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "valuePeriod",
          "source" : [
            {
              "context" : "cda",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(low.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "IVLTSPeriod",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "cda",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "text",
              "source" : [
                {
                  "context" : "text",
                  "element" : "reference",
                  "variable" : "reference"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reference.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "cda",
              "element" : "statusCode",
              "variable" : "s"
            }
          ],
          "rule" : [
            {
              "name" : "codeS",
              "source" : [
                {
                  "context" : "s",
                  "element" : "code",
                  "variable" : "cos"
                }
              ],
              "target" : [
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "cos"
                    },
                    {
                      "valueString" : "#OBSstatus"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "methodCode",
          "source" : [
            {
              "context" : "cda",
              "element" : "methodCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "method",
              "variable" : "vvv",
              "transform" : "create"
            }
          ],
          "documentation" : "toASK è giusto siano invertiti?"
        },
        {
          "name" : "interpretationCode",
          "source" : [
            {
              "context" : "cda",
              "element" : "interpretationCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "interpretation",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "targetSiteCode",
          "source" : [
            {
              "context" : "cda",
              "element" : "targetSiteCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "bodySite",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "regrange",
          "source" : [
            {
              "context" : "cda",
              "element" : "referenceRange",
              "variable" : "refrange"
            }
          ],
          "rule" : [
            {
              "name" : "obsrange",
              "source" : [
                {
                  "context" : "refrange",
                  "element" : "observationRange",
                  "variable" : "obsrange"
                }
              ],
              "rule" : [
                {
                  "name" : "refFhir",
                  "source" : [
                    {
                      "context" : "obsrange",
                      "element" : "value",
                      "variable" : "val"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "ob",
                      "contextType" : "variable",
                      "element" : "referenceRange",
                      "variable" : "refrangeFH",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "de",
                      "source" : [
                        {
                          "context" : "val"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "refrangeFH",
                          "contextType" : "variable",
                          "element" : "low",
                          "variable" : "lowfhir",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "SimpleQuantity"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "val",
                              "element" : "low",
                              "variable" : "l"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "lowfhir",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "l.value"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "val",
                              "element" : "low",
                              "variable" : "l"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "lowfhir",
                              "contextType" : "variable",
                              "element" : "unit",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "l.unit"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "de",
                      "source" : [
                        {
                          "context" : "val"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "refrangeFH",
                          "contextType" : "variable",
                          "element" : "high",
                          "variable" : "highfhir",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "SimpleQuantity"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "val",
                              "element" : "high",
                              "variable" : "h"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "highfhir",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "h.value"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "val",
                              "element" : "high",
                              "variable" : "h"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "highfhir",
                              "contextType" : "variable",
                              "element" : "unit",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "h.unit"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "added"
        }
      ]
    },
    {
      "name" : "ObservationOrganizer",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "section",
          "type" : "section",
          "mode" : "source"
        },
        {
          "name" : "cda",
          "type" : "organizer",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "ob",
          "type" : "Observation",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "cda",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ],
          "documentation" : "cda-> ob.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "section",
              "element" : "code",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "Stats",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "value1",
          "source" : [
            {
              "context" : "cda",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(value.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "valuePeriod",
          "source" : [
            {
              "context" : "cda",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(low.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "IVLTSPeriod",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "cda",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "ob",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "text",
              "source" : [
                {
                  "context" : "text",
                  "element" : "reference",
                  "variable" : "reference"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reference.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "cda",
              "element" : "statusCode",
              "variable" : "s"
            }
          ],
          "rule" : [
            {
              "name" : "codeS",
              "source" : [
                {
                  "context" : "s",
                  "element" : "code",
                  "variable" : "cos"
                }
              ],
              "target" : [
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "cos"
                    },
                    {
                      "valueString" : "#OBSstatus"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "component",
          "source" : [
            {
              "context" : "cda",
              "element" : "component",
              "variable" : "component"
            }
          ],
          "rule" : [
            {
              "name" : "hasMember",
              "source" : [
                {
                  "context" : "component",
                  "element" : "observation",
                  "variable" : "observation"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "ei"
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "request",
                  "variable" : "request",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "method",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "POST"
                    }
                  ]
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "obsi",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Observation"
                    }
                  ]
                },
                {
                  "context" : "obsi",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuidi",
                  "transform" : "uuid"
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/Observation/"
                    },
                    {
                      "valueId" : "uuidi"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Observation"
                    }
                  ]
                },
                {
                  "context" : "ob",
                  "contextType" : "variable",
                  "element" : "hasMember",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Observation/' + %obsi.id"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "Observation",
                  "variable" : [
                    "observation",
                    "patient",
                    "encounter",
                    "obsi",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Coverage",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "act",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Coverage",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "payor",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "idf"
            }
          ],
          "rule" : [
            {
              "name" : "ID",
              "source" : [
                {
                  "context" : "id"
                }
              ],
              "target" : [
                {
                  "context" : "idf",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "id.root"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "sc",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "statusCode"
            }
          ],
          "rule" : [
            {
              "name" : "status",
              "source" : [
                {
                  "context" : "statusCode",
                  "element" : "code",
                  "variable" : "s"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "s"
                    },
                    {
                      "valueString" : "#FinancialStatus"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "statusAbsent",
          "source" : [
            {
              "context" : "src",
              "condition" : "statusCode.exists().not()"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            }
          ]
        },
        {
          "name" : "value1",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(value.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "period",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ],
          "documentation" : "src.effectiveTime as effectiveTime -> tgt.period as period then{"
        },
        {
          "name" : "valuePeriod",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "effectiveTime",
              "condition" : "(low.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "period",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "IVLTSPeriod",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "entryr",
          "source" : [
            {
              "context" : "src",
              "element" : "entryRelationship",
              "variable" : "entryRelationship"
            }
          ],
          "rule" : [
            {
              "name" : "QUI",
              "source" : [
                {
                  "context" : "entryRelationship",
                  "element" : "act",
                  "variable" : "ac"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "class",
                  "variable" : "class"
                }
              ],
              "rule" : [
                {
                  "name" : "ref",
                  "source" : [
                    {
                      "context" : "ac",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "class",
                      "contextType" : "variable",
                      "element" : "type",
                      "variable" : "type"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "value",
                      "source" : [
                        {
                          "context" : "text",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "type",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "note",
                  "source" : [
                    {
                      "context" : "ac"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "class",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "commenti"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "allergyFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "cdaElement",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "AllergyIntolerance",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "efftime",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "effTime"
            }
          ],
          "rule" : [
            {
              "name" : "value",
              "source" : [
                {
                  "context" : "effTime",
                  "element" : "low",
                  "variable" : "l"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "recordedDate",
                  "variable" : "r"
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "l",
                    "r"
                  ]
                }
              ]
            }
          ],
          "documentation" : "src -> tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "entryrelationship",
          "source" : [
            {
              "context" : "src",
              "element" : "entryRelationship",
              "variable" : "entryRelationship1"
            }
          ],
          "rule" : [
            {
              "name" : "observation",
              "source" : [
                {
                  "context" : "entryRelationship1",
                  "element" : "observation",
                  "variable" : "observation1"
                }
              ],
              "rule" : [
                {
                  "name" : "id",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "id",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "identifier",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "Noallergy",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "templateId",
                      "condition" : "root = '2.16.840.1.113883.2.9.10.1.4.3.1.4'"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "code"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "observation1"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "code",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "coding"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "code",
                          "source" : [
                            {
                              "context" : "observation1"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "No known allergy"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "value1",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "effectiveTime",
                          "variable" : "effectiveTime",
                          "condition" : "(value.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "onset",
                          "variable" : "value",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "dateTime"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "TSDateTime",
                          "variable" : [
                            "effectiveTime",
                            "value"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "valuePeriod",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "effectiveTime",
                          "variable" : "effectiveTime"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "onset",
                          "variable" : "value",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Period"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "IVLTSPeriod",
                          "variable" : [
                            "effectiveTime",
                            "value"
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "value1",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "effectiveTime",
                      "variable" : "effectiveTime",
                      "condition" : "(value.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "onset",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "dateTime"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDateTime",
                      "variable" : [
                        "effectiveTime",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "valuePeriod",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "effectiveTime",
                      "variable" : "effectiveTime"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "onset",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Period"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "IVLTSPeriod",
                      "variable" : [
                        "effectiveTime",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "value",
                      "variable" : "code"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "type",
                      "source" : [
                        {
                          "context" : "code",
                          "element" : "code",
                          "variable" : "code1"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "type",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "code1"
                            },
                            {
                              "valueString" : "#AllergyTypeMap"
                            },
                            {
                              "valueString" : "code"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "category",
                      "source" : [
                        {
                          "context" : "code",
                          "element" : "code",
                          "variable" : "code1"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "category",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "code1"
                            },
                            {
                              "valueString" : "#AllergyCategoryMap"
                            },
                            {
                              "valueString" : "code"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "value",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "value",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ],
                  "documentation" : "toASK qui dovrei fare un controllo sul code"
                },
                {
                  "name" : "participant",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "participant",
                      "variable" : "participant"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "reaction",
                      "variable" : "reaction"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "entryR2",
                      "source" : [
                        {
                          "context" : "observation1",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship2",
                          "condition" : "(typeCode = 'MFST')"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "observ2",
                          "source" : [
                            {
                              "context" : "entryRelationship2",
                              "element" : "observation",
                              "variable" : "observation2"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "manifestation",
                              "source" : [
                                {
                                  "context" : "observation2",
                                  "element" : "value",
                                  "variable" : "vvv"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "reaction",
                                  "contextType" : "variable",
                                  "element" : "manifestation",
                                  "variable" : "vvv",
                                  "transform" : "create"
                                }
                              ]
                            },
                            {
                              "name" : "manifestation",
                              "source" : [
                                {
                                  "context" : "observation2",
                                  "element" : "code",
                                  "variable" : "vvv"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "reaction",
                                  "contextType" : "variable",
                                  "element" : "manifestation",
                                  "variable" : "vvv",
                                  "transform" : "create"
                                }
                              ]
                            },
                            {
                              "name" : "tx",
                              "source" : [
                                {
                                  "context" : "observation2",
                                  "element" : "text",
                                  "variable" : "tx"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "tx",
                                  "source" : [
                                    {
                                      "context" : "tx",
                                      "element" : "reference",
                                      "variable" : "reff"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "reaction",
                                      "contextType" : "variable",
                                      "element" : "description",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "reff.value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "observation2",
                                  "element" : "effectiveTime",
                                  "variable" : "effectiveTime"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "valuePeriodLow",
                                  "source" : [
                                    {
                                      "context" : "effectiveTime",
                                      "element" : "low",
                                      "variable" : "low"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "reaction",
                                      "contextType" : "variable",
                                      "element" : "onset",
                                      "variable" : "value",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "dateTime"
                                        }
                                      ]
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "TSDateTime",
                                      "variable" : [
                                        "low",
                                        "value"
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "valuePeriodHigh",
                                  "source" : [
                                    {
                                      "context" : "effectiveTime",
                                      "element" : "high",
                                      "variable" : "high"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "tgt",
                                      "contextType" : "variable",
                                      "element" : "lastOccurrence",
                                      "variable" : "value",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "dateTime"
                                        }
                                      ]
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "TSDateTime",
                                      "variable" : [
                                        "high",
                                        "value"
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "participantRole",
                      "source" : [
                        {
                          "context" : "participant",
                          "element" : "participantRole",
                          "variable" : "participantRole"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "playingEntity",
                          "source" : [
                            {
                              "context" : "participantRole",
                              "element" : "playingEntity",
                              "variable" : "playingEntity"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "reaction",
                              "source" : [
                                {
                                  "context" : "playingEntity",
                                  "element" : "code",
                                  "variable" : "vvv"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "reaction",
                                  "contextType" : "variable",
                                  "element" : "substance",
                                  "variable" : "vvv",
                                  "transform" : "create"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "entryR2",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "entryRelationship",
                      "variable" : "entryRelationship2",
                      "condition" : "(typeCode = 'MFST')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observ2",
                      "source" : [
                        {
                          "context" : "entryRelationship2",
                          "element" : "observation",
                          "variable" : "observation2",
                          "condition" : "observation1.participant.exists().not()"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "reaction",
                          "variable" : "reaction"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "manifestation",
                          "source" : [
                            {
                              "context" : "observation2",
                              "element" : "value",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "reaction",
                              "contextType" : "variable",
                              "element" : "manifestation",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        },
                        {
                          "name" : "tx",
                          "source" : [
                            {
                              "context" : "observation2",
                              "element" : "text",
                              "variable" : "tx"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "tx",
                              "source" : [
                                {
                                  "context" : "tx",
                                  "element" : "reference",
                                  "variable" : "reff"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "reaction",
                                  "contextType" : "variable",
                                  "element" : "description",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "reff.value"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "low",
                          "source" : [
                            {
                              "context" : "observation2",
                              "element" : "effectiveTime",
                              "variable" : "effectiveTime"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "valuePeriodLow",
                              "source" : [
                                {
                                  "context" : "effectiveTime",
                                  "element" : "low",
                                  "variable" : "low"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "reaction",
                                  "contextType" : "variable",
                                  "element" : "onset",
                                  "variable" : "value",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "dateTime"
                                    }
                                  ]
                                }
                              ],
                              "dependent" : [
                                {
                                  "name" : "TSDateTime",
                                  "variable" : [
                                    "low",
                                    "value"
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "entryR3",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "entryRelationship",
                      "variable" : "entryRelationship3",
                      "condition" : "(typeCode = 'SUBJ')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observ3",
                      "source" : [
                        {
                          "context" : "entryRelationship3",
                          "element" : "observation",
                          "variable" : "observation3"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "criticality",
                          "source" : [
                            {
                              "context" : "observation3",
                              "element" : "value",
                              "variable" : "value"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "value",
                                  "element" : "code",
                                  "variable" : "c"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "criticality",
                                  "transform" : "translate",
                                  "parameter" : [
                                    {
                                      "valueId" : "c"
                                    },
                                    {
                                      "valueString" : "#CricalityMap"
                                    },
                                    {
                                      "valueString" : "code"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "act",
                      "source" : [
                        {
                          "context" : "entryRelationship3",
                          "element" : "act",
                          "variable" : "act"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "note",
                          "variable" : "note"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "note",
                          "source" : [
                            {
                              "context" : "act",
                              "element" : "text",
                              "variable" : "text"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "reference",
                              "source" : [
                                {
                                  "context" : "text",
                                  "element" : "reference",
                                  "variable" : "reference"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "note",
                                  "contextType" : "variable",
                                  "element" : "text",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "reference.value"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "entryR4",
                  "source" : [
                    {
                      "context" : "observation1",
                      "element" : "entryRelationship",
                      "variable" : "entryRelationship4",
                      "condition" : "(typeCode = 'REFR')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observ4",
                      "source" : [
                        {
                          "context" : "entryRelationship4",
                          "element" : "observation",
                          "variable" : "observation4"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "clinicalStatus",
                          "source" : [
                            {
                              "context" : "observation4"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgt",
                              "contextType" : "variable",
                              "element" : "clinicalStatus",
                              "variable" : "clinicalStatus"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "observation4",
                                  "element" : "value",
                                  "variable" : "value"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "coding",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "variable" : "valu"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "clinicalStatus",
                                      "contextType" : "variable",
                                      "element" : "coding",
                                      "variable" : "coding",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Coding"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "valu",
                                          "condition" : "(code = 'LA9041-0')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "resolved"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "valu",
                                          "condition" : "(code = 'LA18632-2')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "inactive"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "valu",
                                          "condition" : "(code = 'LA16666-2')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "active"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "system",
                                      "source" : [
                                        {
                                          "context" : "valu"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "system",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "display",
                                      "source" : [
                                        {
                                          "context" : "valu",
                                          "element" : "displayName",
                                          "variable" : "display"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "display",
                                          "transform" : "cast",
                                          "parameter" : [
                                            {
                                              "valueId" : "display"
                                            },
                                            {
                                              "valueString" : "string"
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "tx",
                              "source" : [
                                {
                                  "context" : "observation4",
                                  "element" : "text",
                                  "variable" : "tx"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "reference",
                                  "source" : [
                                    {
                                      "context" : "tx",
                                      "element" : "reference",
                                      "variable" : "ref"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "clinicalStatus",
                                      "contextType" : "variable",
                                      "element" : "text",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "ref.value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "MedicationStatement",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "substanceAdministration",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "MedicationStatement",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "variable" : "vvv",
              "transform" : "create"
            }
          ],
          "documentation" : "src -> tgt.context = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "src",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "text",
              "source" : [
                {
                  "context" : "text",
                  "element" : "reference",
                  "variable" : "reference"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reference.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "value1",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "eff",
              "condition" : "(value.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "eff",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "valuePeriod",
          "source" : [
            {
              "context" : "src",
              "type" : "IVL_TS",
              "element" : "effectiveTime",
              "variable" : "eff"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "IVLTSPeriod",
              "variable" : [
                "eff",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "dos",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "dosage",
              "variable" : "dosage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Dosage"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "eff",
              "source" : [
                {
                  "context" : "src",
                  "type" : "PIVL_TS",
                  "element" : "effectiveTime",
                  "variable" : "eff"
                }
              ],
              "rule" : [
                {
                  "name" : "cod",
                  "source" : [
                    {
                      "context" : "eff"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosage",
                      "contextType" : "variable",
                      "element" : "timing",
                      "variable" : "timing",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Timing"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "periodTiming",
                      "variable" : [
                        "eff",
                        "timing"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "route",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "(src.doseQuantity.exists() or src.rateQuantity.exists() or src.routeCode.exists() or src.approachSiteCode.exists())"
                }
              ],
              "rule" : [
                {
                  "name" : "doseQuantity",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "doseQuantity",
                      "variable" : "doseQuant"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ot",
                      "source" : [
                        {
                          "context" : "doseQuant",
                          "element" : "originalText",
                          "variable" : "ot"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "ot",
                              "element" : "reference",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosage",
                              "contextType" : "variable",
                              "element" : "text",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "dosageRate",
                      "source" : [
                        {
                          "context" : "doseQuant"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "dosage",
                          "contextType" : "variable",
                          "element" : "doseAndRate",
                          "variable" : "dosageRate"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "d",
                          "source" : [
                            {
                              "context" : "doseQuant"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageRate",
                              "contextType" : "variable",
                              "element" : "dose",
                              "variable" : "d",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Range"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "doseQuant"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "low",
                                  "variable" : "l",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "doseQuant"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "high",
                                  "variable" : "h",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "rate",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "rateQuantity",
                      "variable" : "rateQuantity"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ot",
                      "source" : [
                        {
                          "context" : "rateQuantity",
                          "element" : "originalText",
                          "variable" : "ot"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "ot",
                              "element" : "reference",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosage",
                              "contextType" : "variable",
                              "element" : "text",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "dosageRate",
                      "source" : [
                        {
                          "context" : "rateQuantity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "dosage",
                          "contextType" : "variable",
                          "element" : "doseAndRate",
                          "variable" : "dosageRate"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "r",
                          "source" : [
                            {
                              "context" : "rateQuantity"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageRate",
                              "contextType" : "variable",
                              "element" : "rate",
                              "variable" : "d",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Range"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "rateQuantity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "low",
                                  "variable" : "l",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "high",
                              "source" : [
                                {
                                  "context" : "rateQuantity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "high",
                                  "variable" : "h",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "route",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "routeCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosage",
                      "contextType" : "variable",
                      "element" : "route",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "site",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "approachSiteCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosage",
                      "contextType" : "variable",
                      "element" : "site",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "site",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "targetSiteCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosage",
                      "contextType" : "variable",
                      "element" : "site",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "consumable",
          "source" : [
            {
              "context" : "src",
              "element" : "consumable",
              "variable" : "consumable"
            }
          ],
          "rule" : [
            {
              "name" : "medication",
              "source" : [
                {
                  "context" : "consumable",
                  "element" : "manufacturedProduct",
                  "variable" : "manufacturedProduct"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e1"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "request",
                  "variable" : "request",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "method",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "POST"
                    }
                  ]
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "medication",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Medication"
                    }
                  ]
                },
                {
                  "context" : "medication",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid1",
                  "transform" : "uuid"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/Medication/"
                    },
                    {
                      "valueId" : "uuid1"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Medication"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "medication",
                  "variable" : "medref",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "medref",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Medication/' + %medication.id"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "Medication",
                  "variable" : [
                    "src",
                    "medication",
                    "patient",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "periodTiming",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "effectiveTime",
          "type" : "PIVL_TS",
          "mode" : "source"
        },
        {
          "name" : "timing",
          "type" : "Timing",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "repeat",
          "source" : [
            {
              "context" : "effectiveTime"
            }
          ],
          "target" : [
            {
              "context" : "timing",
              "contextType" : "variable",
              "element" : "repeat",
              "variable" : "r"
            }
          ],
          "rule" : [
            {
              "name" : "period",
              "source" : [
                {
                  "context" : "effectiveTime",
                  "element" : "period",
                  "variable" : "p"
                }
              ],
              "target" : [
                {
                  "context" : "r",
                  "contextType" : "variable",
                  "element" : "period",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "p.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "period",
              "source" : [
                {
                  "context" : "effectiveTime",
                  "element" : "period",
                  "variable" : "p"
                }
              ],
              "target" : [
                {
                  "context" : "r",
                  "contextType" : "variable",
                  "element" : "periodUnit",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "p.unit"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Medication",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "substanceAdministration",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Medication",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "consumable",
          "source" : [
            {
              "context" : "src",
              "element" : "consumable",
              "variable" : "consumable"
            }
          ],
          "rule" : [
            {
              "name" : "product",
              "source" : [
                {
                  "context" : "consumable",
                  "element" : "manufacturedProduct",
                  "variable" : "manufacturedProduct"
                }
              ],
              "rule" : [
                {
                  "name" : "material",
                  "source" : [
                    {
                      "context" : "manufacturedProduct",
                      "element" : "manufacturedMaterial",
                      "variable" : "manufacturedMaterial"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "CE",
                      "source" : [
                        {
                          "context" : "manufacturedMaterial",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "code",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "form",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "administrationUnitCode",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "form",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entryR",
          "source" : [
            {
              "context" : "src",
              "element" : "entryRelationship",
              "variable" : "entryR"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entryR",
                  "element" : "observation",
                  "variable" : "observation"
                }
              ],
              "rule" : [
                {
                  "name" : "ingredient",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "code",
                      "condition" : "displayName = 'Grammatura'"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "ingredient",
                      "variable" : "ingredient"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "consumable",
                      "source" : [
                        {
                          "context" : "src",
                          "element" : "consumable",
                          "variable" : "consumable"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "product",
                          "source" : [
                            {
                              "context" : "consumable",
                              "element" : "manufacturedProduct",
                              "variable" : "manufacturedProduct"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "material",
                              "source" : [
                                {
                                  "context" : "manufacturedProduct",
                                  "element" : "manufacturedMaterial",
                                  "variable" : "manufacturedMaterial"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "CE",
                                  "source" : [
                                    {
                                      "context" : "manufacturedMaterial",
                                      "element" : "code",
                                      "variable" : "code"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ingredient",
                                      "contextType" : "variable",
                                      "element" : "item",
                                      "variable" : "value",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "CodeableConcept"
                                        }
                                      ]
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "CECodeableConcept",
                                      "variable" : [
                                        "code",
                                        "value"
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "strenght",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "value",
                          "variable" : "value"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ingredient",
                          "contextType" : "variable",
                          "element" : "strength",
                          "variable" : "strength"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "numerator",
                          "source" : [
                            {
                              "context" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "strength",
                              "contextType" : "variable",
                              "element" : "numerator",
                              "variable" : "numerator"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "valueN",
                              "source" : [
                                {
                                  "context" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "numerator",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "value.value"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "denominator",
                          "source" : [
                            {
                              "context" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "strength",
                              "contextType" : "variable",
                              "element" : "denominator",
                              "variable" : "denominator"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "valueD",
                              "source" : [
                                {
                                  "context" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "denominator",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueInteger" : 1
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "quantita",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "code",
                      "condition" : "displayName = 'Quantità nella Confezione'"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "amount",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "value",
                          "variable" : "value"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "amount",
                          "variable" : "amount"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "numerator",
                          "source" : [
                            {
                              "context" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "amount",
                              "contextType" : "variable",
                              "element" : "numerator",
                              "variable" : "numerator"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "valueN",
                              "source" : [
                                {
                                  "context" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "numerator",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "value.value"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "denominator",
                          "source" : [
                            {
                              "context" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "amount",
                              "contextType" : "variable",
                              "element" : "denominator",
                              "variable" : "denominator"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "valueD",
                              "source" : [
                                {
                                  "context" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "denominator",
                                  "contextType" : "variable",
                                  "element" : "value",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueInteger" : 1
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Immunization",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "substance",
          "type" : "substanceAdministration",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Immunization",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "patientRef",
          "source" : [
            {
              "context" : "substance"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "substance",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "idf"
            }
          ],
          "rule" : [
            {
              "name" : "root1",
              "source" : [
                {
                  "context" : "id",
                  "element" : "root",
                  "variable" : "r"
                }
              ],
              "target" : [
                {
                  "context" : "idf",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "r"
                    },
                    {
                      "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                    },
                    {
                      "valueString" : "uri"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "substance -> tgt.encounter  = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"encounterRef\";"
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "substance",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "text",
              "source" : [
                {
                  "context" : "text",
                  "element" : "reference",
                  "variable" : "reference"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reference.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "statusCode",
              "variable" : "statusc",
              "condition" : "(code = 'completed')"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "completed"
                }
              ]
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "statusCode",
              "variable" : "statusc",
              "condition" : "(code = 'aborted')"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "statusCode",
              "variable" : "statusc",
              "condition" : "(code = 'suspended')"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "enterer-in-error"
                }
              ]
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "statusCode",
              "variable" : "statusc",
              "condition" : "(code = 'cancelled')"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "not-done"
                }
              ]
            }
          ]
        },
        {
          "name" : "efftime",
          "source" : [
            {
              "context" : "substance",
              "element" : "effectiveTime",
              "variable" : "time"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "occurrence",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "time",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "routeCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "routeCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "route",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "approachSiteCode",
          "source" : [
            {
              "context" : "substance",
              "element" : "approachSiteCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "site",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "q",
          "source" : [
            {
              "context" : "substance"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "doseQuantity",
              "variable" : "quantity",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "SimpleQuantity"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "qua",
              "source" : [
                {
                  "context" : "substance",
                  "element" : "doseQuantity",
                  "variable" : "q"
                }
              ],
              "rule" : [
                {
                  "name" : "val",
                  "source" : [
                    {
                      "context" : "q"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "quantity",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "q.value"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "uni",
                  "source" : [
                    {
                      "context" : "q"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "quantity",
                      "contextType" : "variable",
                      "element" : "unit",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "q.unit"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "cons",
          "source" : [
            {
              "context" : "substance",
              "element" : "consumable",
              "variable" : "cons"
            }
          ],
          "rule" : [
            {
              "name" : "manufact",
              "source" : [
                {
                  "context" : "cons",
                  "element" : "manufacturedProduct",
                  "variable" : "manufact"
                }
              ],
              "rule" : [
                {
                  "name" : "manufactmat",
                  "source" : [
                    {
                      "context" : "manufact",
                      "element" : "manufacturedMaterial",
                      "variable" : "manufactmat"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "manufactmat",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "vaccineCode",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "lotNumberText",
                      "source" : [
                        {
                          "context" : "manufactmat",
                          "element" : "lotNumberText",
                          "variable" : "t"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "lotNumber",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "t.dataString"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "manufactOrg",
                  "source" : [
                    {
                      "context" : "manufact",
                      "element" : "manufacturerOrganization",
                      "variable" : "manufactOrg"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e1"
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "PUT"
                        }
                      ]
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "organization",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Organization"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "identifier",
                      "source" : [
                        {
                          "context" : "manufactOrg",
                          "element" : "id",
                          "variable" : "id"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "organization",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "identifier"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "root1",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "root",
                              "variable" : "r"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "r"
                                },
                                {
                                  "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                },
                                {
                                  "valueString" : "uri"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "ext",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "UUID",
                              "source" : [
                                {
                                  "context" : "manufactOrg"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "request",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "Organization?identifier="
                                    },
                                    {
                                      "valueId" : "ext"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "assigningAuthorityName",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "assigningAuthorityName",
                              "variable" : "s"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "assigner",
                              "variable" : "a"
                            },
                            {
                              "context" : "a",
                              "contextType" : "variable",
                              "element" : "display",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "s"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "r",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "root",
                              "variable" : "r"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "idasi",
                              "source" : [
                                {
                                  "context" : "id",
                                  "element" : "extension",
                                  "variable" : "ext"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "organization",
                                  "contextType" : "variable",
                                  "element" : "id",
                                  "variable" : "uuid",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "r + '-' + ext"
                                    }
                                  ]
                                },
                                {
                                  "context" : "e1",
                                  "contextType" : "variable",
                                  "element" : "fullUrl",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "https://example/"
                                    },
                                    {
                                      "valueId" : "uuid"
                                    }
                                  ]
                                },
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "manufacturer",
                                  "variable" : "reference",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Reference"
                                    }
                                  ]
                                },
                                {
                                  "context" : "reference",
                                  "contextType" : "variable",
                                  "element" : "reference",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'https://example/' + %organization.id"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "name",
                      "source" : [
                        {
                          "context" : "manufactOrg",
                          "element" : "name",
                          "variable" : "n"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "organization",
                          "contextType" : "variable",
                          "element" : "name",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "n.other"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "meta",
                      "source" : [
                        {
                          "context" : "manufactOrg"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "organization",
                          "contextType" : "variable",
                          "element" : "meta",
                          "variable" : "meta"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "coding",
                          "source" : [
                            {
                              "context" : "manufactOrg"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "meta",
                              "contextType" : "variable",
                              "element" : "tag",
                              "variable" : "coding",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Coding"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "system",
                              "source" : [
                                {
                                  "context" : "manufactOrg"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "system",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "http://algoritmodiscoring"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "code",
                              "source" : [
                                {
                                  "context" : "manufactOrg"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "code",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "ClinicalDocument/body/Vaccinazioni/manufacturerOrganization"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "part",
          "source" : [
            {
              "context" : "substance",
              "element" : "participant",
              "variable" : "part"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e1"
            },
            {
              "context" : "e1",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "PUT"
                }
              ]
            },
            {
              "context" : "e1",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "location",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Location"
                }
              ]
            },
            {
              "context" : "location",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid1",
              "transform" : "uuid"
            }
          ],
          "rule" : [
            {
              "name" : "meta",
              "source" : [
                {
                  "context" : "part"
                }
              ],
              "target" : [
                {
                  "context" : "location",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta"
                }
              ],
              "rule" : [
                {
                  "name" : "coding",
                  "source" : [
                    {
                      "context" : "part"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "meta",
                      "contextType" : "variable",
                      "element" : "tag",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "system",
                      "source" : [
                        {
                          "context" : "part"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://algoritmodiscoring"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "part"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "ClinicalDocument/body/Vaccinazione/participant"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "role",
              "source" : [
                {
                  "context" : "part",
                  "element" : "participantRole",
                  "variable" : "partRole"
                }
              ],
              "rule" : [
                {
                  "name" : "identifier",
                  "source" : [
                    {
                      "context" : "partRole",
                      "element" : "id",
                      "variable" : "id"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "location",
                      "contextType" : "variable",
                      "element" : "identifier",
                      "variable" : "identifier"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "root1",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "root",
                          "variable" : "r"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "r"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "ext",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "ext"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "UUID",
                          "source" : [
                            {
                              "context" : "partRole"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "request",
                              "contextType" : "variable",
                              "element" : "url",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "Location?identifier="
                                },
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "assigningAuthorityName",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "assigningAuthorityName",
                          "variable" : "s"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "assigner",
                          "variable" : "a"
                        },
                        {
                          "context" : "a",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "s"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "r",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "root",
                          "variable" : "r"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "idasi",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "location",
                              "contextType" : "variable",
                              "element" : "id",
                              "variable" : "uuid",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "r + '-' + ext"
                                }
                              ]
                            },
                            {
                              "context" : "e1",
                              "contextType" : "variable",
                              "element" : "fullUrl",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "https://example/Location"
                                },
                                {
                                  "valueId" : "uuid"
                                }
                              ]
                            },
                            {
                              "context" : "tgt",
                              "contextType" : "variable",
                              "element" : "location",
                              "variable" : "reference",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Reference"
                                }
                              ]
                            },
                            {
                              "context" : "reference",
                              "contextType" : "variable",
                              "element" : "reference",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "'https://example/' + %location.id"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entrirel1",
          "source" : [
            {
              "context" : "substance",
              "element" : "entryRelationship",
              "variable" : "entrirel1"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entrirel1",
                  "element" : "observation",
                  "variable" : "obs"
                }
              ],
              "rule" : [
                {
                  "name" : "codecontrol",
                  "source" : [
                    {
                      "context" : "obs",
                      "element" : "code",
                      "condition" : "(code = '30973-2')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "val",
                      "source" : [
                        {
                          "context" : "obs"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "protocolApplied",
                          "variable" : "prot",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "BackboneElement"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "obs",
                              "element" : "value",
                              "variable" : "v"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "v",
                                  "element" : "value",
                                  "variable" : "int"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "prot",
                                  "contextType" : "variable",
                                  "element" : "doseNumber",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "int.toString()"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entrirel2",
          "source" : [
            {
              "context" : "substance",
              "element" : "entryRelationship",
              "variable" : "entrirel2"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entrirel2",
                  "element" : "observation",
                  "variable" : "obs"
                }
              ],
              "rule" : [
                {
                  "name" : "codecontrol",
                  "source" : [
                    {
                      "context" : "obs",
                      "element" : "code",
                      "condition" : "(code = '59781-5')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "value",
                      "source" : [
                        {
                          "context" : "obs",
                          "element" : "value",
                          "variable" : "value"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "value",
                              "element" : "high",
                              "variable" : "h"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "h",
                                  "element" : "value",
                                  "variable" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "expirationDate",
                                  "transform" : "truncate",
                                  "parameter" : [
                                    {
                                      "valueId" : "value"
                                    },
                                    {
                                      "valueInteger" : 10
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entrirel4",
          "source" : [
            {
              "context" : "substance",
              "element" : "entryRelationship",
              "variable" : "entrirel4"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entrirel4",
                  "element" : "observation",
                  "variable" : "obs"
                }
              ],
              "rule" : [
                {
                  "name" : "codecontrol",
                  "source" : [
                    {
                      "context" : "obs",
                      "element" : "code",
                      "condition" : "(code = '59785-6')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e1"
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "observation",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid1",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e1",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Observation/"
                        },
                        {
                          "valueId" : "uuid1"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Observation"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "reasonReference",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Observation/' + %observation.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observation",
                      "source" : [
                        {
                          "context" : "obs"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "Observation1",
                          "variable" : [
                            "entrirel4",
                            "patient",
                            "tgt",
                            "bundle",
                            "enc",
                            "observation"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entrirel5",
          "source" : [
            {
              "context" : "substance",
              "element" : "entryRelationship",
              "variable" : "entrirel5"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entrirel5",
                  "element" : "observation",
                  "variable" : "obs"
                }
              ],
              "rule" : [
                {
                  "name" : "codecontrol",
                  "source" : [
                    {
                      "context" : "obs",
                      "element" : "code",
                      "condition" : "(code = '75321-0') or (code = '5321-0')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "reaction",
                      "variable" : "reaction"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observation",
                      "source" : [
                        {
                          "context" : "obs"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "bundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "e1"
                        },
                        {
                          "context" : "e1",
                          "contextType" : "variable",
                          "element" : "request",
                          "variable" : "request",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "BackboneElement"
                            }
                          ]
                        },
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "method",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "POST"
                            }
                          ]
                        },
                        {
                          "context" : "e1",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "observation",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Observation"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid1",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e1",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "https://example/Observation/"
                            },
                            {
                              "valueId" : "uuid1"
                            }
                          ]
                        },
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "url",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "Observation"
                            }
                          ]
                        },
                        {
                          "context" : "reaction",
                          "contextType" : "variable",
                          "element" : "detail",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/Observation/' + %observation.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "Observation",
                          "variable" : [
                            "obs",
                            "patient",
                            "encounter",
                            "observation",
                            "bundle"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entrirel5",
          "source" : [
            {
              "context" : "substance",
              "element" : "entryRelationship",
              "variable" : "entrirel5"
            }
          ],
          "rule" : [
            {
              "name" : "obs",
              "source" : [
                {
                  "context" : "entrirel5",
                  "element" : "act",
                  "variable" : "act"
                }
              ],
              "rule" : [
                {
                  "name" : "note",
                  "source" : [
                    {
                      "context" : "act",
                      "element" : "text",
                      "variable" : "tx"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "note",
                      "variable" : "note"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "text",
                      "source" : [
                        {
                          "context" : "tx",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "note",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ConditionFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "cdaElement",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Condition",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "verifstatus",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "stscode"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "verificationStatus",
              "variable" : "verifstatus"
            }
          ],
          "rule" : [
            {
              "name" : "coding",
              "source" : [
                {
                  "context" : "stscode",
                  "variable" : "codeS"
                }
              ],
              "target" : [
                {
                  "context" : "verifstatus",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Coding"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "codeS",
                      "element" : "code"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "confirmed"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "system",
                  "source" : [
                    {
                      "context" : "codeS"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://terminology.hl7.org/CodeSystem/condition-ver-status"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "display",
                  "source" : [
                    {
                      "context" : "codeS"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "cast",
                      "parameter" : [
                        {
                          "valueString" : "Confirmed"
                        },
                        {
                          "valueString" : "string"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "src -> tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "onset",
          "source" : [
            {
              "context" : "src",
              "condition" : "entryRelationship.exists().not()"
            }
          ],
          "rule" : [
            {
              "name" : "value1",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime",
                  "condition" : "(value.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "onset",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "dateTime"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "TSDateTime",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            },
            {
              "name" : "valuePeriod",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectiveTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "onset",
                  "variable" : "value",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "IVLTSPeriod",
                  "variable" : [
                    "effectiveTime",
                    "value"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "entryR",
          "source" : [
            {
              "context" : "src",
              "element" : "entryRelationship",
              "variable" : "entryRelationship"
            }
          ],
          "rule" : [
            {
              "name" : "EntryRelObsevation",
              "source" : [
                {
                  "context" : "entryRelationship",
                  "element" : "observation",
                  "variable" : "obsentry"
                }
              ],
              "rule" : [
                {
                  "name" : "value",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "value",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ],
                  "documentation" : "toASK"
                },
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "code",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "category",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "value1",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "effectiveTime",
                      "variable" : "effectiveTime",
                      "condition" : "(value.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "onset",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "dateTime"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDateTime",
                      "variable" : [
                        "effectiveTime",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "valuePeriod",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "effectiveTime",
                      "variable" : "effectiveTime"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "onset",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Period"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "IVLTSPeriod",
                      "variable" : [
                        "effectiveTime",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "note",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "note",
                      "variable" : "note"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "text",
                      "source" : [
                        {
                          "context" : "text",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "note",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "entryR",
                  "source" : [
                    {
                      "context" : "obsentry",
                      "element" : "entryRelationship",
                      "variable" : "entryR2"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "observation",
                      "source" : [
                        {
                          "context" : "entryR2",
                          "element" : "observation",
                          "variable" : "obsentry2"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "observation",
                          "source" : [
                            {
                              "context" : "obsentry2",
                              "element" : "code",
                              "condition" : "code = '89261-2'"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "observation",
                              "source" : [
                                {
                                  "context" : "obsentry2"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "evidence",
                                  "variable" : "evidence"
                                },
                                {
                                  "context" : "bundle",
                                  "contextType" : "variable",
                                  "element" : "entry",
                                  "variable" : "e1"
                                },
                                {
                                  "context" : "e1",
                                  "contextType" : "variable",
                                  "element" : "request",
                                  "variable" : "request",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "BackboneElement"
                                    }
                                  ]
                                },
                                {
                                  "context" : "request",
                                  "contextType" : "variable",
                                  "element" : "method",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "POST"
                                    }
                                  ]
                                },
                                {
                                  "context" : "e1",
                                  "contextType" : "variable",
                                  "element" : "resource",
                                  "variable" : "obsy",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Observation"
                                    }
                                  ]
                                },
                                {
                                  "context" : "obsy",
                                  "contextType" : "variable",
                                  "element" : "id",
                                  "variable" : "uuid1",
                                  "transform" : "uuid"
                                },
                                {
                                  "context" : "e1",
                                  "contextType" : "variable",
                                  "element" : "fullUrl",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "https://example/Observation/"
                                    },
                                    {
                                      "valueId" : "uuid1"
                                    }
                                  ]
                                },
                                {
                                  "context" : "request",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "Observation"
                                    }
                                  ]
                                },
                                {
                                  "context" : "evidence",
                                  "contextType" : "variable",
                                  "element" : "detail",
                                  "variable" : "reference",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Reference"
                                    }
                                  ]
                                },
                                {
                                  "context" : "reference",
                                  "contextType" : "variable",
                                  "element" : "reference",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'https://example/Observation/' + %obsy.id"
                                    }
                                  ]
                                }
                              ],
                              "dependent" : [
                                {
                                  "name" : "Observation",
                                  "variable" : [
                                    "obsentry2",
                                    "patient",
                                    "encounter",
                                    "obsy",
                                    "bundle"
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "clinicalStatus2",
                          "source" : [
                            {
                              "context" : "obsentry2",
                              "element" : "code",
                              "condition" : "code = '33999-4'"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "clinicalstatus",
                              "source" : [
                                {
                                  "context" : "obsentry2",
                                  "element" : "value",
                                  "variable" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "clinicalStatus",
                                  "variable" : "clinicalstatus"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "coding",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "variable" : "val"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "clinicalstatus",
                                      "contextType" : "variable",
                                      "element" : "coding",
                                      "variable" : "coding",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Coding"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "val",
                                          "condition" : "(code = 'LA9041-0')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "resolved"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "val",
                                          "condition" : "(code = 'LA18632-2')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "inactive"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "code",
                                      "source" : [
                                        {
                                          "context" : "val",
                                          "condition" : "(code = 'LA16666-2')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "code",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "active"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "system",
                                      "source" : [
                                        {
                                          "context" : "val"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "system",
                                          "transform" : "copy",
                                          "parameter" : [
                                            {
                                              "valueString" : "http://terminology.hl7.org/CodeSystem/condition-clinical"
                                            }
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "name" : "display",
                                      "source" : [
                                        {
                                          "context" : "val",
                                          "element" : "displayName",
                                          "variable" : "display"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "coding",
                                          "contextType" : "variable",
                                          "element" : "display",
                                          "transform" : "cast",
                                          "parameter" : [
                                            {
                                              "valueId" : "display"
                                            },
                                            {
                                              "valueString" : "string"
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "text",
                                  "source" : [
                                    {
                                      "context" : "obsentry2",
                                      "element" : "text",
                                      "variable" : "text"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "text",
                                      "source" : [
                                        {
                                          "context" : "text",
                                          "element" : "reference",
                                          "variable" : "reference"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "clinicalstatus",
                                          "contextType" : "variable",
                                          "element" : "text",
                                          "transform" : "evaluate",
                                          "parameter" : [
                                            {
                                              "valueString" : "reference.value"
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "severity",
                          "source" : [
                            {
                              "context" : "obsentry2",
                              "element" : "code",
                              "condition" : "code = 'SEV'"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "obsentry2",
                                  "element" : "value",
                                  "variable" : "vvv"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "severity",
                                  "variable" : "vvv",
                                  "transform" : "create"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "act",
                      "source" : [
                        {
                          "context" : "entryR2",
                          "element" : "act",
                          "variable" : "act"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "note",
                          "source" : [
                            {
                              "context" : "act",
                              "element" : "text",
                              "variable" : "text"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgt",
                              "contextType" : "variable",
                              "element" : "note",
                              "variable" : "note"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "text",
                              "source" : [
                                {
                                  "context" : "text",
                                  "element" : "reference",
                                  "variable" : "reference"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "note",
                                  "contextType" : "variable",
                                  "element" : "text",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "reference.value"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "FamilyMemberFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "organizer",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "FamilyMemberHistory",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "patReference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "date",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "effectiveTime"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "date",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "date"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDate",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "relationship",
          "source" : [
            {
              "context" : "src",
              "element" : "subject",
              "variable" : "subject"
            }
          ],
          "rule" : [
            {
              "name" : "relatedSub",
              "source" : [
                {
                  "context" : "subject",
                  "element" : "relatedSubject",
                  "variable" : "relatedSubject"
                }
              ],
              "rule" : [
                {
                  "name" : "relationshipCode",
                  "source" : [
                    {
                      "context" : "relatedSubject",
                      "element" : "code",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "relationship",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "subject",
                  "source" : [
                    {
                      "context" : "relatedSubject",
                      "element" : "subject",
                      "variable" : "subject"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "sex",
                      "variable" : "sex"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "coding",
                      "source" : [
                        {
                          "context" : "subject",
                          "element" : "administrativeGenderCode",
                          "variable" : "administrativeGenderCode"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "sex",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "coding"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "gender",
                          "source" : [
                            {
                              "context" : "administrativeGenderCode",
                              "element" : "code",
                              "variable" : "sexCode"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "sexCode"
                                },
                                {
                                  "valueString" : "#cm-v3-administrative-gender"
                                },
                                {
                                  "valueString" : "code"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "system",
                          "source" : [
                            {
                              "context" : "administrativeGenderCode"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "http://hl7.org/fhir/administrative-gender"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "displayName",
                          "source" : [
                            {
                              "context" : "administrativeGenderCode",
                              "element" : "displayName",
                              "variable" : "dn"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "display",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "dn"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "component",
          "source" : [
            {
              "context" : "src",
              "element" : "component",
              "variable" : "component"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "condition",
              "variable" : "condition"
            }
          ],
          "rule" : [
            {
              "name" : "observation",
              "source" : [
                {
                  "context" : "component",
                  "element" : "observation",
                  "variable" : "observation"
                }
              ],
              "rule" : [
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "code",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "text",
                      "variable" : "text"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "note",
                      "variable" : "note"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "value",
                      "source" : [
                        {
                          "context" : "text",
                          "element" : "reference",
                          "variable" : "reference"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "note",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "reference.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "statusCode",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "statusCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "status",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "codeable",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "value",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "outcome",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ],
                  "documentation" : "observation.effectiveTime as effectiveTime -> condition.onset = create('Period') as value then IVLTSPeriod(effectiveTime, value) \"valuePeriod\";"
                },
                {
                  "name" : "EntryRel",
                  "source" : [
                    {
                      "context" : "observation",
                      "element" : "entryRelationship",
                      "variable" : "entryR"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "obser",
                      "source" : [
                        {
                          "context" : "entryR",
                          "element" : "observation",
                          "variable" : "obs"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "insorgenza",
                          "source" : [
                            {
                              "context" : "obs",
                              "condition" : "(code.code = '35267-4')"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "obs",
                                  "element" : "value",
                                  "variable" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "condition",
                                  "contextType" : "variable",
                                  "element" : "onset",
                                  "variable" : "Age",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Age"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "age",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "value",
                                      "variable" : "valueAge"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "valueAge"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "unit",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "unit",
                                      "variable" : "unit"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "unit"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "unit",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "unit",
                                      "variable" : "unit"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "unit"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "system",
                                  "source" : [
                                    {
                                      "context" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "system",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "http://unitsofmeasure.org"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "death",
                          "source" : [
                            {
                              "context" : "obs",
                              "condition" : "(code.code = '39016-1')"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "obs",
                                  "element" : "value",
                                  "variable" : "value"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgt",
                                  "contextType" : "variable",
                                  "element" : "deceased",
                                  "variable" : "Age",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Age"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "age",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "value",
                                      "variable" : "valueAge"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "valueAge"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "unit",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "unit",
                                      "variable" : "unit"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "unit"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "unit",
                                  "source" : [
                                    {
                                      "context" : "value",
                                      "element" : "unit",
                                      "variable" : "unit"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "unit"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "system",
                                  "source" : [
                                    {
                                      "context" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Age",
                                      "contextType" : "variable",
                                      "element" : "system",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "http://unitsofmeasure.org"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Practitioner",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "performer",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "resurceCreation",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e22"
            },
            {
              "context" : "e22",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "PUT"
                }
              ]
            },
            {
              "context" : "e22",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitioner1",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Practitioner"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "participant",
              "source" : [
                {
                  "context" : "src",
                  "element" : "assignedEntity",
                  "variable" : "assignedEntity"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "participant",
                  "variable" : "participant"
                }
              ],
              "rule" : [
                {
                  "name" : "value1",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "time",
                      "variable" : "time",
                      "condition" : "(value.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "participant",
                      "contextType" : "variable",
                      "element" : "period",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "dateTime"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDateTime",
                      "variable" : [
                        "time",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "valuePeriod",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "time",
                      "variable" : "time",
                      "condition" : "(low.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "participant",
                      "contextType" : "variable",
                      "element" : "period",
                      "variable" : "value",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Period"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "IVLTSPeriod",
                      "variable" : [
                        "time",
                        "value"
                      ]
                    }
                  ]
                },
                {
                  "name" : "identifier",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "id",
                      "variable" : "id"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitioner1",
                      "contextType" : "variable",
                      "element" : "identifier",
                      "variable" : "identifier"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "root1",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "root",
                          "variable" : "r"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "r"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "ext",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "ext"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "assigningAuthorityName",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "assigningAuthorityName",
                          "variable" : "s"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "identifier",
                          "contextType" : "variable",
                          "element" : "assigner",
                          "variable" : "a"
                        },
                        {
                          "context" : "a",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "s"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "r",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "root",
                          "variable" : "r"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "id",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "practitioner1",
                              "contextType" : "variable",
                              "element" : "id",
                              "variable" : "uuid22",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "r + '-' + ext"
                                }
                              ]
                            },
                            {
                              "context" : "e22",
                              "contextType" : "variable",
                              "element" : "fullUrl",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "https://example/Practitioner/"
                                },
                                {
                                  "valueId" : "uuid22"
                                }
                              ]
                            },
                            {
                              "context" : "participant",
                              "contextType" : "variable",
                              "element" : "individual",
                              "variable" : "reference",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Reference"
                                }
                              ]
                            },
                            {
                              "context" : "reference",
                              "contextType" : "variable",
                              "element" : "reference",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "'https://example/Practitioner/' + %practitioner1.id"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "documentation" : "src.time as time -> participant.period as period then{"
                },
                {
                  "name" : "2.16.840.1.113883.2.9.4.3.2",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "id",
                      "variable" : "id",
                      "condition" : "(root = '2.16.840.1.113883.2.9.4.3.2')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "UUID",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "url",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Practitioner?identifier="
                            },
                            {
                              "valueId" : "ext"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "diverso",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "id",
                      "variable" : "id",
                      "condition" : "(root != '2.16.840.1.113883.2.9.4.3.2')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "UUID",
                      "source" : [
                        {
                          "context" : "id",
                          "element" : "extension",
                          "variable" : "ext"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "url",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "Practitioner?identifier="
                            },
                            {
                              "valueId" : "ext"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "meta",
                  "source" : [
                    {
                      "context" : "assignedEntity"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitioner1",
                      "contextType" : "variable",
                      "element" : "meta",
                      "variable" : "meta"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "coding",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "meta",
                          "contextType" : "variable",
                          "element" : "tag",
                          "variable" : "coding",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Coding"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "system",
                          "source" : [
                            {
                              "context" : "src"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "http://algoritmodiscoring"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "code",
                          "source" : [
                            {
                              "context" : "src"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "ClinicalDocument/body/VisiteRicoveri/performer/"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "addr",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "addr",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitioner1",
                      "contextType" : "variable",
                      "element" : "address",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "telecom",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "telecom",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitioner1",
                      "contextType" : "variable",
                      "element" : "telecom",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "partname",
                  "source" : [
                    {
                      "context" : "assignedEntity",
                      "element" : "assignedPerson",
                      "variable" : "person"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "name",
                      "source" : [
                        {
                          "context" : "person",
                          "element" : "name",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner1",
                          "contextType" : "variable",
                          "element" : "name",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "birthTime",
                      "source" : [
                        {
                          "context" : "person",
                          "element" : "birthTime",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner1",
                          "contextType" : "variable",
                          "element" : "birthDate",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "CarePlanFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "entry",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "CarePlan",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "unknown"
                }
              ]
            }
          ]
        },
        {
          "name" : "intent",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "intent",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "plan"
                }
              ]
            }
          ]
        },
        {
          "name" : "activityIni",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "activity",
              "variable" : "activity"
            }
          ],
          "rule" : [
            {
              "name" : "detail",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "activity",
                  "contextType" : "variable",
                  "element" : "detail",
                  "variable" : "detail"
                }
              ],
              "rule" : [
                {
                  "name" : "entryObs",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "observation",
                      "variable" : "observation"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "activity",
                      "source" : [
                        {
                          "context" : "observation"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "status",
                          "source" : [
                            {
                              "context" : "observation"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "detail",
                              "contextType" : "variable",
                              "element" : "status",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "unknown"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "obs1",
                          "source" : [
                            {
                              "context" : "observation"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "bundle",
                              "contextType" : "variable",
                              "element" : "entry",
                              "variable" : "e1"
                            },
                            {
                              "context" : "e1",
                              "contextType" : "variable",
                              "element" : "request",
                              "variable" : "request",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "BackboneElement"
                                }
                              ]
                            },
                            {
                              "context" : "request",
                              "contextType" : "variable",
                              "element" : "method",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "POST"
                                }
                              ]
                            },
                            {
                              "context" : "e1",
                              "contextType" : "variable",
                              "element" : "resource",
                              "variable" : "obs1",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Observation"
                                }
                              ]
                            },
                            {
                              "context" : "obs1",
                              "contextType" : "variable",
                              "element" : "id",
                              "variable" : "uuid1",
                              "transform" : "uuid"
                            },
                            {
                              "context" : "e1",
                              "contextType" : "variable",
                              "element" : "fullUrl",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "https://example/Observation/"
                                },
                                {
                                  "valueId" : "uuid1"
                                }
                              ]
                            },
                            {
                              "context" : "request",
                              "contextType" : "variable",
                              "element" : "url",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "Observation"
                                }
                              ]
                            },
                            {
                              "context" : "detail",
                              "contextType" : "variable",
                              "element" : "reasonReference",
                              "variable" : "reference",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Reference"
                                }
                              ]
                            },
                            {
                              "context" : "reference",
                              "contextType" : "variable",
                              "element" : "reference",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "'https://example/Observation/' + %obs1.id"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "Observation",
                              "variable" : [
                                "observation",
                                "patient",
                                "encounter",
                                "obs1",
                                "bundle"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "entrySub",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "substanceAdministration",
                      "variable" : "substanceAdministration"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "activity",
                      "variable" : "activity"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "Terapie",
                      "source" : [
                        {
                          "context" : "substanceAdministration"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "bundle",
                          "contextType" : "variable",
                          "element" : "entry",
                          "variable" : "e2"
                        },
                        {
                          "context" : "e2",
                          "contextType" : "variable",
                          "element" : "request",
                          "variable" : "request",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "BackboneElement"
                            }
                          ]
                        },
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "method",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "POST"
                            }
                          ]
                        },
                        {
                          "context" : "e2",
                          "contextType" : "variable",
                          "element" : "resource",
                          "variable" : "medre1",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "MedicationRequest"
                            }
                          ]
                        },
                        {
                          "context" : "medre1",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid2",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e2",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "append",
                          "parameter" : [
                            {
                              "valueString" : "https://example/MedicationRequest/"
                            },
                            {
                              "valueId" : "uuid2"
                            }
                          ]
                        },
                        {
                          "context" : "request",
                          "contextType" : "variable",
                          "element" : "url",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "MedicationRequest"
                            }
                          ]
                        },
                        {
                          "context" : "activity",
                          "contextType" : "variable",
                          "element" : "reference",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/MedicationRequest/' + %medre1.id"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "MedicationRequest",
                          "variable" : [
                            "substanceAdministration",
                            "patient",
                            "encounter",
                            "medre1",
                            "bundle"
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "proc",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "procedure",
                      "variable" : "procedureC"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e8"
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "procedure",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "procedure",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid8",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e8",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Procedure/"
                        },
                        {
                          "valueId" : "uuid8"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Procedure"
                        }
                      ]
                    },
                    {
                      "context" : "activity",
                      "contextType" : "variable",
                      "element" : "outcomeReference",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Procedure/' + %procedure.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "Procedure",
                      "variable" : [
                        "procedureC",
                        "patient",
                        "encounter",
                        "procedure",
                        "bundle"
                      ]
                    }
                  ]
                },
                {
                  "name" : "viste",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "encounter",
                      "variable" : "encounterCDA"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e3"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "POST"
                        }
                      ]
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "encounterFHIR",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Encounter"
                        }
                      ]
                    },
                    {
                      "context" : "encounterFHIR",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid3",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e3",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "https://example/Encounter/"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Encounter"
                        }
                      ]
                    },
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "encounter",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'https://example/Encounter/' + %encounterFHIR.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "refPatient",
                      "source" : [
                        {
                          "context" : "encounterCDA"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "reference",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Reference"
                            }
                          ]
                        },
                        {
                          "context" : "reference",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'https://example/Patient/' + %patient.id"
                            }
                          ]
                        }
                      ],
                      "documentation" : "encounterCDA -> encounterFHIR.partOf = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"encounterHeader\";"
                    },
                    {
                      "name" : "id",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "element" : "id",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "statusCode",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "element" : "statusCode",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "status",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "status",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "condition" : "statusCode.exists().not()"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "unknown"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "class",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "element" : "code",
                          "variable" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "class",
                          "variable" : "class"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "code",
                          "source" : [
                            {
                              "context" : "code",
                              "element" : "code",
                              "variable" : "code"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "class",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "cast",
                              "parameter" : [
                                {
                                  "valueId" : "code"
                                },
                                {
                                  "valueString" : "string"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "codeSystem",
                          "source" : [
                            {
                              "context" : "code",
                              "element" : "codeSystem",
                              "variable" : "system"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "class",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "system"
                                },
                                {
                                  "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                },
                                {
                                  "valueString" : "uri"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "displayName",
                          "source" : [
                            {
                              "context" : "code",
                              "element" : "displayName",
                              "variable" : "display"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "class",
                              "contextType" : "variable",
                              "element" : "display",
                              "transform" : "cast",
                              "parameter" : [
                                {
                                  "valueId" : "display"
                                },
                                {
                                  "valueString" : "string"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "text",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "element" : "text",
                          "variable" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "type",
                          "variable" : "type"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "text",
                              "element" : "reference",
                              "variable" : "reference"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "type",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "reference.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "efft",
                      "source" : [
                        {
                          "context" : "encounterCDA",
                          "element" : "effectiveTime",
                          "variable" : "effectiveTime"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "encounterFHIR",
                          "contextType" : "variable",
                          "element" : "period",
                          "variable" : "period",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Period"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "effectiveTime"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "period",
                              "contextType" : "variable",
                              "element" : "start",
                              "variable" : "start",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "dateTime"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "TSDateTime",
                              "variable" : [
                                "effectiveTime",
                                "start"
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "act",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "id",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "id",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "tgt",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "activity",
                          "contextType" : "variable",
                          "element" : "outcomeCodeableConcept",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "text",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "text",
                          "variable" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "activity",
                          "contextType" : "variable",
                          "element" : "progress",
                          "variable" : "progress",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Annotation"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "text",
                              "element" : "reference",
                              "variable" : "reference"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "progress",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "reference.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "efft",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "effectiveTime",
                          "variable" : "effectiveTime"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "detail",
                          "contextType" : "variable",
                          "element" : "scheduled",
                          "variable" : "period",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Period"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "val",
                          "source" : [
                            {
                              "context" : "effectiveTime"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "period",
                              "contextType" : "variable",
                              "element" : "start",
                              "variable" : "start",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "dateTime"
                                }
                              ]
                            }
                          ],
                          "dependent" : [
                            {
                              "name" : "TSDateTime",
                              "variable" : [
                                "effectiveTime",
                                "start"
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "status",
                      "source" : [
                        {
                          "context" : "act"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "detail",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "completed"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "MedicationRequest",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "substanceAdministration",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "MedicationRequest",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ],
          "documentation" : "default  + mandatory"
        },
        {
          "name" : "intent",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "intent",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "order"
                }
              ]
            }
          ],
          "documentation" : "src -> tgt.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %encounter.id) \"reference\";"
        },
        {
          "name" : "st",
          "source" : [
            {
              "context" : "src",
              "condition" : "statusCode.exists().not()"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "unknown"
                }
              ]
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "sc"
            }
          ],
          "rule" : [
            {
              "name" : "codeS",
              "source" : [
                {
                  "context" : "sc",
                  "element" : "code",
                  "variable" : "cos"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "cos"
                    },
                    {
                      "valueString" : "#MedicationStatusMap"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "src",
              "element" : "text",
              "variable" : "txt"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            }
          ],
          "rule" : [
            {
              "name" : "text",
              "source" : [
                {
                  "context" : "txt",
                  "element" : "reference",
                  "variable" : "reference"
                }
              ],
              "target" : [
                {
                  "context" : "note",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reference.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "period",
          "source" : [
            {
              "context" : "src",
              "type" : "IVL_TS",
              "element" : "effectiveTime",
              "variable" : "eff"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "dosageInstruction",
              "variable" : "dosage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Dosage"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "timing",
              "source" : [
                {
                  "context" : "eff"
                }
              ],
              "target" : [
                {
                  "context" : "dosage",
                  "contextType" : "variable",
                  "element" : "timing",
                  "variable" : "timing",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Timing"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "rep",
                  "source" : [
                    {
                      "context" : "eff"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "timing",
                      "contextType" : "variable",
                      "element" : "repeat",
                      "variable" : "rep"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "valuePeriod",
                      "source" : [
                        {
                          "context" : "eff"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "rep",
                          "contextType" : "variable",
                          "element" : "bounds",
                          "variable" : "value",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Period"
                            }
                          ]
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "IVLTSPeriod",
                          "variable" : [
                            "eff",
                            "value"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "period",
          "source" : [
            {
              "context" : "src",
              "type" : "EIVL_TS",
              "element" : "effectiveTime",
              "variable" : "effe"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "dosageInstruction",
              "variable" : "dosage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Dosage"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "timing",
              "source" : [
                {
                  "context" : "effe"
                }
              ],
              "target" : [
                {
                  "context" : "dosage",
                  "contextType" : "variable",
                  "element" : "timing",
                  "variable" : "timing",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Timing"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "rep",
                  "source" : [
                    {
                      "context" : "effe"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "timing",
                      "contextType" : "variable",
                      "element" : "repeat",
                      "variable" : "rep"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "eventCode",
                      "source" : [
                        {
                          "context" : "effe",
                          "element" : "eventCode",
                          "variable" : "ev"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "rep",
                          "contextType" : "variable",
                          "element" : "when",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "ev.code"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "tim",
          "source" : [
            {
              "context" : "src",
              "type" : "IVL_TS",
              "element" : "effectiveTime",
              "variable" : "eff"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "dosageInstruction",
              "variable" : "dosage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Dosage"
                }
              ]
            },
            {
              "context" : "dosage",
              "contextType" : "variable",
              "element" : "timing",
              "variable" : "timing",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Timing"
                }
              ]
            },
            {
              "context" : "timing",
              "contextType" : "variable",
              "element" : "event",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "eff.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "eff",
          "source" : [
            {
              "context" : "src",
              "type" : "PIVL_TS",
              "element" : "effectiveTime",
              "variable" : "eff"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "dosageInstruction",
              "variable" : "dosage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Dosage"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "cod",
              "source" : [
                {
                  "context" : "eff"
                }
              ],
              "target" : [
                {
                  "context" : "dosage",
                  "contextType" : "variable",
                  "element" : "timing",
                  "variable" : "timing",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Timing"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "periodTiming",
                  "variable" : [
                    "eff",
                    "timing"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "condition",
          "source" : [
            {
              "context" : "src",
              "condition" : "(src.doseQuantity.exists() or src.rateQuantity.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "dosageIn",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "dosageInstruction",
                  "variable" : "dosageInstruction",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Dosage"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "doseQuantity",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "doseQuantity",
                      "variable" : "doseQuant"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ot",
                      "source" : [
                        {
                          "context" : "doseQuant",
                          "element" : "originalText",
                          "variable" : "ot"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "ot",
                              "element" : "reference",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageInstruction",
                              "contextType" : "variable",
                              "element" : "text",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "dosageRate",
                      "source" : [
                        {
                          "context" : "doseQuant"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "dosageInstruction",
                          "contextType" : "variable",
                          "element" : "doseAndRate",
                          "variable" : "dosageRate"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "d",
                          "source" : [
                            {
                              "context" : "doseQuant"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageRate",
                              "contextType" : "variable",
                              "element" : "dose",
                              "variable" : "d",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Range"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "doseQuant"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "low",
                                  "variable" : "l",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "doseQuant"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "high",
                                  "variable" : "h",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "doseQuant",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "rate",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "rateQuantity",
                      "variable" : "rateQuantity"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ot",
                      "source" : [
                        {
                          "context" : "rateQuantity",
                          "element" : "originalText",
                          "variable" : "ot"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "ot",
                              "element" : "reference",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageInstruction",
                              "contextType" : "variable",
                              "element" : "text",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "dosageRate",
                      "source" : [
                        {
                          "context" : "rateQuantity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "dosageInstruction",
                          "contextType" : "variable",
                          "element" : "doseAndRate",
                          "variable" : "dosageRate"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "r",
                          "source" : [
                            {
                              "context" : "rateQuantity"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "dosageRate",
                              "contextType" : "variable",
                              "element" : "rate",
                              "variable" : "d",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Range"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "low",
                              "source" : [
                                {
                                  "context" : "rateQuantity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "low",
                                  "variable" : "l",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "low",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "low",
                                      "variable" : "lo"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "l",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "lo.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "high",
                              "source" : [
                                {
                                  "context" : "rateQuantity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "d",
                                  "contextType" : "variable",
                                  "element" : "high",
                                  "variable" : "h",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "SimpleQuantity"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.value"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "high",
                                  "source" : [
                                    {
                                      "context" : "rateQuantity",
                                      "element" : "high",
                                      "variable" : "hi"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "h",
                                      "contextType" : "variable",
                                      "element" : "unit",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "hi.unit"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "route",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "routeCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosageInstruction",
                      "contextType" : "variable",
                      "element" : "route",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "site",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "approachSiteCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosageInstruction",
                      "contextType" : "variable",
                      "element" : "site",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "site",
                  "source" : [
                    {
                      "context" : "src",
                      "element" : "targetSiteCode",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dosageInstruction",
                      "contextType" : "variable",
                      "element" : "site",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "medication",
          "source" : [
            {
              "context" : "src",
              "element" : "consumable",
              "variable" : "consumable"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e1"
            },
            {
              "context" : "e1",
              "contextType" : "variable",
              "element" : "request",
              "variable" : "request",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "BackboneElement"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "method",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "POST"
                }
              ]
            },
            {
              "context" : "e1",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "medication",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Medication"
                }
              ]
            },
            {
              "context" : "medication",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid1",
              "transform" : "uuid"
            },
            {
              "context" : "e1",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Medication/"
                },
                {
                  "valueId" : "uuid1"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Medication"
                }
              ]
            },
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "medication",
              "variable" : "medref",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "medref",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Medication/' + %medication.id"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "Medication",
              "variable" : [
                "src",
                "medication",
                "patient",
                "bundle"
              ]
            }
          ]
        },
        {
          "name" : "entryR",
          "source" : [
            {
              "context" : "src",
              "element" : "entryRelationship",
              "variable" : "entryRelationship"
            }
          ],
          "rule" : [
            {
              "name" : "supply",
              "source" : [
                {
                  "context" : "entryRelationship",
                  "element" : "supply",
                  "variable" : "supply"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "dispenseRequest",
                  "variable" : "dispenseRequest"
                }
              ],
              "rule" : [
                {
                  "name" : "quantity",
                  "source" : [
                    {
                      "context" : "supply",
                      "element" : "quantity",
                      "variable" : "quantityCDA"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "dispenseRequest",
                      "contextType" : "variable",
                      "element" : "quantity",
                      "variable" : "quantityFHIR"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "value",
                      "source" : [
                        {
                          "context" : "quantityCDA"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "quantityFHIR",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "quantityCDA.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "Partecipant",
          "source" : [
            {
              "context" : "src",
              "element" : "participant",
              "variable" : "participant"
            }
          ],
          "rule" : [
            {
              "name" : "function",
              "source" : [
                {
                  "context" : "participant"
                }
              ],
              "dependent" : [
                {
                  "name" : "Practitioner",
                  "variable" : [
                    "participant",
                    "tgt",
                    "bundle"
                  ]
                }
              ]
            },
            {
              "name" : "autor",
              "source" : [
                {
                  "context" : "participant",
                  "element" : "effectiveTime",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "authoredOn",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "OrganizationAffiliation",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "act",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "enc",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "OrganizationAffiliation",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "condition" : "code = 'active'"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "active",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueBoolean" : true
                }
              ]
            }
          ],
          "documentation" : "src.code -> tgt.specialty as specialty then{"
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "condition" : "(code = 'active').not()"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "active",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueBoolean" : false
                }
              ]
            }
          ]
        },
        {
          "name" : "effectiveTime",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "eff"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "period"
            }
          ]
        },
        {
          "name" : "a",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "specialty",
              "variable" : "spec",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "CodeableConcept"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "spec",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "code"
                }
              ],
              "rule" : [
                {
                  "name" : "cd",
                  "source" : [
                    {
                      "context" : "code"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "spec",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "cd",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "cd",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "code.code"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "code"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "cd",
                          "contextType" : "variable",
                          "element" : "display",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "code.displayName"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "root1",
                      "source" : [
                        {
                          "context" : "code",
                          "element" : "codeSystem",
                          "variable" : "r"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "cd",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "translate",
                          "parameter" : [
                            {
                              "valueId" : "r"
                            },
                            {
                              "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                            },
                            {
                              "valueString" : "uri"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "entry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entryRelationship",
                  "variable" : "entry"
                }
              ],
              "rule" : [
                {
                  "name" : "act",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "a"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ref",
                      "source" : [
                        {
                          "context" : "a",
                          "element" : "text",
                          "variable" : "tx"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "reference",
                          "source" : [
                            {
                              "context" : "tx",
                              "element" : "reference",
                              "variable" : "reff"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "spec",
                              "contextType" : "variable",
                              "element" : "text",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "reff.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "src.code -> tgt.specialty;"
        }
      ]
    },
    {
      "name" : "DiagnosticReportFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "organizer",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "enc",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "DiagnosticReport",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "reference",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'https://example/Patient/' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "code",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "vvv",
              "transform" : "create"
            }
          ],
          "documentation" : "src -> tgt.encounter=create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) \"reference\";"
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "condition" : "code = 'completed'"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "value1",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "eff",
              "condition" : "(value.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "dateTime"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "TSDateTime",
              "variable" : [
                "eff",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "valuePeriod",
          "source" : [
            {
              "context" : "src",
              "element" : "effectiveTime",
              "variable" : "eff",
              "condition" : "(low.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "effective",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Period"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "IVLTSPeriod",
              "variable" : [
                "effectiveTime",
                "value"
              ]
            }
          ]
        },
        {
          "name" : "component",
          "source" : [
            {
              "context" : "src",
              "element" : "component",
              "variable" : "component"
            }
          ],
          "rule" : [
            {
              "name" : "hasMember",
              "source" : [
                {
                  "context" : "component",
                  "element" : "observation",
                  "variable" : "observation"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "ei"
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "request",
                  "variable" : "request",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "method",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "POST"
                    }
                  ]
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "obsi",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Observation"
                    }
                  ]
                },
                {
                  "context" : "obsi",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuidi",
                  "transform" : "uuid"
                },
                {
                  "context" : "ei",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/Observation/"
                    },
                    {
                      "valueId" : "uuidi"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Observation"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "result",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Observation/' + %obsi.id"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "Observation",
                  "variable" : [
                    "observation",
                    "patient",
                    "enc",
                    "obsi",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "EncounterFunction",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "cdaElement",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "encounter",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Encounter",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "id",
          "source" : [
            {
              "context" : "src",
              "element" : "id",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "statusCode",
          "source" : [
            {
              "context" : "src",
              "element" : "statusCode",
              "variable" : "vvv"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "variable" : "vvv",
              "transform" : "create"
            }
          ]
        },
        {
          "name" : "status",
          "source" : [
            {
              "context" : "src",
              "condition" : "statusCode.exists().not()"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "unknown"
                }
              ]
            }
          ]
        },
        {
          "name" : "co",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "class",
              "variable" : "class"
            }
          ],
          "rule" : [
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "code"
                }
              ],
              "target" : [
                {
                  "context" : "class",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "code.code"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "display",
              "source" : [
                {
                  "context" : "code"
                }
              ],
              "target" : [
                {
                  "context" : "class",
                  "contextType" : "variable",
                  "element" : "display",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "code.displayName"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "root1",
              "source" : [
                {
                  "context" : "code",
                  "element" : "codeSystem",
                  "variable" : "r"
                }
              ],
              "target" : [
                {
                  "context" : "class",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "r"
                    },
                    {
                      "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                    },
                    {
                      "valueString" : "uri"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "where",
          "source" : [
            {
              "context" : "src",
              "condition" : "effectiveTime.low.exists() or effectiveTime.high.exists()"
            }
          ],
          "rule" : [
            {
              "name" : "effectiveTime",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "eff"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "period",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "IVLTSPeriod",
                  "variable" : [
                    "eff",
                    "period"
                  ]
                }
              ]
            }
          ],
          "documentation" : "src.effectiveTime as effective -> tgt.period as period then{"
        },
        {
          "name" : "where",
          "source" : [
            {
              "context" : "src",
              "condition" : "effectiveTime.low.exists().not() or effectiveTime.high.exists().not()"
            }
          ],
          "rule" : [
            {
              "name" : "efft",
              "source" : [
                {
                  "context" : "src",
                  "element" : "effectiveTime",
                  "variable" : "effectivetime1"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "period",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Period"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "val",
                  "source" : [
                    {
                      "context" : "effectivetime1"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "period",
                      "contextType" : "variable",
                      "element" : "start",
                      "variable" : "start",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "dateTime"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDateTime",
                      "variable" : [
                        "effectivetime1",
                        "start"
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "effectiveTime = time-stamp"
        },
        {
          "name" : "text",
          "source" : [
            {
              "context" : "src",
              "element" : "text",
              "variable" : "tx"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "ty"
            }
          ],
          "rule" : [
            {
              "name" : "textType",
              "source" : [
                {
                  "context" : "tx",
                  "element" : "reference",
                  "variable" : "reff"
                }
              ],
              "target" : [
                {
                  "context" : "ty",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "reff.value"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "src.effectiveTime as eff where (value.exists()) -> tgt.period = create('dateTime') as value then TSDateTime(eff, value) \"value1\";"
        },
        {
          "name" : "01",
          "source" : [
            {
              "context" : "src",
              "element" : "performer",
              "variable" : "performer"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "participant",
              "variable" : "part"
            }
          ],
          "rule" : [
            {
              "name" : "period",
              "source" : [
                {
                  "context" : "performer"
                }
              ],
              "target" : [
                {
                  "context" : "part",
                  "contextType" : "variable",
                  "element" : "period",
                  "variable" : "period"
                }
              ],
              "rule" : [
                {
                  "name" : "val",
                  "source" : [
                    {
                      "context" : "performer",
                      "element" : "time",
                      "variable" : "time"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "period",
                      "contextType" : "variable",
                      "element" : "start",
                      "variable" : "start"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "TSDateTime",
                      "variable" : [
                        "time",
                        "start"
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "performer",
              "source" : [
                {
                  "context" : "performer",
                  "element" : "assignedEntity",
                  "variable" : "assentity"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e1"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "request",
                  "variable" : "request",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "method",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "POST"
                    }
                  ]
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerRole",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "practitionerRole",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid1",
                  "transform" : "uuid"
                },
                {
                  "context" : "e1",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/PractitionerRole/"
                    },
                    {
                      "valueId" : "uuid1"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "participant",
                  "variable" : "participant1",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "BackboneElement"
                    }
                  ]
                },
                {
                  "context" : "participant1",
                  "contextType" : "variable",
                  "element" : "individual",
                  "variable" : "referencepart",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "referencepart",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/PractitionerRole/' + %practitionerRole.id"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "code",
                  "source" : [
                    {
                      "context" : "assentity",
                      "element" : "code",
                      "variable" : "vvv"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "practitionerRole",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "vvv",
                      "transform" : "create"
                    }
                  ]
                },
                {
                  "name" : "assignedEntity",
                  "source" : [
                    {
                      "context" : "assentity"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e2"
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "request",
                      "variable" : "request",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "BackboneElement"
                        }
                      ]
                    },
                    {
                      "context" : "request",
                      "contextType" : "variable",
                      "element" : "method",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "PUT"
                        }
                      ]
                    },
                    {
                      "context" : "e2",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "practitioner",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Practitioner"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "meta",
                      "source" : [
                        {
                          "context" : "assentity"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "meta",
                          "variable" : "meta"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "coding",
                          "source" : [
                            {
                              "context" : "assentity"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "meta",
                              "contextType" : "variable",
                              "element" : "tag",
                              "variable" : "coding",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Coding"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "system",
                              "source" : [
                                {
                                  "context" : "assentity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "system",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "http://algoritmodiscoring"
                                    }
                                  ]
                                }
                              ]
                            },
                            {
                              "name" : "code",
                              "source" : [
                                {
                                  "context" : "assentity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "coding",
                                  "contextType" : "variable",
                                  "element" : "code",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "ClinicalDocument/body/encounter/performer"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "identifier",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "id",
                          "variable" : "id"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "identifier",
                          "variable" : "identifier"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "root1",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "root",
                              "variable" : "r"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "r"
                                },
                                {
                                  "valueString" : "http://hl7.org/fhir/ConceptMap/special-oid2uri"
                                },
                                {
                                  "valueString" : "uri"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "ext",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "UUID",
                              "source" : [
                                {
                                  "context" : "assentity"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "request",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "Practitioner?identifier="
                                    },
                                    {
                                      "valueId" : "ext"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "assigningAuthorityName",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "assigningAuthorityName",
                              "variable" : "s"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "identifier",
                              "contextType" : "variable",
                              "element" : "assigner",
                              "variable" : "a"
                            },
                            {
                              "context" : "a",
                              "contextType" : "variable",
                              "element" : "display",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "s"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "r",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "root",
                              "variable" : "r"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "performer",
                              "source" : [
                                {
                                  "context" : "id",
                                  "element" : "extension",
                                  "variable" : "ext"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "practitioner",
                                  "contextType" : "variable",
                                  "element" : "id",
                                  "variable" : "uuid2",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "r + '-' + ext"
                                    }
                                  ]
                                },
                                {
                                  "context" : "e2",
                                  "contextType" : "variable",
                                  "element" : "fullUrl",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "https://example/Practitioner/"
                                    },
                                    {
                                      "valueId" : "uuid2"
                                    }
                                  ]
                                },
                                {
                                  "context" : "practitionerRole",
                                  "contextType" : "variable",
                                  "element" : "practitioner",
                                  "variable" : "reference",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Reference"
                                    }
                                  ]
                                },
                                {
                                  "context" : "reference",
                                  "contextType" : "variable",
                                  "element" : "reference",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'https://example/Practitioner/' + %practitioner.id"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "2.16.840.1.113883.2.9.4.3.2",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "id",
                          "variable" : "id",
                          "condition" : "(root = '2.16.840.1.113883.2.9.4.3.2')"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "UUID",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "request",
                              "contextType" : "variable",
                              "element" : "url",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "Practitioner?identifier="
                                },
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "2.16.840.1.113883.2.9.4.3.2",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "id",
                          "variable" : "id",
                          "condition" : "(root != '2.16.840.1.113883.2.9.4.3.2')"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "UUID",
                          "source" : [
                            {
                              "context" : "id",
                              "element" : "extension",
                              "variable" : "ext"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "request",
                              "contextType" : "variable",
                              "element" : "url",
                              "transform" : "append",
                              "parameter" : [
                                {
                                  "valueString" : "Practitioner?identifier="
                                },
                                {
                                  "valueId" : "ext"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "addr",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "addr",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "telecom",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "telecom",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "practitioner",
                          "contextType" : "variable",
                          "element" : "telecom",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "name",
                      "source" : [
                        {
                          "context" : "assentity",
                          "element" : "assignedPerson",
                          "variable" : "person"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "name",
                          "source" : [
                            {
                              "context" : "person",
                              "element" : "name",
                              "variable" : "vvv"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "practitioner",
                              "contextType" : "variable",
                              "element" : "name",
                              "variable" : "vvv",
                              "transform" : "create"
                            }
                          ]
                        },
                        {
                          "name" : "birth",
                          "source" : [
                            {
                              "context" : "person",
                              "element" : "birthTime",
                              "variable" : "birthTime"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "value",
                              "source" : [
                                {
                                  "context" : "birthTime",
                                  "element" : "value",
                                  "variable" : "date"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "practitioner",
                                  "contextType" : "variable",
                                  "element" : "birthDate",
                                  "transform" : "truncate",
                                  "parameter" : [
                                    {
                                      "valueId" : "date"
                                    },
                                    {
                                      "valueInteger" : 10
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}