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 - PRESCRIZIONE SPECIALISTICA - JSON Representation

Draft as of 2024-04-11

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "cda2fhirSpecPrescription",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n         <pre>map &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirSpecPrescription&quot; = &quot;cda2fhirSpecPrescription&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; 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 -&gt; bundle.timestamp = (timestamp.now()) &quot;date&quot;;\n  cda then ClinicalDocumentComposition(cda, composition, patient, encounter, bundle, DocumentReference) &quot;composition&quot;;\n  cda -&gt;  bundle.entry as e,  e.request = create('BackboneElement') as request,  request.method = 'POST',  e.resource = create('ServiceRequest') as ServiceRequest,  ServiceRequest.id = uuid() as uuid1,  e.fullUrl = append('https://example/ServiceRequest/', uuid1),  request.url = 'ServiceRequest' then {\n    cda -&gt; ServiceRequest.intent = 'order' &quot;intent&quot;;\n    cda -&gt; ServiceRequest.status = 'unknown' &quot;stats&quot;;\n    cda -&gt;  ServiceRequest.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&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, ServiceRequest);\n          };\n        };\n      } &quot;body&quot;;\n    };\n  } &quot;ServiceRequest&quot;;\n}\n\ngroup ClinicalDocumentSection(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target ServiceRequest : ServiceRequest) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.code as code where (code = '48767-8') or (code = '51851-4') or (code = '57827-8') or (code = '57828-6') then {\n    src -&gt;  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/ServiceRequest/' + %ServiceRequest.id) &quot;reference&quot;;\n  } &quot;Note&quot;;\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  // --------------Sezione Esenzioni------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '57827-8') then {\n    src.id -&gt; ServiceRequest.identifier;\n    src.entry as entry -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('Coverage') as Coverage,  Coverage.id = uuid() as uuid11,  e11.fullUrl = append('https://example/Coverage/', uuid11),  request.url = 'Coverage',  ServiceRequest.insurance = create('Reference') as reference,  reference.reference = ('https://example/Coverage/' + %Coverage.id) then {\n      src -&gt;  Coverage.beneficiary = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n      src -&gt;  Coverage.payor = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n      src where statusCode.exists().not() -&gt; Coverage.status = 'active' &quot;statusAbsent&quot;;\n      entry.act as act then {\n        act.code -&gt; Coverage.type;\n      };\n    };\n  } &quot;Esenzioni&quot;;\n  // -------------Sezione Prescrizioni-------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '57828-6') then {\n    src.entry as entry then {\n      entry.observation as observation then {\n        observation.code -&gt; ServiceRequest.code;\n        // observation.priorityCode-&gt;ServiceRequest.priority&quot;priority&quot;;\n        observation.priorityCode as priorityCode then {\n          priorityCode.code as v -&gt; ServiceRequest.priority = translate(v, '#priority', 'code') &quot;priority&quot;;\n        };\n        observation.repeatNumber as repeatNumber -&gt; ServiceRequest.quantity = create('Quantity') as Ratio then {\n          repeatNumber.value as value -&gt; Ratio.value = value;\n        } &quot;value&quot;;\n        observation.participant as participant then {\n          participant.participantRole as partRol then {\n            partRol.scopingEntity as scopingEntity then {\n              scopingEntity.code -&gt; ServiceRequest.locationCode;\n            } &quot;ScopingEntity&quot;;\n          } &quot;PartROle&quot;;\n        } &quot;Location&quot;;\n        // ----------------codice Patologia------------------------------------------------------------------------------------------------------------------------------------\n        observation.entryRelationship as entryRelationship then {\n          entryRelationship.act as act then {\n            act.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.275') -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('Condition') as Condition,  Condition.id = uuid() as uuid11,  e11.fullUrl = append('https://example/Condition/', uuid11),  request.url = 'Condition',  ServiceRequest.reasonReference = create('Reference') as reference,  reference.reference = ('https://example/Condition/' + %Condition.id) then {\n              act -&gt;  Condition.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n              act -&gt;  Condition.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n              act -&gt; Condition.clinicalStatus as status2 then {\n                act -&gt; status2.coding as status3 then {\n                  act -&gt; status3.code = 'unknown' &quot;finald&quot;;\n                  act -&gt; status3.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical' &quot;system&quot;;\n                } &quot;st3&quot;;\n              } &quot;status&quot;;\n              act.code -&gt; Condition.code;\n            } &quot;Condition&quot;;\n          };\n        } &quot;entryrelationshipCondition&quot;;\n        // ---------Tipo di Visita---------------------------------------------------------------------------------------------------------------------------------\n        observation.entryRelationship as entryRelationship then {\n          entryRelationship.encounter as encounter then {\n            encounter.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.276') then {\n              encounter -&gt;  ServiceRequest.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) then {\n                observation.entryRelationship as entryRelationship then {\n                  entryRelationship.encounter as encounter1 then {\n                    encounter1.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.281') then {\n                      // encounter1.code -&gt; enc.class;\n                      encounter1.code as code1 -&gt; enc.class = create('Coding') as coding then {\n                        code1.code as code -&gt; coding.code = cast(code, 'string');\n                        code1.codeSystem as system -&gt; coding.system = translate(system, 'http://hl7.org/fhir/ConceptMap/special-oid2uri', 'uri');\n                        code1.displayName as display -&gt; coding.display = cast(display, 'string');\n                      } &quot;class&quot;;\n                    } &quot;reference&quot;;\n                  } &quot;templateId&quot;;\n                } &quot;Act&quot;;\n              } &quot;encounter&quot;;\n            };\n          } &quot;Act&quot;;\n        };\n        // ------------Nota esplicita--------------------------------------------------------------------------------------------------------------------------------------------\n        observation.entryRelationship as entryRelationship then {\n          entryRelationship.act as act then {\n            act.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.274') then {\n              act.text as text -&gt; ServiceRequest.note as note then {\n                text.reference as t then {\n                  t.value as l -&gt; note.text = l &quot;reference&quot;;\n                } &quot;tcx&quot;;\n              } &quot;reference&quot;;\n            };\n          } &quot;Act&quot;;\n        };\n        observation.entryRelationship as entryRelationship then {\n          entryRelationship.act as act then {\n            act.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.278') then {\n              act.code -&gt; ServiceRequest.reasonCode;\n            } &quot;reference&quot;;\n          } &quot;templateId&quot;;\n        } &quot;Act&quot;;\n        // -----Sedute-----------------------------------------------------------------------------------------------------------------------------------------------\n        observation.entryRelationship as entryRelationship then {\n          entryRelationship.observation as observation then {\n            observation.templateId as temid where (root = '2.16.840.1.113883.3.1937.777.63.10.277') then {\n              observation.repeatNumber as repeatNumber -&gt; ServiceRequest.occurrence = create('Timing') as Timing then {\n                repeatNumber -&gt; Timing.repeat as repeat then {\n                  repeatNumber.value as value -&gt; repeat.count = value &quot;count&quot;;\n                } &quot;event&quot;;\n              } &quot;Count&quot;;\n            } &quot;Timing&quot;;\n          } &quot;templateId&quot;;\n        } &quot;Act&quot;;\n      } &quot;Observation&quot;;\n    };\n  } &quot;Esenzioni&quot;;\n  // ------------Sezione Annotazioni-----------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '48767-8') then {\n    src.entry as entry then {\n      entry.act as act then {\n        act.text as text -&gt; ServiceRequest.note as note then {\n          text.reference as t then {\n            t.value as l -&gt; note.text = l &quot;reference&quot;;\n          } &quot;tcx&quot;;\n        } &quot;reference&quot;;\n      };\n    };\n  } &quot;Annotazioni&quot;;\n  // ----------Sezione Messaggio Regionale-----------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '51851-4') then {\n    src.text as cdaText -&gt; ServiceRequest.note as note then {\n      cdaText as text then {\n        text as l -&gt; note.text = l &quot;reference&quot;;\n      } &quot;tcx&quot;;\n    } &quot;reference&quot;;\n  } &quot;MessaggioRegionale&quot;;\n  // -------Sezione Parametri Vitali---------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '8716-3') -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('Observation') as Observation,  Observation.id = uuid() as uuid11,  e11.fullUrl = append('https://example/Observation/', uuid11),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %Observation.id) then {\n    src -&gt;  Observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n    src -&gt;  Observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n    src.code -&gt; Observation.code;\n    src where Observation.statusCode.exists().not() then {\n      src -&gt; Observation.status = 'final' &quot;status&quot;;\n    } &quot;statuscode&quot;;\n    src.text as cdaText -&gt; Observation.note as note then {\n      cdaText as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;reference&quot;;\n  } &quot;ParametriVitali&quot;;\n  // -------Sezione Allergie------------------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '48765-2') -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('AllergyIntolerance') as AllergyIntolerance,  AllergyIntolerance.id = uuid() as uuid11,  e11.fullUrl = append('https://example/AllergyIntolerance/', uuid11),  request.url = 'AllergyIntolerance',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/AllergyIntolerance/' + %AllergyIntolerance.id) then {\n    src -&gt;  AllergyIntolerance.patient = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n    src -&gt; AllergyIntolerance.clinicalStatus = create('CodeableConcept') as status then {\n      src -&gt; status.text = 'string' &quot;text&quot;;\n      src -&gt; status.coding = create('Coding') as coding then {\n        src -&gt; coding.code = 'active' &quot;active&quot;;\n        src -&gt; coding.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical' &quot;system&quot;;\n      } &quot;coding&quot;;\n    } &quot;allergy&quot;;\n    src.text as cdaText -&gt; AllergyIntolerance.note as note then {\n      cdaText as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;reference&quot;;\n  } &quot;Allergie&quot;;\n  // ------Sezione Stato Funzionale------------------------------------------------------------------------------------------------------------------------------------------\n  src.code as code where (code = '47420-5') -&gt;  bundle.entry as e11,  e11.request = create('BackboneElement') as request,  request.method = 'POST',  e11.resource = create('Observation') as Observation,  Observation.id = uuid() as uuid11,  e11.fullUrl = append('https://example/Observation/', uuid11),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %Observation.id) then {\n    src -&gt;  Observation.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n    src -&gt;  Observation.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n    src.code -&gt; Observation.code;\n    src where Observation.statusCode.exists().not() then {\n      src -&gt; Observation.status = 'final' &quot;status&quot;;\n    } &quot;statuscode&quot;;\n    src.text as cdaText -&gt; Observation.note as note then {\n      cdaText as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;reference&quot;;\n  } &quot;StatoFunzionale&quot;;\n}\n\n</pre>\n      </div>"
  },
  "url" : "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirSpecPrescription",
  "version" : "0.1.0",
  "name" : "cda2fhirSpecPrescription",
  "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" : "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()"
                }
              ]
            }
          ]
        },
        {
          "name" : "composition",
          "source" : [
            {
              "context" : "cda"
            }
          ],
          "dependent" : [
            {
              "name" : "ClinicalDocumentComposition",
              "variable" : [
                "cda",
                "composition",
                "patient",
                "encounter",
                "bundle",
                "DocumentReference"
              ]
            }
          ]
        },
        {
          "name" : "ServiceRequest",
          "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" : "ServiceRequest",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "ServiceRequest"
                }
              ]
            },
            {
              "context" : "ServiceRequest",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid1",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/ServiceRequest/"
                },
                {
                  "valueId" : "uuid1"
                }
              ]
            },
            {
              "context" : "request",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "ServiceRequest"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "intent",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "ServiceRequest",
                  "contextType" : "variable",
                  "element" : "intent",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "order"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "stats",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "ServiceRequest",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "unknown"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "cda"
                }
              ],
              "target" : [
                {
                  "context" : "ServiceRequest",
                  "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" : "component",
              "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",
                                    "ServiceRequest"
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "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" : "ServiceRequest",
          "type" : "ServiceRequest",
          "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" : "Note",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '48767-8') or (code = '51851-4') or (code = '57827-8') or (code = '57828-6')"
            }
          ],
          "rule" : [
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "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/ServiceRequest/' + %ServiceRequest.id"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "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"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "src.entry as entry then{"
        },
        {
          "name" : "Esenzioni",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '57827-8')"
            }
          ],
          "rule" : [
            {
              "name" : "id",
              "source" : [
                {
                  "context" : "src",
                  "element" : "id",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "ServiceRequest",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            },
            {
              "name" : "entry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entry",
                  "variable" : "entry"
                }
              ],
              "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" : "Coverage",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Coverage"
                    }
                  ]
                },
                {
                  "context" : "Coverage",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid11",
                  "transform" : "uuid"
                },
                {
                  "context" : "e11",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "https://example/Coverage/"
                    },
                    {
                      "valueId" : "uuid11"
                    }
                  ]
                },
                {
                  "context" : "request",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Coverage"
                    }
                  ]
                },
                {
                  "context" : "ServiceRequest",
                  "contextType" : "variable",
                  "element" : "insurance",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Coverage/' + %Coverage.id"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "Coverage",
                      "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" : "Coverage",
                      "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" : "statusAbsent",
                  "source" : [
                    {
                      "context" : "src",
                      "condition" : "statusCode.exists().not()"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "Coverage",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "active"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "act",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "Coverage",
                          "contextType" : "variable",
                          "element" : "type",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "--------------Sezione Esenzioni------------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "Esenzioni",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '57828-6')"
            }
          ],
          "rule" : [
            {
              "name" : "entry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entry",
                  "variable" : "entry"
                }
              ],
              "rule" : [
                {
                  "name" : "Observation",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "observation",
                      "variable" : "observation"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "code",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "code",
                          "variable" : "vvv"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ServiceRequest",
                          "contextType" : "variable",
                          "element" : "code",
                          "variable" : "vvv",
                          "transform" : "create"
                        }
                      ]
                    },
                    {
                      "name" : "priorityCode",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "priorityCode",
                          "variable" : "priorityCode"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "priority",
                          "source" : [
                            {
                              "context" : "priorityCode",
                              "element" : "code",
                              "variable" : "v"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "ServiceRequest",
                              "contextType" : "variable",
                              "element" : "priority",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "v"
                                },
                                {
                                  "valueString" : "#priority"
                                },
                                {
                                  "valueString" : "code"
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "observation.priorityCode->ServiceRequest.priority\"priority\";"
                    },
                    {
                      "name" : "value",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "repeatNumber",
                          "variable" : "repeatNumber"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ServiceRequest",
                          "contextType" : "variable",
                          "element" : "quantity",
                          "variable" : "Ratio",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Quantity"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "value",
                          "source" : [
                            {
                              "context" : "repeatNumber",
                              "element" : "value",
                              "variable" : "value"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "Ratio",
                              "contextType" : "variable",
                              "element" : "value",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Location",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "participant",
                          "variable" : "participant"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "PartROle",
                          "source" : [
                            {
                              "context" : "participant",
                              "element" : "participantRole",
                              "variable" : "partRol"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "ScopingEntity",
                              "source" : [
                                {
                                  "context" : "partRol",
                                  "element" : "scopingEntity",
                                  "variable" : "scopingEntity"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "code",
                                  "source" : [
                                    {
                                      "context" : "scopingEntity",
                                      "element" : "code",
                                      "variable" : "vvv"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ServiceRequest",
                                      "contextType" : "variable",
                                      "element" : "locationCode",
                                      "variable" : "vvv",
                                      "transform" : "create"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "entryrelationshipCondition",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "act",
                          "source" : [
                            {
                              "context" : "entryRelationship",
                              "element" : "act",
                              "variable" : "act"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "Condition",
                              "source" : [
                                {
                                  "context" : "act",
                                  "element" : "templateId",
                                  "variable" : "temid",
                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.275')"
                                }
                              ],
                              "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" : "Condition",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Condition"
                                    }
                                  ]
                                },
                                {
                                  "context" : "Condition",
                                  "contextType" : "variable",
                                  "element" : "id",
                                  "variable" : "uuid11",
                                  "transform" : "uuid"
                                },
                                {
                                  "context" : "e11",
                                  "contextType" : "variable",
                                  "element" : "fullUrl",
                                  "transform" : "append",
                                  "parameter" : [
                                    {
                                      "valueString" : "https://example/Condition/"
                                    },
                                    {
                                      "valueId" : "uuid11"
                                    }
                                  ]
                                },
                                {
                                  "context" : "request",
                                  "contextType" : "variable",
                                  "element" : "url",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "Condition"
                                    }
                                  ]
                                },
                                {
                                  "context" : "ServiceRequest",
                                  "contextType" : "variable",
                                  "element" : "reasonReference",
                                  "variable" : "reference",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Reference"
                                    }
                                  ]
                                },
                                {
                                  "context" : "reference",
                                  "contextType" : "variable",
                                  "element" : "reference",
                                  "transform" : "evaluate",
                                  "parameter" : [
                                    {
                                      "valueString" : "'https://example/Condition/' + %Condition.id"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "reference",
                                  "source" : [
                                    {
                                      "context" : "act"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Condition",
                                      "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" : "reference",
                                  "source" : [
                                    {
                                      "context" : "act"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Condition",
                                      "contextType" : "variable",
                                      "element" : "encounter",
                                      "variable" : "reference",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Reference"
                                        }
                                      ]
                                    },
                                    {
                                      "context" : "reference",
                                      "contextType" : "variable",
                                      "element" : "reference",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "'https://example/Encounter/' + %enc.id"
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "status",
                                  "source" : [
                                    {
                                      "context" : "act"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Condition",
                                      "contextType" : "variable",
                                      "element" : "clinicalStatus",
                                      "variable" : "status2"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "st3",
                                      "source" : [
                                        {
                                          "context" : "act"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "status2",
                                          "contextType" : "variable",
                                          "element" : "coding",
                                          "variable" : "status3"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "finald",
                                          "source" : [
                                            {
                                              "context" : "act"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "status3",
                                              "contextType" : "variable",
                                              "element" : "code",
                                              "transform" : "copy",
                                              "parameter" : [
                                                {
                                                  "valueString" : "unknown"
                                                }
                                              ]
                                            }
                                          ]
                                        },
                                        {
                                          "name" : "system",
                                          "source" : [
                                            {
                                              "context" : "act"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "status3",
                                              "contextType" : "variable",
                                              "element" : "system",
                                              "transform" : "copy",
                                              "parameter" : [
                                                {
                                                  "valueString" : "http://terminology.hl7.org/CodeSystem/condition-clinical"
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                },
                                {
                                  "name" : "code",
                                  "source" : [
                                    {
                                      "context" : "act",
                                      "element" : "code",
                                      "variable" : "vvv"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "Condition",
                                      "contextType" : "variable",
                                      "element" : "code",
                                      "variable" : "vvv",
                                      "transform" : "create"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "----------------codice Patologia------------------------------------------------------------------------------------------------------------------------------------"
                    },
                    {
                      "name" : "entryRelationship",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "Act",
                          "source" : [
                            {
                              "context" : "entryRelationship",
                              "element" : "encounter",
                              "variable" : "encounter"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "templateId",
                              "source" : [
                                {
                                  "context" : "encounter",
                                  "element" : "templateId",
                                  "variable" : "temid",
                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.276')"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "encounter",
                                  "source" : [
                                    {
                                      "context" : "encounter"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ServiceRequest",
                                      "contextType" : "variable",
                                      "element" : "encounter",
                                      "variable" : "reference",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Reference"
                                        }
                                      ]
                                    },
                                    {
                                      "context" : "reference",
                                      "contextType" : "variable",
                                      "element" : "reference",
                                      "transform" : "evaluate",
                                      "parameter" : [
                                        {
                                          "valueString" : "'https://example/Encounter/' + %enc.id"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "Act",
                                      "source" : [
                                        {
                                          "context" : "observation",
                                          "element" : "entryRelationship",
                                          "variable" : "entryRelationship"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "templateId",
                                          "source" : [
                                            {
                                              "context" : "entryRelationship",
                                              "element" : "encounter",
                                              "variable" : "encounter1"
                                            }
                                          ],
                                          "rule" : [
                                            {
                                              "name" : "reference",
                                              "source" : [
                                                {
                                                  "context" : "encounter1",
                                                  "element" : "templateId",
                                                  "variable" : "temid",
                                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.281')"
                                                }
                                              ],
                                              "rule" : [
                                                {
                                                  "name" : "class",
                                                  "source" : [
                                                    {
                                                      "context" : "encounter1",
                                                      "element" : "code",
                                                      "variable" : "code1"
                                                    }
                                                  ],
                                                  "target" : [
                                                    {
                                                      "context" : "enc",
                                                      "contextType" : "variable",
                                                      "element" : "class",
                                                      "variable" : "coding",
                                                      "transform" : "create",
                                                      "parameter" : [
                                                        {
                                                          "valueString" : "Coding"
                                                        }
                                                      ]
                                                    }
                                                  ],
                                                  "rule" : [
                                                    {
                                                      "name" : "code",
                                                      "source" : [
                                                        {
                                                          "context" : "code1",
                                                          "element" : "code",
                                                          "variable" : "code"
                                                        }
                                                      ],
                                                      "target" : [
                                                        {
                                                          "context" : "coding",
                                                          "contextType" : "variable",
                                                          "element" : "code",
                                                          "transform" : "cast",
                                                          "parameter" : [
                                                            {
                                                              "valueId" : "code"
                                                            },
                                                            {
                                                              "valueString" : "string"
                                                            }
                                                          ]
                                                        }
                                                      ]
                                                    },
                                                    {
                                                      "name" : "codeSystem",
                                                      "source" : [
                                                        {
                                                          "context" : "code1",
                                                          "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" : "code1",
                                                          "element" : "displayName",
                                                          "variable" : "display"
                                                        }
                                                      ],
                                                      "target" : [
                                                        {
                                                          "context" : "coding",
                                                          "contextType" : "variable",
                                                          "element" : "display",
                                                          "transform" : "cast",
                                                          "parameter" : [
                                                            {
                                                              "valueId" : "display"
                                                            },
                                                            {
                                                              "valueString" : "string"
                                                            }
                                                          ]
                                                        }
                                                      ]
                                                    }
                                                  ],
                                                  "documentation" : "encounter1.code -> enc.class;"
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "---------Tipo di Visita---------------------------------------------------------------------------------------------------------------------------------"
                    },
                    {
                      "name" : "entryRelationship",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "Act",
                          "source" : [
                            {
                              "context" : "entryRelationship",
                              "element" : "act",
                              "variable" : "act"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "templateId",
                              "source" : [
                                {
                                  "context" : "act",
                                  "element" : "templateId",
                                  "variable" : "temid",
                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.274')"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "reference",
                                  "source" : [
                                    {
                                      "context" : "act",
                                      "element" : "text",
                                      "variable" : "text"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ServiceRequest",
                                      "contextType" : "variable",
                                      "element" : "note",
                                      "variable" : "note"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "tcx",
                                      "source" : [
                                        {
                                          "context" : "text",
                                          "element" : "reference",
                                          "variable" : "t"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "reference",
                                          "source" : [
                                            {
                                              "context" : "t",
                                              "element" : "value",
                                              "variable" : "l"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "note",
                                              "contextType" : "variable",
                                              "element" : "text",
                                              "transform" : "copy",
                                              "parameter" : [
                                                {
                                                  "valueId" : "l"
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "------------Nota esplicita--------------------------------------------------------------------------------------------------------------------------------------------"
                    },
                    {
                      "name" : "Act",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "templateId",
                          "source" : [
                            {
                              "context" : "entryRelationship",
                              "element" : "act",
                              "variable" : "act"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "reference",
                              "source" : [
                                {
                                  "context" : "act",
                                  "element" : "templateId",
                                  "variable" : "temid",
                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.278')"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "code",
                                  "source" : [
                                    {
                                      "context" : "act",
                                      "element" : "code",
                                      "variable" : "vvv"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ServiceRequest",
                                      "contextType" : "variable",
                                      "element" : "reasonCode",
                                      "variable" : "vvv",
                                      "transform" : "create"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "Act",
                      "source" : [
                        {
                          "context" : "observation",
                          "element" : "entryRelationship",
                          "variable" : "entryRelationship"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "templateId",
                          "source" : [
                            {
                              "context" : "entryRelationship",
                              "element" : "observation",
                              "variable" : "observation"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "Timing",
                              "source" : [
                                {
                                  "context" : "observation",
                                  "element" : "templateId",
                                  "variable" : "temid",
                                  "condition" : "(root = '2.16.840.1.113883.3.1937.777.63.10.277')"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "Count",
                                  "source" : [
                                    {
                                      "context" : "observation",
                                      "element" : "repeatNumber",
                                      "variable" : "repeatNumber"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "ServiceRequest",
                                      "contextType" : "variable",
                                      "element" : "occurrence",
                                      "variable" : "Timing",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Timing"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "event",
                                      "source" : [
                                        {
                                          "context" : "repeatNumber"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "Timing",
                                          "contextType" : "variable",
                                          "element" : "repeat",
                                          "variable" : "repeat"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "count",
                                          "source" : [
                                            {
                                              "context" : "repeatNumber",
                                              "element" : "value",
                                              "variable" : "value"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "repeat",
                                              "contextType" : "variable",
                                              "element" : "count",
                                              "transform" : "copy",
                                              "parameter" : [
                                                {
                                                  "valueId" : "value"
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "documentation" : "-----Sedute-----------------------------------------------------------------------------------------------------------------------------------------------"
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "-------------Sezione Prescrizioni-------------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "Annotazioni",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '48767-8')"
            }
          ],
          "rule" : [
            {
              "name" : "entry",
              "source" : [
                {
                  "context" : "src",
                  "element" : "entry",
                  "variable" : "entry"
                }
              ],
              "rule" : [
                {
                  "name" : "act",
                  "source" : [
                    {
                      "context" : "entry",
                      "element" : "act",
                      "variable" : "act"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "act",
                          "element" : "text",
                          "variable" : "text"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "ServiceRequest",
                          "contextType" : "variable",
                          "element" : "note",
                          "variable" : "note"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "tcx",
                          "source" : [
                            {
                              "context" : "text",
                              "element" : "reference",
                              "variable" : "t"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "reference",
                              "source" : [
                                {
                                  "context" : "t",
                                  "element" : "value",
                                  "variable" : "l"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "note",
                                  "contextType" : "variable",
                                  "element" : "text",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueId" : "l"
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "------------Sezione Annotazioni-----------------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "MessaggioRegionale",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '51851-4')"
            }
          ],
          "rule" : [
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "ServiceRequest",
                  "contextType" : "variable",
                  "element" : "note",
                  "variable" : "note"
                }
              ],
              "rule" : [
                {
                  "name" : "tcx",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "text"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "reference",
                      "source" : [
                        {
                          "context" : "text",
                          "variable" : "l"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "note",
                          "contextType" : "variable",
                          "element" : "text",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueId" : "l"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "----------Sezione Messaggio Regionale-----------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "ParametriVitali",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '8716-3')"
            }
          ],
          "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" : "Observation",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Observation"
                }
              ]
            },
            {
              "context" : "Observation",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid11",
              "transform" : "uuid"
            },
            {
              "context" : "e11",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Observation/"
                },
                {
                  "valueId" : "uuid11"
                }
              ]
            },
            {
              "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/' + %Observation.id"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "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" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "encounter",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Encounter/' + %enc.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            },
            {
              "name" : "statuscode",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "Observation.statusCode.exists().not()"
                }
              ],
              "rule" : [
                {
                  "name" : "status",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "Observation",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "final"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "note",
                  "variable" : "note"
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "t"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "note",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "t"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "-------Sezione Parametri Vitali---------------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "Allergie",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '48765-2')"
            }
          ],
          "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" : "AllergyIntolerance",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "AllergyIntolerance"
                }
              ]
            },
            {
              "context" : "AllergyIntolerance",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid11",
              "transform" : "uuid"
            },
            {
              "context" : "e11",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/AllergyIntolerance/"
                },
                {
                  "valueId" : "uuid11"
                }
              ]
            },
            {
              "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/' + %AllergyIntolerance.id"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "AllergyIntolerance",
                  "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" : "allergy",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "AllergyIntolerance",
                  "contextType" : "variable",
                  "element" : "clinicalStatus",
                  "variable" : "status",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "CodeableConcept"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "text",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "status",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "string"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "coding",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "status",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "active",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "active"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "system",
                      "source" : [
                        {
                          "context" : "src"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "coding",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "AllergyIntolerance",
                  "contextType" : "variable",
                  "element" : "note",
                  "variable" : "note"
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "t"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "note",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "t"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "-------Sezione Allergie------------------------------------------------------------------------------------------------------------------------------------------------"
        },
        {
          "name" : "StatoFunzionale",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "code",
              "condition" : "(code = '47420-5')"
            }
          ],
          "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" : "Observation",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Observation"
                }
              ]
            },
            {
              "context" : "Observation",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid11",
              "transform" : "uuid"
            },
            {
              "context" : "e11",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "https://example/Observation/"
                },
                {
                  "valueId" : "uuid11"
                }
              ]
            },
            {
              "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/' + %Observation.id"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "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" : "reference",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "encounter",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'https://example/Encounter/' + %enc.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "code",
              "source" : [
                {
                  "context" : "src",
                  "element" : "code",
                  "variable" : "vvv"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "code",
                  "variable" : "vvv",
                  "transform" : "create"
                }
              ]
            },
            {
              "name" : "statuscode",
              "source" : [
                {
                  "context" : "src",
                  "condition" : "Observation.statusCode.exists().not()"
                }
              ],
              "rule" : [
                {
                  "name" : "status",
                  "source" : [
                    {
                      "context" : "src"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "Observation",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "final"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "reference",
              "source" : [
                {
                  "context" : "src",
                  "element" : "text",
                  "variable" : "cdaText"
                }
              ],
              "target" : [
                {
                  "context" : "Observation",
                  "contextType" : "variable",
                  "element" : "note",
                  "variable" : "note"
                }
              ],
              "rule" : [
                {
                  "name" : "reference",
                  "source" : [
                    {
                      "context" : "cdaText",
                      "variable" : "t"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "note",
                      "contextType" : "variable",
                      "element" : "text",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "t"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation" : "------Sezione Stato Funzionale------------------------------------------------------------------------------------------------------------------------------------------"
        }
      ]
    }
  ]
}