CDA to FHIR Maps
0.1.0 - ci-build Italy flag

CDA to FHIR Maps, published by HL7 Italy. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/hl7-it/cda2fhir/ and changes regularly. See the Directory of published versions

: CDA to FHIR - PRESCRIZIONE FARMACEUTICA - TTL Representation

Draft as of 2024-09-15

Raw ttl | Download

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

 a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "cda2fhirMedPrescription"] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n         <pre>map &quot;http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirMedPrescription&quot; = &quot;cda2fhirMedPrescription&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/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 e5,  e5.request = create('BackboneElement') as request,  request.method = 'POST',  e5.resource = create('DocumentReference') as DocumentReference,  DocumentReference.id = uuid() as uuid5,  e5.fullUrl = append('https://example/DocumentReference/', uuid5),  request.url = 'DocumentReference' then {\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 ext -&gt; identifier.value = ext;\n          id.assigningAuthorityName as s -&gt;  identifier.assigner as a,  a.display = s;\n        } &quot;record&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.component as component then {\n    component.structuredBody as body then {\n      body -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Coverage') as coverage,  coverage.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Coverage/', uuid1),  request.url = 'Coverage' then {\n        body -&gt;  bundle.entry as e2,  e2.request = create('BackboneElement') as request,  request.method = 'POST',  e2.resource = create('MedicationRequest') as medRq,  medRq.id = uuid() as uuid1,  e2.fullUrl = append('https://example/MedicationRequest/', uuid1),  request.url = 'MedicationRequest' then {\n          body.component as component then {\n            // discretizzi il primo livello di component\n            component.section as srcSection then {\n              srcSection.code where (code = '57827-8') -&gt; composition.section as tgtSection then ClinicalDocumentSectionEsenzioni(cda, srcSection, patient, tgtSection, bundle, encounter, coverage) &quot;esenz&quot;;\n              srcSection.code where (code = '57828-6') -&gt; composition.section as tgtSection then ClinicalDocumentSectionPrescrizioneFarmaceutica(cda, srcSection, patient, tgtSection, bundle, encounter, coverage, medRq) &quot;prescfarm&quot;;\n              srcSection.code where (code = '48767-8') -&gt; composition.section as tgtSection then ClinicalDocumentSectionAnnotazioni(cda, srcSection, patient, tgtSection, bundle, encounter, medRq) &quot;annot&quot;;\n              srcSection.code where (code = '51851-4') -&gt; composition.section as tgtSection then ClinicalDocumentSectionMessaggioRegionale(cda, srcSection, patient, tgtSection, bundle, encounter, medRq) &quot;messregg&quot;;\n              srcSection.code where (code = '8716-3') -&gt; composition.section as tgtSection then ClinicalDocumentSectionParametriVitali(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;paramvit&quot;;\n              srcSection.code where (code = '48765-2') -&gt; composition.section as tgtSection then ClinicalDocumentSectionAllergieaiFarmaci(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;allergfarm&quot;;\n              srcSection.code where (code = '47420-5') -&gt; composition.section as tgtSection then ClinicalDocumentSectionStatoClinicoPaziente(cda, srcSection, patient, tgtSection, bundle, encounter) &quot;statclinpaz&quot;;\n            } &quot;cov&quot;;\n          };\n        } &quot;medreq&quot;;\n      } &quot;coverage&quot;;\n    } &quot;body&quot;;\n  };\n}\n\ngroup ClinicalDocumentSectionEsenzioni(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target coverage : Coverage) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Coverage/' + %coverage.id),  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    src.entry as srcse then {\n      srcse.act as srcsec then {\n        srcsec.code -&gt; coverage.type;\n        srcsec.code as srctxt then {\n          srctxt -&gt; coverage.type as typetxt then {\n            srctxt.originalText as ref then {\n              ref.reference as t then {\n                t.value as l -&gt; typetxt.text = l &quot;reference&quot;;\n              } &quot;tcf&quot;;\n            } &quot;rfde&quot;;\n          } &quot;reftxt&quot;;\n        } &quot;origtxt&quot;;\n        srcsec where coverage.status.exists().not() then {\n          srcsec -&gt; coverage.status = 'active' &quot;status&quot;;\n        } &quot;statuscode&quot;;\n        srcsec -&gt;  coverage.beneficiary = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n        srcsec -&gt;  coverage.payor = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n      } &quot;cdaText&quot;;\n    } &quot;secact&quot;;\n  } &quot;cff&quot;;\n}\n\ngroup ClinicalDocumentSectionPrescrizioneFarmaceutica(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target coverage : Coverage, target medRq : MedicationRequest) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medRq.id),  tgt.text as fhirText then {\n    src.id -&gt; medRq.identifier;\n    cdaText -&gt; fhirText.status = 'generated' &quot;narrativeStatus&quot;;\n    cdaText as t -&gt; fhirText.div = t &quot;narrativeText&quot;;\n    cdaText -&gt;  medRq.subject = create('Reference') as reference,  reference.reference = ('https://example/Patient/' + %patient.id) &quot;reference&quot;;\n    cdaText -&gt;  medRq.encounter = create('Reference') as reference,  reference.reference = ('https://example/Encounter/' + %enc.id) &quot;reference&quot;;\n    cdaText -&gt; medRq.status = 'active' &quot;status&quot;;\n    cdaText -&gt; medRq.intent = 'order' &quot;intent&quot;;\n    src.entry as srcent then {\n      srcent.substanceAdministration as subAdm then {\n        subAdm.effectiveTime : IVL_TS as eff -&gt; medRq.dosageInstruction = create('Dosage') as dosage then {\n          subAdm -&gt; dosage.timing = create('Timing') as tim then {\n            subAdm -&gt; tim.repeat as repeat then {\n              eff -&gt; repeat.bounds = create('Period') as period then IVLTSPeriod(eff, period) &quot;boundsperiod&quot;;\n              eff.width as width then {\n                width.value as v -&gt; repeat.duration = v;\n                width.unit as u -&gt; repeat.durationUnit = u;\n              };\n            } &quot;repeat&quot;;\n          } &quot;timing&quot;;\n        } &quot;dosage&quot;;\n        subAdm.effectiveTime as eff -&gt; medRq.dosageInstruction = create('Dosage') as dosage then {\n          subAdm -&gt; dosage.timing = create('Timing') as tim then {\n            eff where eff.low.exists().not() and eff.high.exists().not() then {\n              eff.value as v -&gt; tim.event = create('dateTime') as event then TSDateTime(v, event) &quot;evnt&quot;;\n            } &quot;effct1&quot;;\n          } &quot;timing1&quot;;\n        } &quot;dosage1&quot;;\n        subAdm.effectiveTime : PIVL_TS as effp -&gt; medRq.dosageInstruction = create('Dosage') as dosage then {\n          effp -&gt; dosage.timing = create('Timing') as timing then {\n            effp -&gt; timing then periodTiming(effp, timing) &quot;cod&quot;;\n            effp where effp.phase.exists() then {\n              effp.phase as phase -&gt; timing.repeat as r then {\n                phase.low -&gt; r.bounds = create('Period') as period then {\n                  phase.low -&gt; period.start &quot;lo&quot;;\n                };\n                phase.width as wid then {\n                  wid.value as v -&gt; r.duration = v &quot;vals&quot;;\n                  wid.unit as u -&gt; r.durationUnit = u;\n                } &quot;dur&quot;;\n              } &quot;rep&quot;;\n            } &quot;phase&quot;;\n          } &quot;timing&quot;;\n        } &quot;eff&quot;;\n        subAdm.effectiveTime : EIVL_TS as effe -&gt; medRq.dosageInstruction = create('Dosage') as dosage then {\n          effe -&gt; dosage.timing = create('Timing') as timing then {\n            effe -&gt; timing.repeat as r then {\n              effe.event -&gt; r.when;\n              effe.offset as offset then {\n                offset.low as v then {\n                  v.value as o -&gt; r.offset = o &quot;barabar&quot;;\n                } &quot;offs&quot;;\n              } &quot;poi&quot;;\n            } &quot;lkj&quot;;\n          } &quot;ghj&quot;;\n        } &quot;eff&quot;;\n        subAdm.doseQuantity as doseQuant -&gt; medRq.dosageInstruction = create('Dosage') as dosage then {\n          doseQuant.originalText as ot then {\n            ot.reference -&gt; dosage.text;\n          } &quot;ot&quot;;\n          doseQuant -&gt; dosage.doseAndRate as dosageRate then {\n            doseQuant -&gt; dosageRate.dose = create('Range') as d then {\n              doseQuant -&gt; d.low = create('SimpleQuantity') as l then {\n                doseQuant.low as lo -&gt; l.value = (lo.value);\n                doseQuant.low as lo -&gt; l.unit = (lo.unit);\n              } &quot;low&quot;;\n              doseQuant -&gt; d.high = create('SimpleQuantity') as h then {\n                doseQuant.high as hi -&gt; h.value = (hi.value);\n                doseQuant.high as hi -&gt; h.unit = (hi.unit);\n              } &quot;low&quot;;\n            } &quot;d&quot;;\n          } &quot;dosageRate&quot;;\n        } &quot;doseQuant&quot;;\n        subAdm -&gt;  bundle.entry as e1,  e1.request = create('BackboneElement') as request,  request.method = 'POST',  e1.resource = create('Medication') as medication,  medication.id = uuid() as uuid1,  e1.fullUrl = append('https://example/Medication/', uuid1),  request.url = 'Medication',  medRq.medication = create('Reference') as reference,  reference.reference = ('https://example/Medication/' + %medication.id) then {\n          subAdm.consumable as cons then {\n            cons.manufacturedProduct as manuprod then {\n              manuprod.manufacturedLabeledDrug as manudrug then {\n                manudrug.code -&gt; medication.code;\n                manudrug -&gt; medication.identifier as medid then {\n                  manudrug.name -&gt; medid.value;\n                } &quot;idmedname&quot;;\n                manudrug.code as srctxt then {\n                  srctxt -&gt; medication.code as typetxt then {\n                    srctxt.originalText as ref then {\n                      ref.reference as reference then {\n                        reference.value as l -&gt; typetxt.text = l &quot;reference&quot;;\n                      } &quot;tcf&quot;;\n                    } &quot;tcfg&quot;;\n                  } &quot;reftxtd&quot;;\n                } &quot;origtxtd&quot;;\n              } &quot;manudrug&quot;;\n              manuprod.manufacturedMaterial as manufact then {\n                manufact.code -&gt; medication.code;\n                manufact.code as srctxt then {\n                  srctxt -&gt; medication.code as typetxt then {\n                    srctxt.originalText as ref then {\n                      ref.reference as reference then {\n                        reference.value as l -&gt; typetxt.text = l &quot;reference&quot;;\n                      } &quot;tcf&quot;;\n                    } &quot;tcfg&quot;;\n                  } &quot;reftxt&quot;;\n                } &quot;origtxt&quot;;\n                manufact.ingredient as ingredient -&gt; medication.ingredient as ing then {\n                  ingredient.quantity as quantity -&gt; ing.strength = create('Ratio') as strength then EmedRTOPQPQRatio(quantity, strength) &quot;strength&quot;;\n                  manufact -&gt;  ing.item = create('CodeableConcept') as ingcode,  ingcode.text = (%manufact.name.other) &quot;ingredientCode&quot;;\n                } &quot;ingr&quot;;\n                manufact.formCode -&gt; medication.form;\n                manufact -&gt; medication.identifier as medid &quot;transl&quot;;\n              } &quot;manuFact&quot;;\n            } &quot;manumat&quot;;\n          } &quot;cons&quot;;\n          subAdm.entryRelationship as entryrel1 then {\n            entryrel1.supply as sup -&gt; medRq.dispenseRequest as dispreq then {\n              sup -&gt; dispreq.quantity = create('SimpleQuantity') as quantity then {\n                sup.quantity as q -&gt; quantity.value = (q.value);\n              } &quot;quantity&quot;;\n            };\n          } &quot;entry1&quot;;\n          subAdm.entryRelationship as entryrel2 where (typeCode = 'REFR') then {\n            subAdm -&gt;  medRq.insurance = create('Reference') as reference,  reference.reference = ('https://example/Coverage/' + %coverage.id) then {\n              entryrel2.act as act2 -&gt; coverage.costToBeneficiary as cost then {\n                act2 -&gt; cost.value = create('SimpleQuantity') as val then {\n                  act2 -&gt; val.value = '0' &quot;bnm&quot;;\n                } &quot;beneficmoney&quot;;\n                act2 -&gt; cost.exception as except then {\n                  act2.code -&gt; except.type;\n                } &quot;exept&quot;;\n              } &quot;act2&quot;;\n            } &quot;Cover&quot;;\n          } &quot;entry2&quot;;\n          subAdm.entryRelationship as entryrel3 where (typeCode = 'RSON') then {\n            entryrel3.observation as obs3 where (classCode = 'OBS') then {\n              obs3.code -&gt; medRq.reasonCode;\n              obs3.text as text then {\n                text -&gt; medRq.reasonCode as ce then {\n                  // text.reference as reference-&gt; ce.text=reference;\n                  text.reference as reference then {\n                    reference.value as l -&gt; ce.text = l &quot;reference&quot;;\n                  } &quot;tcf&quot;;\n                } &quot;originltext&quot;;\n              } &quot;txt&quot;;\n            } &quot;obs3&quot;;\n          } &quot;entry2&quot;;\n          subAdm.entryRelationship as entryrel4 where (typeCode = 'SUBJ') then {\n            entryrel4.observation as obs3 -&gt; medRq.substitution as sub then {\n              obs3.code as Code -&gt; sub.allowed = create('CodeableConcept') as allowed then CECodeableConcept(Code, allowed);\n              obs3.entryRelationship as entry then {\n                entry.observation as obs4 then {\n                  obs4.code -&gt; sub.reason;\n                } &quot;obs4&quot;;\n              } &quot;entry&quot;;\n            } &quot;obs&quot;;\n          } &quot;code&quot;;\n          subAdm.entryRelationship as entryrel2 where (typeCode = 'SUBJ') then {\n            entryrel2.act as act2 where (classCode = 'ACT') then {\n              act2.text as text -&gt; medRq.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            } &quot;obs3&quot;;\n          } &quot;entry2&quot;;\n        } &quot;subsadm&quot;;\n      } &quot;subadm&quot;;\n    } &quot;hnjh&quot;;\n  } &quot;xxx&quot;;\n}\n\n// ------------Sezione Annotazioni-----------------------------------------------------------------------------------------------------------------------------------------\ngroup ClinicalDocumentSectionAnnotazioni(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target medRq : MedicationRequest) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medRq.id),  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    src.entry as entry then {\n      entry.act as act then {\n        act.text as text -&gt; medRq.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;entry&quot;;\n}\n\n// ------------Sezione Messaggio Regionale-----------------------------------------------------------------------------------------------------------------------------------------\ngroup ClinicalDocumentSectionMessaggioRegionale(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter, target medRq : MedicationRequest) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/MedicationRequest/' + %medRq.id) then {\n    cdaText as text -&gt; medRq.note as note then {\n      text as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;nota&quot;;\n  } &quot;entry&quot;;\n}\n\n// ------------Sezione Parametri Vitali-----------------------------------------------------------------------------------------------------------------------------------------\ngroup ClinicalDocumentSectionParametriVitali(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  bundle.entry as e8,  e8.request = create('BackboneElement') as request,  request.method = 'POST',  e8.resource = create('Observation') as Observation,  Observation.id = uuid() as uuid8,  e8.fullUrl = append('https://example/Observation/', uuid8),  request.url = 'Observation',  tgt.entry = create('Reference') as reference,  reference.reference = ('https://example/Observation/' + %Observation.id) then {\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    cdaText -&gt; Observation.note as note then {\n      cdaText as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;reference&quot;;\n  } &quot;nota&quot;;\n}\n\n// ------------Sezione Allergie_Intolleranze-----------------------------------------------------------------------------------------------------------------------------------------\ngroup ClinicalDocumentSectionAllergieaiFarmaci(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src -&gt;  bundle.entry as e9,  e9.request = create('BackboneElement') as request,  request.method = 'POST',  e9.resource = create('AllergyIntolerance') as allergyIntolerance,  allergyIntolerance.id = uuid() as uuid9,  e9.fullUrl = append('https://example/AllergyIntolerance/', uuid9),  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;nota&quot;;\n}\n\n// ------------Sezione Stato Clinico del Paziente----------------------------------------------------------------------------------------------------------------------------------------\ngroup ClinicalDocumentSectionStatoClinicoPaziente(source cda : ClinicalDocument, source src : Section, target patient : Patient, target tgt, target bundle : Bundle, target enc : Encounter) {\n  src.title as t -&gt; tgt.title = (t.dataString);\n  src.code -&gt; tgt.code;\n  src.text as cdaText -&gt;  bundle.entry as e7,  e7.request = create('BackboneElement') as request,  request.method = 'POST',  e7.resource = create('Observation') as Observation,  Observation.id = uuid() as uuid7,  e7.fullUrl = append('https://example/Observation/', uuid7),  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    cdaText -&gt; Observation.note as note then {\n      cdaText as t -&gt; note.text = t &quot;reference&quot;;\n    } &quot;reference&quot;;\n  } &quot;nota&quot;;\n}\n\ngroup periodTiming(source effectiveTime : PIVL_TS, target timing : Timing) {\n  effectiveTime -&gt; timing.repeat as r then {\n    effectiveTime.period as p -&gt; r.period = (p.value);\n    effectiveTime.period as p -&gt; r.periodUnit = (p.unit);\n  } &quot;repeat&quot;;\n}\n\ngroup EmedRTOPQPQRatio(source src : RTO_PQ_PQ, target tgt : Ratio) {\n  src.numerator as numerator -&gt; tgt.numerator as targetNumerator then EmedPQQuantity(numerator, targetNumerator);\n  src.denominator as denominator -&gt; tgt.denominator as targetDenominator then EmedPQQuantity(denominator, targetDenominator);\n}\n\ngroup EmedPQQuantity(source src : PQ, target tgt : Quantity) {\n  src.value as value -&gt; tgt.value = value;\n  src.unit as unit -&gt; tgt.code = unit;\n  src.unit as unit -&gt; tgt.system = ('http://fhir.ch/ig/ch-emed/ValueSet/UnitCode'.resolve().compose.include.where(concept.where(code = %unit)).system);\n  src.unit as unit -&gt; tgt.unit = ('http://fhir.ch/ig/ch-emed/ValueSet/UnitCode'.resolve().compose.include.concept.where(code = %unit).display);\n}\n\n</pre>\n      </div>"
  ] ; # 
  fhir:url [ fhir:v "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirMedPrescription"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "0.1.0"] ; # 
  fhir:name [ fhir:v "cda2fhirMedPrescription"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2024-09-15T08:16:12+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 Italy"] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "HL7 Italy" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "http://hl7.it" ]     ] )
  ] ) ; # 
  fhir:jurisdiction ( [
    ( fhir:coding [
fhir:system [ fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ] ;
fhir:code [ fhir:v "IT" ] ;
fhir:display [ fhir:v "Italy" ]     ] )
  ] ) ; # 
  fhir:structure ( [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "ClinicalDocument" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "AssignedAuthor" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "AssignedEntity" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/AssociatedEntity>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "AssociatedEntity" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "CustodianOrganization" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/OrganizationPartOf>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "OrganizationPartOf" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/Organization"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/Organization>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "rapresentedOrganization" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/Section"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/Section>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "Section" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/PatientRole"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/PatientRole>     ] ;
fhir:mode [ fhir:v "queried" ] ;
fhir:alias [ fhir:v "PatientRole" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/AD"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/AD>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "AD" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Bundle" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Composition"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Composition>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Composition" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Patient>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Patient" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Encounter"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Encounter>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Encounter" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Person"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Person>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Patient" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Practitioner"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Practitioner>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Practitioner" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Organization"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Organization>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Organization" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/Act"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/Act>     ] ;
fhir:mode [ fhir:v "produced" ] ;
fhir:alias [ fhir:v "Act" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/IVL-PQ>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "IVL_PQ" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/cda/StructureDefinition/PQ"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/cda/StructureDefinition/PQ>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "PQ" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/SimpleQuantity"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/SimpleQuantity>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "SimpleQuantity" ]
  ] ) ; # 
  fhir:import ( [
fhir:v "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes"^^xsd:anyURI ;
fhir:link <http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirDataTypes>
  ] [
fhir:v "http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader"^^xsd:anyURI ;
fhir:link <http://hl7.it/fhir/cda2fhir/StructureMap/cda2fhirHeader>
  ] ) ; # 
  fhir:group ( [
fhir:name [ fhir:v "CdaToBundle" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "ClinicalDocumentToBody" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "composition" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Composition" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid1" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/Composition/" ]         ] [
fhir:value [ fhir:v "uuid1" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Composition" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "requestPAT" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "requestPAT" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PUT" ]         ] )       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patient" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Patient" ]         ] )       ] [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/Patient/" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "encounter" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Encounter" ]         ] )       ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/Encounter/" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Encounter" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]       ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "DocumentReference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "DocumentReference" ]         ] )       ] [
fhir:context [ fhir:v "DocumentReference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/DocumentReference/" ]         ] [
fhir:value [ fhir:v "uuid5" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "DocumentReference" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "cdatobundle" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cda" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentToBundle" ] ;
          ( fhir:variable [ fhir:v "cda" ] [ fhir:v "patient" ] [ fhir:v "composition" ] [ fhir:v "encounter" ] [ fhir:v "bundle" ] [ fhir:v "DocumentReference" ] )         ] )       ] [
fhir:name [ fhir:v "patient" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cda" ] ;
fhir:element [ fhir:v "recordTarget" ] ;
fhir:variable [ fhir:v "recordTarget" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "recPat" ] ;
          ( fhir:source [
fhir:context [ fhir:v "recordTarget" ] ;
fhir:element [ fhir:v "patientRole" ] ;
fhir:variable [ fhir:v "patient" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "record" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "id" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "root1" ] ;
              ( fhir:source [
fhir:context [ fhir:v "id" ] ;
fhir:element [ fhir:v "root" ] ;
fhir:variable [ fhir:v "r" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "translate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "r" ]                 ] [
fhir:value [ fhir:v "http://hl7.org/fhir/ConceptMap/special-oid2uri" ]                 ] [
fhir:value [ fhir:v "uri" ]                 ] )               ] )             ] [
fhir:name [ fhir:v "extension" ] ;
              ( fhir:source [
fhir:context [ fhir:v "id" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "ext" ]                 ] )               ] )             ] [
fhir:name [ fhir:v "assigningAuthorityName" ] ;
              ( fhir:source [
fhir:context [ fhir:v "id" ] ;
fhir:element [ fhir:v "assigningAuthorityName" ] ;
fhir:variable [ fhir:v "s" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "assigner" ] ;
fhir:variable [ fhir:v "a" ]               ] [
fhir:context [ fhir:v "a" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "s" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "ext" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "id" ] ;
fhir:condition [ fhir:v "(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')" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "UUID" ] ;
              ( fhir:source [
fhir:context [ fhir:v "id" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "requestPAT" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "append" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "Patient?identifier=" ]                 ] [
fhir:value [ fhir:v "ext" ]                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentToBundle" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "encounter" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "DocumentReference" ] ;
fhir:type [ fhir:v "DocumentReference" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "id" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "uuid" ]       ] )     ] [
fhir:name [ fhir:v "identifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "type" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "transaction" ]         ] )       ] )     ] [
fhir:name [ fhir:v "date" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timestamp" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "timestamp.now()" ]         ] )       ] )     ] [
fhir:name [ fhir:v "composition" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentComposition" ] ;
        ( fhir:variable [ fhir:v "cda" ] [ fhir:v "composition" ] [ fhir:v "patient" ] [ fhir:v "encounter" ] [ fhir:v "bundle" ] [ fhir:v "DocumentReference" ] )       ] )     ] [
fhir:name [ fhir:v "component" ] ;
      ( fhir:source [
fhir:context [ fhir:v "cda" ] ;
fhir:element [ fhir:v "component" ] ;
fhir:variable [ fhir:v "component" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "body" ] ;
        ( fhir:source [
fhir:context [ fhir:v "component" ] ;
fhir:element [ fhir:v "structuredBody" ] ;
fhir:variable [ fhir:v "body" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "coverage" ] ;
          ( fhir:source [
fhir:context [ fhir:v "body" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e1" ]           ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]             ] )           ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "POST" ]             ] )           ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid1" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "https://example/Coverage/" ]             ] [
fhir:value [ fhir:v "uuid1" ]             ] )           ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "medreq" ] ;
            ( fhir:source [
fhir:context [ fhir:v "body" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]             ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]               ] )             ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "POST" ]               ] )             ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medRq" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "MedicationRequest" ]               ] )             ] [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid1" ] ;
fhir:transform [ fhir:v "uuid" ]             ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "https://example/MedicationRequest/" ]               ] [
fhir:value [ fhir:v "uuid1" ]               ] )             ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "MedicationRequest" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "component" ] ;
              ( fhir:source [
fhir:context [ fhir:v "body" ] ;
fhir:element [ fhir:v "component" ] ;
fhir:variable [ fhir:v "component" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "cov" ] ;
                ( fhir:source [
fhir:context [ fhir:v "component" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "srcSection" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "esenz" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '57827-8')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionEsenzioni" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] [ fhir:v "coverage" ] )                   ] )                 ] [
fhir:name [ fhir:v "prescfarm" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '57828-6')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionPrescrizioneFarmaceutica" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] [ fhir:v "coverage" ] [ fhir:v "medRq" ] )                   ] )                 ] [
fhir:name [ fhir:v "annot" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '48767-8')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionAnnotazioni" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] [ fhir:v "medRq" ] )                   ] )                 ] [
fhir:name [ fhir:v "messregg" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '51851-4')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionMessaggioRegionale" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] [ fhir:v "medRq" ] )                   ] )                 ] [
fhir:name [ fhir:v "paramvit" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '8716-3')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionParametriVitali" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] )                   ] )                 ] [
fhir:name [ fhir:v "allergfarm" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '48765-2')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionAllergieaiFarmaci" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] )                   ] )                 ] [
fhir:name [ fhir:v "statclinpaz" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "srcSection" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:condition [ fhir:v "(code = '47420-5')" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "ClinicalDocumentSectionStatoClinicoPaziente" ] ;
                    ( fhir:variable [ fhir:v "cda" ] [ fhir:v "srcSection" ] [ fhir:v "patient" ] [ fhir:v "tgtSection" ] [ fhir:v "bundle" ] [ fhir:v "encounter" ] )                   ] )                 ] ) ;
fhir:documentation [ fhir:v "discretizzi il primo livello di component" ]               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionEsenzioni" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "coverage" ] ;
fhir:type [ fhir:v "Coverage" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "cff" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Coverage/' + %coverage.id" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "fhirText" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "narrativeStatus" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "generated" ]           ] )         ] )       ] [
fhir:name [ fhir:v "narrativeText" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "div" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "t" ]           ] )         ] )       ] [
fhir:name [ fhir:v "secact" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "srcse" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "cdaText" ] ;
          ( fhir:source [
fhir:context [ fhir:v "srcse" ] ;
fhir:element [ fhir:v "act" ] ;
fhir:variable [ fhir:v "srcsec" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
            ( fhir:source [
fhir:context [ fhir:v "srcsec" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]             ] )           ] [
fhir:name [ fhir:v "origtxt" ] ;
            ( fhir:source [
fhir:context [ fhir:v "srcsec" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "srctxt" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "reftxt" ] ;
              ( fhir:source [
fhir:context [ fhir:v "srctxt" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typetxt" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "rfde" ] ;
                ( fhir:source [
fhir:context [ fhir:v "srctxt" ] ;
fhir:element [ fhir:v "originalText" ] ;
fhir:variable [ fhir:v "ref" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "tcf" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "ref" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "t" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "t" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "typetxt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "l" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "statuscode" ] ;
            ( fhir:source [
fhir:context [ fhir:v "srcsec" ] ;
fhir:condition [ fhir:v "coverage.status.exists().not()" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "status" ] ;
              ( fhir:source [
fhir:context [ fhir:v "srcsec" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "active" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "reference" ] ;
            ( fhir:source [
fhir:context [ fhir:v "srcsec" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]               ] )             ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]               ] )             ] )           ] [
fhir:name [ fhir:v "reference" ] ;
            ( fhir:source [
fhir:context [ fhir:v "srcsec" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]               ] )             ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionPrescrizioneFarmaceutica" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "coverage" ] ;
fhir:type [ fhir:v "Coverage" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "medRq" ] ;
fhir:type [ fhir:v "MedicationRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "xxx" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/MedicationRequest/' + %medRq.id" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "fhirText" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "id" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "vvv" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]         ] )       ] [
fhir:name [ fhir:v "narrativeStatus" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "generated" ]           ] )         ] )       ] [
fhir:name [ fhir:v "narrativeText" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "div" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "t" ]           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "encounter" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Encounter/' + %enc.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "status" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "active" ]           ] )         ] )       ] [
fhir:name [ fhir:v "intent" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "intent" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "order" ]           ] )         ] )       ] [
fhir:name [ fhir:v "hnjh" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "srcent" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "subadm" ] ;
          ( fhir:source [
fhir:context [ fhir:v "srcent" ] ;
fhir:element [ fhir:v "substanceAdministration" ] ;
fhir:variable [ fhir:v "subAdm" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "dosage" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:type [ fhir:v "IVL_TS" ] ;
fhir:element [ fhir:v "effectiveTime" ] ;
fhir:variable [ fhir:v "eff" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dosageInstruction" ] ;
fhir:variable [ fhir:v "dosage" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Dosage" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "timing" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timing" ] ;
fhir:variable [ fhir:v "tim" ] ;
fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "Timing" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "repeat" ] ;
                ( fhir:source [
fhir:context [ fhir:v "subAdm" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "tim" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "repeat" ] ;
fhir:variable [ fhir:v "repeat" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "boundsperiod" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "eff" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "repeat" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "bounds" ] ;
fhir:variable [ fhir:v "period" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "Period" ]                     ] )                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "IVLTSPeriod" ] ;
                    ( fhir:variable [ fhir:v "eff" ] [ fhir:v "period" ] )                   ] )                 ] [
fhir:name [ fhir:v "width" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "eff" ] ;
fhir:element [ fhir:v "width" ] ;
fhir:variable [ fhir:v "width" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "value" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "width" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "v" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "repeat" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "duration" ] ;
fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "v" ]                       ] )                     ] )                   ] [
fhir:name [ fhir:v "unit" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "width" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:variable [ fhir:v "u" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "repeat" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "durationUnit" ] ;
fhir:transform [ fhir:v "copy" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "u" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "dosage1" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "effectiveTime" ] ;
fhir:variable [ fhir:v "eff" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dosageInstruction" ] ;
fhir:variable [ fhir:v "dosage" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Dosage" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "timing1" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timing" ] ;
fhir:variable [ fhir:v "tim" ] ;
fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "Timing" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "effct1" ] ;
                ( fhir:source [
fhir:context [ fhir:v "eff" ] ;
fhir:condition [ fhir:v "eff.low.exists().not() and eff.high.exists().not()" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "evnt" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "eff" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "v" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "tim" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "event" ] ;
fhir:variable [ fhir:v "event" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "dateTime" ]                     ] )                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "TSDateTime" ] ;
                    ( fhir:variable [ fhir:v "v" ] [ fhir:v "event" ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "eff" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:type [ fhir:v "PIVL_TS" ] ;
fhir:element [ fhir:v "effectiveTime" ] ;
fhir:variable [ fhir:v "effp" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dosageInstruction" ] ;
fhir:variable [ fhir:v "dosage" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Dosage" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "timing" ] ;
              ( fhir:source [
fhir:context [ fhir:v "effp" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timing" ] ;
fhir:variable [ fhir:v "timing" ] ;
fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "Timing" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "cod" ] ;
                ( fhir:source [
fhir:context [ fhir:v "effp" ]                 ] ) ;
                ( fhir:target [
fhir:contextType [ fhir:v "variable" ] ;
fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "timing" ]                   ] )                 ] ) ;
                ( fhir:dependent [
fhir:name [ fhir:v "periodTiming" ] ;
                  ( fhir:variable [ fhir:v "effp" ] [ fhir:v "timing" ] )                 ] )               ] [
fhir:name [ fhir:v "phase" ] ;
                ( fhir:source [
fhir:context [ fhir:v "effp" ] ;
fhir:condition [ fhir:v "effp.phase.exists()" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "rep" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "effp" ] ;
fhir:element [ fhir:v "phase" ] ;
fhir:variable [ fhir:v "phase" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "timing" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "repeat" ] ;
fhir:variable [ fhir:v "r" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "low" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "phase" ] ;
fhir:element [ fhir:v "low" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "bounds" ] ;
fhir:variable [ fhir:v "period" ] ;
fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "Period" ]                       ] )                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "lo" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "phase" ] ;
fhir:element [ fhir:v "low" ] ;
fhir:variable [ fhir:v "vvv" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "period" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "start" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                       ] )                     ] )                   ] [
fhir:name [ fhir:v "dur" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "phase" ] ;
fhir:element [ fhir:v "width" ] ;
fhir:variable [ fhir:v "wid" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "vals" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "wid" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "v" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "duration" ] ;
fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "v" ]                         ] )                       ] )                     ] [
fhir:name [ fhir:v "unit" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "wid" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:variable [ fhir:v "u" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "durationUnit" ] ;
fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "u" ]                         ] )                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "eff" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:type [ fhir:v "EIVL_TS" ] ;
fhir:element [ fhir:v "effectiveTime" ] ;
fhir:variable [ fhir:v "effe" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dosageInstruction" ] ;
fhir:variable [ fhir:v "dosage" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Dosage" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "ghj" ] ;
              ( fhir:source [
fhir:context [ fhir:v "effe" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timing" ] ;
fhir:variable [ fhir:v "timing" ] ;
fhir:transform [ fhir:v "create" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "Timing" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "lkj" ] ;
                ( fhir:source [
fhir:context [ fhir:v "effe" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "timing" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "repeat" ] ;
fhir:variable [ fhir:v "r" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "event" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "effe" ] ;
fhir:element [ fhir:v "event" ] ;
fhir:variable [ fhir:v "vvv" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "when" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                   ] )                 ] [
fhir:name [ fhir:v "poi" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "effe" ] ;
fhir:element [ fhir:v "offset" ] ;
fhir:variable [ fhir:v "offset" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "offs" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "offset" ] ;
fhir:element [ fhir:v "low" ] ;
fhir:variable [ fhir:v "v" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "barabar" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "v" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "o" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "offset" ] ;
fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "o" ]                         ] )                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "doseQuant" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "doseQuantity" ] ;
fhir:variable [ fhir:v "doseQuant" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dosageInstruction" ] ;
fhir:variable [ fhir:v "dosage" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Dosage" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "ot" ] ;
              ( fhir:source [
fhir:context [ fhir:v "doseQuant" ] ;
fhir:element [ fhir:v "originalText" ] ;
fhir:variable [ fhir:v "ot" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                ( fhir:source [
fhir:context [ fhir:v "ot" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "vvv" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                 ] )               ] )             ] [
fhir:name [ fhir:v "dosageRate" ] ;
              ( fhir:source [
fhir:context [ fhir:v "doseQuant" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dosage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "doseAndRate" ] ;
fhir:variable [ fhir:v "dosageRate" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "d" ] ;
                ( fhir:source [
fhir:context [ fhir:v "doseQuant" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "dosageRate" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dose" ] ;
fhir:variable [ fhir:v "d" ] ;
fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "Range" ]                   ] )                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "low" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "doseQuant" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "d" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "low" ] ;
fhir:variable [ fhir:v "l" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "SimpleQuantity" ]                     ] )                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "low" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "doseQuant" ] ;
fhir:element [ fhir:v "low" ] ;
fhir:variable [ fhir:v "lo" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "l" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "lo.value" ]                       ] )                     ] )                   ] [
fhir:name [ fhir:v "low" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "doseQuant" ] ;
fhir:element [ fhir:v "low" ] ;
fhir:variable [ fhir:v "lo" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "l" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "lo.unit" ]                       ] )                     ] )                   ] )                 ] [
fhir:name [ fhir:v "low" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "doseQuant" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "d" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "high" ] ;
fhir:variable [ fhir:v "h" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "SimpleQuantity" ]                     ] )                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "high" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "doseQuant" ] ;
fhir:element [ fhir:v "high" ] ;
fhir:variable [ fhir:v "hi" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "h" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "hi.value" ]                       ] )                     ] )                   ] [
fhir:name [ fhir:v "high" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "doseQuant" ] ;
fhir:element [ fhir:v "high" ] ;
fhir:variable [ fhir:v "hi" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "h" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "hi.unit" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "subsadm" ] ;
            ( fhir:source [
fhir:context [ fhir:v "subAdm" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e1" ]             ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]               ] )             ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "POST" ]               ] )             ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medication" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Medication" ]               ] )             ] [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid1" ] ;
fhir:transform [ fhir:v "uuid" ]             ] [
fhir:context [ fhir:v "e1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "https://example/Medication/" ]               ] [
fhir:value [ fhir:v "uuid1" ]               ] )             ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Medication" ]               ] )             ] [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "medication" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]               ] )             ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Medication/' + %medication.id" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "cons" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "consumable" ] ;
fhir:variable [ fhir:v "cons" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "manumat" ] ;
                ( fhir:source [
fhir:context [ fhir:v "cons" ] ;
fhir:element [ fhir:v "manufacturedProduct" ] ;
fhir:variable [ fhir:v "manuprod" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "manudrug" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "manuprod" ] ;
fhir:element [ fhir:v "manufacturedLabeledDrug" ] ;
fhir:variable [ fhir:v "manudrug" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manudrug" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                     ] )                   ] [
fhir:name [ fhir:v "idmedname" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manudrug" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "medid" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "name" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "manudrug" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "vvv" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "medid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                       ] )                     ] )                   ] [
fhir:name [ fhir:v "origtxtd" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manudrug" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "srctxt" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "reftxtd" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "srctxt" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "typetxt" ]                       ] ) ;
                      ( fhir:rule [
fhir:name [ fhir:v "tcfg" ] ;
                        ( fhir:source [
fhir:context [ fhir:v "srctxt" ] ;
fhir:element [ fhir:v "originalText" ] ;
fhir:variable [ fhir:v "ref" ]                         ] ) ;
                        ( fhir:rule [
fhir:name [ fhir:v "tcf" ] ;
                          ( fhir:source [
fhir:context [ fhir:v "ref" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "reference" ]                           ] ) ;
                          ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                            ( fhir:source [
fhir:context [ fhir:v "reference" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                             ] ) ;
                            ( fhir:target [
fhir:context [ fhir:v "typetxt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                              ( fhir:parameter [
fhir:value [ fhir:v "l" ]                               ] )                             ] )                           ] )                         ] )                       ] )                     ] )                   ] )                 ] [
fhir:name [ fhir:v "manuFact" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "manuprod" ] ;
fhir:element [ fhir:v "manufacturedMaterial" ] ;
fhir:variable [ fhir:v "manufact" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manufact" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                     ] )                   ] [
fhir:name [ fhir:v "origtxt" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manufact" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "srctxt" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "reftxt" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "srctxt" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "typetxt" ]                       ] ) ;
                      ( fhir:rule [
fhir:name [ fhir:v "tcfg" ] ;
                        ( fhir:source [
fhir:context [ fhir:v "srctxt" ] ;
fhir:element [ fhir:v "originalText" ] ;
fhir:variable [ fhir:v "ref" ]                         ] ) ;
                        ( fhir:rule [
fhir:name [ fhir:v "tcf" ] ;
                          ( fhir:source [
fhir:context [ fhir:v "ref" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "reference" ]                           ] ) ;
                          ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                            ( fhir:source [
fhir:context [ fhir:v "reference" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                             ] ) ;
                            ( fhir:target [
fhir:context [ fhir:v "typetxt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                              ( fhir:parameter [
fhir:value [ fhir:v "l" ]                               ] )                             ] )                           ] )                         ] )                       ] )                     ] )                   ] [
fhir:name [ fhir:v "ingr" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manufact" ] ;
fhir:element [ fhir:v "ingredient" ] ;
fhir:variable [ fhir:v "ingredient" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "ingredient" ] ;
fhir:variable [ fhir:v "ing" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "strength" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "ingredient" ] ;
fhir:element [ fhir:v "quantity" ] ;
fhir:variable [ fhir:v "quantity" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "ing" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "strength" ] ;
fhir:variable [ fhir:v "strength" ] ;
fhir:transform [ fhir:v "create" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "Ratio" ]                         ] )                       ] ) ;
                      ( fhir:dependent [
fhir:name [ fhir:v "EmedRTOPQPQRatio" ] ;
                        ( fhir:variable [ fhir:v "quantity" ] [ fhir:v "strength" ] )                       ] )                     ] [
fhir:name [ fhir:v "ingredientCode" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "manufact" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "ing" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "ingcode" ] ;
fhir:transform [ fhir:v "create" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]                         ] )                       ] [
fhir:context [ fhir:v "ingcode" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "%manufact.name.other" ]                         ] )                       ] )                     ] )                   ] [
fhir:name [ fhir:v "formCode" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manufact" ] ;
fhir:element [ fhir:v "formCode" ] ;
fhir:variable [ fhir:v "vvv" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "form" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                     ] )                   ] [
fhir:name [ fhir:v "transl" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "manufact" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "medid" ]                     ] )                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "entry1" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entryrel1" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "supply" ] ;
                ( fhir:source [
fhir:context [ fhir:v "entryrel1" ] ;
fhir:element [ fhir:v "supply" ] ;
fhir:variable [ fhir:v "sup" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "dispenseRequest" ] ;
fhir:variable [ fhir:v "dispreq" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "quantity" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "sup" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "dispreq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "quantity" ] ;
fhir:variable [ fhir:v "quantity" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "SimpleQuantity" ]                     ] )                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "quantity" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "sup" ] ;
fhir:element [ fhir:v "quantity" ] ;
fhir:variable [ fhir:v "q" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "quantity" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "q.value" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "entry2" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entryrel2" ] ;
fhir:condition [ fhir:v "(typeCode = 'REFR')" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "Cover" ] ;
                ( fhir:source [
fhir:context [ fhir:v "subAdm" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]                   ] )                 ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Coverage/' + %coverage.id" ]                   ] )                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "act2" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "entryrel2" ] ;
fhir:element [ fhir:v "act" ] ;
fhir:variable [ fhir:v "act2" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "costToBeneficiary" ] ;
fhir:variable [ fhir:v "cost" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "beneficmoney" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "act2" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "cost" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "val" ] ;
fhir:transform [ fhir:v "create" ] ;
                      ( fhir:parameter [
fhir:value [ fhir:v "SimpleQuantity" ]                       ] )                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "bnm" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "act2" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "val" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "0" ]                         ] )                       ] )                     ] )                   ] [
fhir:name [ fhir:v "exept" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "act2" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "cost" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "exception" ] ;
fhir:variable [ fhir:v "except" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "act2" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "except" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "entry2" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entryrel3" ] ;
fhir:condition [ fhir:v "(typeCode = 'RSON')" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "obs3" ] ;
                ( fhir:source [
fhir:context [ fhir:v "entryrel3" ] ;
fhir:element [ fhir:v "observation" ] ;
fhir:variable [ fhir:v "obs3" ] ;
fhir:condition [ fhir:v "(classCode = 'OBS')" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "obs3" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reasonCode" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                   ] )                 ] [
fhir:name [ fhir:v "txt" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "obs3" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "text" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "originltext" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "text" ]                     ] ) ;
                    ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reasonCode" ] ;
fhir:variable [ fhir:v "ce" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "tcf" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "text" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "reference" ]                       ] ) ;
                      ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                        ( fhir:source [
fhir:context [ fhir:v "reference" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                         ] ) ;
                        ( fhir:target [
fhir:context [ fhir:v "ce" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                          ( fhir:parameter [
fhir:value [ fhir:v "l" ]                           ] )                         ] )                       ] ) ;
fhir:documentation [ fhir:v "text.reference as reference-> ce.text=reference;" ]                     ] )                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "code" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entryrel4" ] ;
fhir:condition [ fhir:v "(typeCode = 'SUBJ')" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "obs" ] ;
                ( fhir:source [
fhir:context [ fhir:v "entryrel4" ] ;
fhir:element [ fhir:v "observation" ] ;
fhir:variable [ fhir:v "obs3" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "substitution" ] ;
fhir:variable [ fhir:v "sub" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "obs3" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "Code" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "sub" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "allowed" ] ;
fhir:variable [ fhir:v "allowed" ] ;
fhir:transform [ fhir:v "create" ] ;
                    ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]                     ] )                   ] ) ;
                  ( fhir:dependent [
fhir:name [ fhir:v "CECodeableConcept" ] ;
                    ( fhir:variable [ fhir:v "Code" ] [ fhir:v "allowed" ] )                   ] )                 ] [
fhir:name [ fhir:v "entry" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "obs3" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entry" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "obs4" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "entry" ] ;
fhir:element [ fhir:v "observation" ] ;
fhir:variable [ fhir:v "obs4" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "code" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "obs4" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "sub" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reason" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]                       ] )                     ] )                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "entry2" ] ;
              ( fhir:source [
fhir:context [ fhir:v "subAdm" ] ;
fhir:element [ fhir:v "entryRelationship" ] ;
fhir:variable [ fhir:v "entryrel2" ] ;
fhir:condition [ fhir:v "(typeCode = 'SUBJ')" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "obs3" ] ;
                ( fhir:source [
fhir:context [ fhir:v "entryrel2" ] ;
fhir:element [ fhir:v "act" ] ;
fhir:variable [ fhir:v "act2" ] ;
fhir:condition [ fhir:v "(classCode = 'ACT')" ]                 ] ) ;
                ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                  ( fhir:source [
fhir:context [ fhir:v "act2" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "text" ]                   ] ) ;
                  ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]                   ] ) ;
                  ( fhir:rule [
fhir:name [ fhir:v "tcx" ] ;
                    ( fhir:source [
fhir:context [ fhir:v "text" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "t" ]                     ] ) ;
                    ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                      ( fhir:source [
fhir:context [ fhir:v "t" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                       ] ) ;
                      ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                        ( fhir:parameter [
fhir:value [ fhir:v "l" ]                         ] )                       ] )                     ] )                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionAnnotazioni" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "------------Sezione Annotazioni-----------------------------------------------------------------------------------------------------------------------------------------" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "medRq" ] ;
fhir:type [ fhir:v "MedicationRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "entry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/MedicationRequest/' + %medRq.id" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "fhirText" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "narrativeStatus" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "generated" ]           ] )         ] )       ] [
fhir:name [ fhir:v "narrativeText" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "fhirText" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "div" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "t" ]           ] )         ] )       ] [
fhir:name [ fhir:v "entry" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "entry" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "act" ] ;
          ( fhir:source [
fhir:context [ fhir:v "entry" ] ;
fhir:element [ fhir:v "act" ] ;
fhir:variable [ fhir:v "act" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
            ( fhir:source [
fhir:context [ fhir:v "act" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "text" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "tcx" ] ;
              ( fhir:source [
fhir:context [ fhir:v "text" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "t" ]               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
                ( fhir:source [
fhir:context [ fhir:v "t" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "l" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "l" ]                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionMessaggioRegionale" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "------------Sezione Messaggio Regionale-----------------------------------------------------------------------------------------------------------------------------------------" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "medRq" ] ;
fhir:type [ fhir:v "MedicationRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "entry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/MedicationRequest/' + %medRq.id" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "nota" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "text" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "medRq" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
          ( fhir:source [
fhir:context [ fhir:v "text" ] ;
fhir:variable [ fhir:v "t" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "t" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionParametriVitali" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "------------Sezione Parametri Vitali-----------------------------------------------------------------------------------------------------------------------------------------" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "nota" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e8" ]       ] [
fhir:context [ fhir:v "e8" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e8" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "Observation" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Observation" ]         ] )       ] [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid8" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e8" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/Observation/" ]         ] [
fhir:value [ fhir:v "uuid8" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Observation" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Observation/' + %Observation.id" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "encounter" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Encounter/' + %enc.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "code" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]         ] )       ] [
fhir:name [ fhir:v "statuscode" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:condition [ fhir:v "Observation.statusCode.exists().not()" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "status" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "final" ]             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
          ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "t" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionAllergieaiFarmaci" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "------------Sezione Allergie_Intolleranze-----------------------------------------------------------------------------------------------------------------------------------------" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "nota" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e9" ]       ] [
fhir:context [ fhir:v "e9" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e9" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "allergyIntolerance" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AllergyIntolerance" ]         ] )       ] [
fhir:context [ fhir:v "allergyIntolerance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid9" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e9" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/AllergyIntolerance/" ]         ] [
fhir:value [ fhir:v "uuid9" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AllergyIntolerance" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/AllergyIntolerance/' + %allergyIntolerance.id" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "allergyIntolerance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patient" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "allergy" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "allergyIntolerance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "clinicalStatus" ] ;
fhir:variable [ fhir:v "status" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "text" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "status" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "string" ]             ] )           ] )         ] [
fhir:name [ fhir:v "coding" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "status" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "active" ] ;
            ( fhir:source [
fhir:context [ fhir:v "src" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "active" ]               ] )             ] )           ] [
fhir:name [ fhir:v "system" ] ;
            ( fhir:source [
fhir:context [ fhir:v "src" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical" ]               ] )             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "allergyIntolerance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
          ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "t" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ClinicalDocumentSectionStatoClinicoPaziente" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "------------Sezione Stato Clinico del Paziente----------------------------------------------------------------------------------------------------------------------------------------" ] ;
    ( fhir:input [
fhir:name [ fhir:v "cda" ] ;
fhir:type [ fhir:v "ClinicalDocument" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Section" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "enc" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "title" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:variable [ fhir:v "t" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "t.dataString" ]         ] )       ] )     ] [
fhir:name [ fhir:v "code" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]       ] )     ] [
fhir:name [ fhir:v "nota" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "cdaText" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e7" ]       ] [
fhir:context [ fhir:v "e7" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "e7" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "Observation" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Observation" ]         ] )       ] [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid7" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e7" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://example/Observation/" ]         ] [
fhir:value [ fhir:v "uuid7" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Observation" ]         ] )       ] [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Observation/' + %Observation.id" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Patient/' + %patient.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "encounter" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'https://example/Encounter/' + %enc.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "code" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "vvv" ] ;
fhir:transform [ fhir:v "create" ]         ] )       ] [
fhir:name [ fhir:v "statuscode" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:condition [ fhir:v "Observation.statusCode.exists().not()" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "status" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "final" ]             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "reference" ] ;
        ( fhir:source [
fhir:context [ fhir:v "cdaText" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "Observation" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "reference" ] ;
          ( fhir:source [
fhir:context [ fhir:v "cdaText" ] ;
fhir:variable [ fhir:v "t" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "t" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "periodTiming" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "effectiveTime" ] ;
fhir:type [ fhir:v "PIVL_TS" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "timing" ] ;
fhir:type [ fhir:v "Timing" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "repeat" ] ;
      ( fhir:source [
fhir:context [ fhir:v "effectiveTime" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "timing" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "repeat" ] ;
fhir:variable [ fhir:v "r" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "period" ] ;
        ( fhir:source [
fhir:context [ fhir:v "effectiveTime" ] ;
fhir:element [ fhir:v "period" ] ;
fhir:variable [ fhir:v "p" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "period" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "p.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "period" ] ;
        ( fhir:source [
fhir:context [ fhir:v "effectiveTime" ] ;
fhir:element [ fhir:v "period" ] ;
fhir:variable [ fhir:v "p" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "r" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "periodUnit" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "p.unit" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "EmedRTOPQPQRatio" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "RTO_PQ_PQ" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "Ratio" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "numerator" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "numerator" ] ;
fhir:variable [ fhir:v "numerator" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "numerator" ] ;
fhir:variable [ fhir:v "targetNumerator" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "EmedPQQuantity" ] ;
        ( fhir:variable [ fhir:v "numerator" ] [ fhir:v "targetNumerator" ] )       ] )     ] [
fhir:name [ fhir:v "denominator" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "denominator" ] ;
fhir:variable [ fhir:v "denominator" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "denominator" ] ;
fhir:variable [ fhir:v "targetDenominator" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "EmedPQQuantity" ] ;
        ( fhir:variable [ fhir:v "denominator" ] [ fhir:v "targetDenominator" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "EmedPQQuantity" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "PQ" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "Quantity" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "value" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "unit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:variable [ fhir:v "unit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "unit" ]         ] )       ] )     ] [
fhir:name [ fhir:v "unit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:variable [ fhir:v "unit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'http://fhir.ch/ig/ch-emed/ValueSet/UnitCode'.resolve().compose.include.where(concept.where(code = %unit)).system" ]         ] )       ] )     ] [
fhir:name [ fhir:v "unit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:variable [ fhir:v "unit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "unit" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'http://fhir.ch/ig/ch-emed/ValueSet/UnitCode'.resolve().compose.include.concept.where(code = %unit).display" ]         ] )       ] )     ] )
  ] ) . #