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