CDA-FHIR-Maps (R4)
0.3.0 - DSTU 1
This page is part of the CDA-FHIR-Maps (R4) (v0.3.0: DSTU 1) based on FHIR R4. . For a full list of available versions, see the Directory of published versions
<StructureMap xmlns="http://hl7.org/fhir">
<id value="CdaToBundle"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle" = "CdaToBundle"
// CDA document
// 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License
// CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html
// FHIR: http://hl7.org/fhir/r4/
conceptmap "cm-v3-administrative-gender" {
prefix s = "http://terminology.hl7.org/ValueSet/v3-AdministrativeGender"
prefix t = "http://hl7.org/fhir/ValueSet/administrative-gender"
s:M == t:male
s:F == t:female
}
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/CustodianOrganization" alias CustodianOrganization 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/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/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
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes"
group CdaToBundle(source cda : ClinicalDocument, target bundle : Bundle) {
cda -> bundle.entry as e, e.resource = create('Composition') as composition, composition.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid), bundle.entry as e2, e2.resource = create('Patient') as patient, patient.id = uuid() as uuid2, e2.fullUrl = append('urn:uuid:', uuid2) then {
cda then ClinicalDocumentToBundle(cda, patient, composition, bundle) "cdatobundle";
} "ClinicalDocumentToBody";
}
group ClinicalDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle) {
cda -> bundle.id = uuid() "id";
cda.id -> bundle.identifier "identifier";
cda -> bundle.type = 'document' "type";
cda.effectiveTime -> bundle.timestamp;
cda then ClinicalDocumentComposition(cda, composition, patient, bundle) "composition";
cda.component as component then {
component.structuredBody as body then {
body.component as component log 'component' then {
component.section as srcSection where $this.code.empty() -> composition.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);
};
} "body";
};
}
// _________________________ Section Level Templates _________________________
group ClinicalDocumentSection(source cda : ClinicalDocument, source src : Section, source patient : Patient, target tgt, target bundle : Bundle) {
src.id as id where ($this.root = %cda.id.root) = false -> tgt.extension as ext then ChExtEprSectionId(id, ext) "sectionId";
src.title as t -> tgt.title = (t.dataString);
src.code -> tgt.code;
src.text as cdaText -> tgt.text as fhirText then {
cdaText -> fhirText.status = 'generated' "narrativeStatus";
cdaText as t -> fhirText.div = t "narrativeText";
} "cdaText";
src.section as srcSection -> tgt.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);
}
// _________________________ Entry Level Templates ________________________
// _________________________ Header Level Templates _________________________
group ClinicalDocumentComposition(source src : ClinicalDocument, target tgt : Composition, target patientResource : Patient, target bundle : Bundle) {
src.languageCode -> tgt.language;
src.id where src.setId.exists().not() -> tgt.identifier "identifier";
src.setId -> tgt.identifier "identifier";
src -> tgt.status = 'final' "status";
src.code -> tgt.type;
src.title as t -> tgt.title = (t.dataString);
src.recordTarget as recordTarget then {
recordTarget.patientRole as patient -> tgt.subject = create('Reference') as reference, reference.reference = ('urn:uuid:' + %patientResource.id) then ClinicalDocumentPatientRole(patient, patientResource, bundle) "subject";
} "patientRole";
src.componentOf as comp -> bundle.entry as e, e.resource = create('Encounter') as encounter, encounter.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid) then {
comp.encompassingEncounter as srcEnc -> tgt.encounter = create('Reference') as reference, reference.reference = ('urn:uuid:' + %encounter.id) then ClinicalDocumentEncounter(srcEnc, bundle, encounter) "srcEncounter";
} "encompassingEncounter";
src.effectiveTime -> tgt.date;
src.author as srcAuthor -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2), tgt.author = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then {
srcAuthor.time as time -> reference.extension as exttime then ChExtEprTime(time, exttime);
srcAuthor.assignedAuthor as assignedAuthor then {
assignedAuthor.id -> practitioner.identifier;
assignedAuthor.addr -> practitioner.address;
assignedAuthor.telecom -> practitioner.telecom;
assignedAuthor.assignedPerson as person then {
person.name -> practitioner.name;
} "name";
assignedAuthor.representedOrganization as srcOrg -> bundle.entry as e2, e2.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e2.fullUrl = append('urn:uuid:', uuid3), tgt.author = create('Reference') as reference2, reference2.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization);
} "author";
} "srcAuthor";
src.confidentialityCode -> tgt.confidentiality;
src.legalAuthenticator as legalAuth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {
legalAuth -> tgt.attester as attester then {
legalAuth -> attester.mode = 'legal' "mode";
legalAuth.time -> attester.time;
legalAuth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity";
} "attester";
} "legalAuth";
src.authenticator as auth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {
auth -> tgt.attester as attester then {
auth -> attester.mode = 'official' "mode";
auth.time -> attester.time;
auth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity";
} "attester";
} "auth";
src.custodian as custodian -> bundle.entry as e then {
custodian.assignedCustodian as assignedCustodian -> e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {
assignedCustodian.representedCustodianOrganization as srcOrg -> tgt.custodian = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "assignedCustodian";
} "custodian";
} "cust";
src.documentationOf as docOf then {
docOf.serviceEvent as serviceEvent -> tgt.event as event then {
serviceEvent.code -> event.code "eventCode";
serviceEvent.effectiveTime -> event.period "eventTime";
} "docOf";
};
src.relatedDocument as relatedDoc -> tgt.relatesTo as relates then {
relatedDoc.typeCode -> relates.code;
relatedDoc.parentDocument as parentDoc then {
parentDoc.setId -> relates.targetIdentifier;
} "parentDoc";
} "relatedDoc";
}
group ClinicalDocumentEntityPractitioner(source src : AssignedEntity, target tgt : Practitioner) {
src.id -> tgt.identifier;
src.addr -> tgt.address;
src.telecom -> tgt.telecom;
src.assignedPerson as person then {
person.name -> tgt.name;
} "name";
}
group ClinicalDocumentOrganization(source src : CustodianOrganization, target tgt : Organization) {
src.id -> tgt.identifier;
src.name as v -> tgt.name = (v.other);
src.telecom -> tgt.telecom;
src.addr -> tgt.address;
}
group ClinicalDocumentPatientRole(source src : PatientRole, target tgt : Patient, target bundle : Bundle) {
// src.id -> tgt.identifier;
src -> tgt.identifier as identifier then {
src.id as id -> identifier.type as type, type.coding as coding, coding.system as system, coding.code as code then {
src -> system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' "system";
src -> code.value = 'MR' "code";
id.extension as extension -> identifier.value as value, value.value = extension;
id.root as root -> identifier.system as system, system.value = append('urn:oid:', root);
};
} "identifier";
src.addr -> tgt.address;
src.telecom -> tgt.telecom;
src.patient as patient then {
patient.name -> tgt.name;
patient.administrativeGenderCode as gender then {
gender.code as v -> tgt.gender = translate(v, '#cm-v3-administrative-gender', 'code') "gender";
} "gender";
patient.birthTime -> tgt.birthDate "birthDate";
patient.deceasedInd as indicator where patient.deceasedTime.empty() -> tgt.deceased = create('boolean') as bool then boolean(indicator, bool) "deceasedBL";
patient.deceasedTime -> tgt.deceased;
patient.maritalStatusCode -> tgt.maritalStatus "maritalStatus";
patient.languageCommunication as language -> tgt.communication as communication then {
language.languageCode -> communication.language "communication";
} "language";
};
src.providerOrganization as org -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {
org -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) "reference";
org.id -> organization.identifier;
org.name as v -> organization.name = (v.other);
org.telecom -> organization.telecom;
org.addr -> organization.address;
} "organization";
}
group ClinicalDocumentEncounter(source src : EncompassingEncounter, target bundle : Bundle, target tgt : Encounter) {
src.id -> tgt.identifier;
src.code -> tgt.type;
src.effectiveTime -> tgt.period;
src where admissionReferralSourceCode.exists() or dischargeDispositionCode.exists() -> tgt.hospitalization as hosp then {
src.admissionReferralSourceCode -> hosp.admitSource "adminReferral";
src.dischargeDispositionCode -> hosp.dischargeDisposition "discDisposition";
} "hospitalization";
src.encounterParticipant as srcPart -> tgt.participant as tgtPart then {
srcPart.typeCode as code -> tgtPart.type = cc('http://terminology.hl7.org/CodeSystem/v3-ParticipationType', code);
srcPart.time -> tgtPart.period;
srcPart.assignedEntity as entity -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {
entity -> tgtPart.individual = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entry";
} "entity";
} "participant";
src.location as srcLocation then {
srcLocation.healthCareFacility as facility -> bundle.entry as e, e.resource = create('Location') as location, location.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {
facility -> tgt.location as tgtLocation, tgtLocation.location = create('Reference') as reference, reference.reference = ('urn:uuid:' + %location.id) then ClinicalDocumentLocation(facility, bundle, location) "facLocation";
} "facility";
};
}
group ClinicalDocumentLocation(source src : HealthCareFacility, target bundle : Bundle, target tgt : Location) {
src.id -> tgt.identifier;
src.code -> tgt.type;
src.location as location then {
// place names are usually stored with no parts location.name as srcName -> tgt.name = cast(srcName, 'string');
location.addr -> tgt.address;
location.serviceProviderOrganization as srcOrg -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {
srcOrg -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "organization";
} "org";
};
}
// source dataEnterer: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.2.7
// source author: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.840.1.113883.10.12.102
// target: https://build.fhir.org/ig/hl7ch/ch-core//StructureDefinition-ch-ext-epr-time.html
group ChExtEprTime(source src : TSDateTime, target ext : Extension) {
src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time' "url";
src -> ext.value = create('dateTime') as value then TSDateTime(src, value) "value";
}
// https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.45
// target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-sectionid.html
group ChExtEprSectionId(source src : II, target ext : Extension) {
src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-sectionid' "url";
src -> ext.value = create('Identifier') as value then II(src, value) "value";
}
// _________________________ Template Type not specified ___________________
group NarrativeLink(source url, target ext : Extension) {
url -> ext.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' "url";
url -> ext.value = create('url') as value, value.value = url "value";
}
</pre>
</div>
</text>
<contained>
<ConceptMap>
<id value="cm-v3-administrative-gender"/>
<status value="draft"/>
<group>
<source
value="http://terminology.hl7.org/ValueSet/v3-AdministrativeGender"/>
<target value="http://hl7.org/fhir/ValueSet/administrative-gender"/>
<element>
<code value="M"/>
<target>
<code value="male"/>
<equivalence value="equivalent"/>
</target>
</element>
<element>
<code value="F"/>
<target>
<code value="female"/>
<equivalence value="equivalent"/>
</target>
</element>
</group>
</ConceptMap>
</contained>
<extension url="http://fhir.ch/reference">
<valueReference>
<reference value="#cm-v3-administrative-gender"/>
</valueReference>
</extension>
<url value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle"/>
<version value="0.3.0"/>
<name value="CdaToBundle"/>
<status value="draft"/>
<date value="2022-02-11T11:14:39+01:00"/>
<publisher value="ahdis"/>
<contact>
<name value="ahdis"/>
<telecom>
<system value="url"/>
<value value="http://www.ahdis.ch/"/>
</telecom>
</contact>
<description
value="CDA document 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html FHIR: http://hl7.org/fhir/r4/"/>
<copyright value="CC-BY-SA-4.0"/>
<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/CustodianOrganization"/>
<mode value="queried"/>
<alias value="CustodianOrganization"/>
</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/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/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>
<import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes"/>
<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="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="uuid"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid"/>
</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="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="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</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="bundle"/>
</dependent>
</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="bundle"/>
<type value="Bundle"/>
<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="document"/>
</parameter>
</target>
</rule>
<rule>
<name value="effectiveTime"/>
<source>
<context value="cda"/>
<element value="effectiveTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="timestamp"/>
<variable value="vvv"/>
<transform value="create"/>
</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="bundle"/>
</dependent>
</rule>
<rule>
<name value="component"/>
<source>
<context value="cda"/>
<element value="component"/>
<variable value="component"/>
</source>
<rule>
<name value="body"/>
<source>
<context value="component"/>
<element value="structuredBody"/>
<variable value="body"/>
</source>
<rule>
<name value="component"/>
<source>
<context value="body"/>
<element value="component"/>
<variable value="component"/>
<logMessage value="'component'"/>
</source>
<rule>
<name value="section"/>
<source>
<context value="component"/>
<element value="section"/>
<variable value="srcSection"/>
<condition value="$this.code.empty()"/>
</source>
<target>
<context value="composition"/>
<contextType value="variable"/>
<element value="section"/>
<variable value="tgtSection"/>
</target>
<dependent>
<name value="ClinicalDocumentSection"/>
<variable value="cda"/>
<variable value="srcSection"/>
<variable value="patient"/>
<variable value="tgtSection"/>
<variable value="bundle"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
</group>
<group>
<name value="ClinicalDocumentSection"/>
<typeMode value="none"/>
<documentation
value="_________________________ Section Level Templates _________________________"/>
<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="source"/>
</input>
<input>
<name value="tgt"/>
<mode value="target"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<rule>
<name value="sectionId"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="id"/>
<condition value="($this.root = %cda.id.root) = false"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="extension"/>
<variable value="ext"/>
</target>
<dependent>
<name value="ChExtEprSectionId"/>
<variable value="id"/>
<variable value="ext"/>
</dependent>
</rule>
<rule>
<name value="title"/>
<source>
<context value="src"/>
<element value="title"/>
<variable value="t"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="title"/>
<transform value="evaluate"/>
<parameter>
<valueString value="t.dataString"/>
</parameter>
</target>
</rule>
<rule>
<name value="code"/>
<source>
<context value="src"/>
<element value="code"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="cdaText"/>
<source>
<context value="src"/>
<element value="text"/>
<variable value="cdaText"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="text"/>
<variable value="fhirText"/>
</target>
<rule>
<name value="narrativeStatus"/>
<source>
<context value="cdaText"/>
</source>
<target>
<context value="fhirText"/>
<contextType value="variable"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="generated"/>
</parameter>
</target>
</rule>
<rule>
<name value="narrativeText"/>
<source>
<context value="cdaText"/>
<variable value="t"/>
</source>
<target>
<context value="fhirText"/>
<contextType value="variable"/>
<element value="div"/>
<transform value="copy"/>
<parameter>
<valueId value="t"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="section"/>
<source>
<context value="src"/>
<element value="section"/>
<variable value="srcSection"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="section"/>
<variable value="tgtSection"/>
</target>
<dependent>
<name value="ClinicalDocumentSection"/>
<variable value="cda"/>
<variable value="srcSection"/>
<variable value="patient"/>
<variable value="tgtSection"/>
<variable value="bundle"/>
</dependent>
</rule>
</group>
<group>
<name value="ClinicalDocumentComposition"/>
<typeMode value="none"/>
<documentation
value="_________________________ Entry Level Templates ________________________ _________________________ Header Level Templates _________________________"/>
<input>
<name value="src"/>
<type value="ClinicalDocument"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Composition"/>
<mode value="target"/>
</input>
<input>
<name value="patientResource"/>
<type value="Patient"/>
<mode value="target"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<rule>
<name value="languageCode"/>
<source>
<context value="src"/>
<element value="languageCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="language"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="identifier"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="vvv"/>
<condition value="src.setId.exists().not()"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="identifier"/>
<source>
<context value="src"/>
<element value="setId"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="status"/>
<source>
<context value="src"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="final"/>
</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="type"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<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="patientRole"/>
<source>
<context value="src"/>
<element value="recordTarget"/>
<variable value="recordTarget"/>
</source>
<rule>
<name value="subject"/>
<source>
<context value="recordTarget"/>
<element value="patientRole"/>
<variable value="patient"/>
</source>
<target>
<context value="tgt"/>
<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="'urn:uuid:' + %patientResource.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentPatientRole"/>
<variable value="patient"/>
<variable value="patientResource"/>
<variable value="bundle"/>
</dependent>
</rule>
</rule>
<rule>
<name value="encompassingEncounter"/>
<source>
<context value="src"/>
<element value="componentOf"/>
<variable value="comp"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<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="uuid"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid"/>
</parameter>
</target>
<rule>
<name value="srcEncounter"/>
<source>
<context value="comp"/>
<element value="encompassingEncounter"/>
<variable value="srcEnc"/>
</source>
<target>
<context value="tgt"/>
<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="'urn:uuid:' + %encounter.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentEncounter"/>
<variable value="srcEnc"/>
<variable value="bundle"/>
<variable value="encounter"/>
</dependent>
</rule>
</rule>
<rule>
<name value="effectiveTime"/>
<source>
<context value="src"/>
<element value="effectiveTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="date"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="srcAuthor"/>
<source>
<context value="src"/>
<element value="author"/>
<variable value="srcAuthor"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="practitioner"/>
<transform value="create"/>
<parameter>
<valueString value="Practitioner"/>
</parameter>
</target>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid2"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</parameter>
</target>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="author"/>
<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="'urn:uuid:' + %practitioner.id"/>
</parameter>
</target>
<rule>
<name value="time"/>
<source>
<context value="srcAuthor"/>
<element value="time"/>
<variable value="time"/>
</source>
<target>
<context value="reference"/>
<contextType value="variable"/>
<element value="extension"/>
<variable value="exttime"/>
</target>
<dependent>
<name value="ChExtEprTime"/>
<variable value="time"/>
<variable value="exttime"/>
</dependent>
</rule>
<rule>
<name value="author"/>
<source>
<context value="srcAuthor"/>
<element value="assignedAuthor"/>
<variable value="assignedAuthor"/>
</source>
<rule>
<name value="id"/>
<source>
<context value="assignedAuthor"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="addr"/>
<source>
<context value="assignedAuthor"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="telecom"/>
<source>
<context value="assignedAuthor"/>
<element value="telecom"/>
<variable value="vvv"/>
</source>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="name"/>
<source>
<context value="assignedAuthor"/>
<element value="assignedPerson"/>
<variable value="person"/>
</source>
<rule>
<name value="name"/>
<source>
<context value="person"/>
<element value="name"/>
<variable value="vvv"/>
</source>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
<rule>
<name value="representedOrganization"/>
<source>
<context value="assignedAuthor"/>
<element value="representedOrganization"/>
<variable value="srcOrg"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e2"/>
</target>
<target>
<context value="e2"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="organization"/>
<transform value="create"/>
<parameter>
<valueString value="Organization"/>
</parameter>
</target>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid3"/>
<transform value="uuid"/>
</target>
<target>
<context value="e2"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid3"/>
</parameter>
</target>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="author"/>
<variable value="reference2"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<target>
<context value="reference2"/>
<contextType value="variable"/>
<element value="reference"/>
<transform value="evaluate"/>
<parameter>
<valueString value="'urn:uuid:' + %organization.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentOrganization"/>
<variable value="srcOrg"/>
<variable value="organization"/>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="confidentialityCode"/>
<source>
<context value="src"/>
<element value="confidentialityCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="confidentiality"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="legalAuth"/>
<source>
<context value="src"/>
<element value="legalAuthenticator"/>
<variable value="legalAuth"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="practitioner"/>
<transform value="create"/>
<parameter>
<valueString value="Practitioner"/>
</parameter>
</target>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid2"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</parameter>
</target>
<rule>
<name value="attester"/>
<source>
<context value="legalAuth"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="attester"/>
<variable value="attester"/>
</target>
<rule>
<name value="mode"/>
<source>
<context value="legalAuth"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="mode"/>
<transform value="copy"/>
<parameter>
<valueString value="legal"/>
</parameter>
</target>
</rule>
<rule>
<name value="time"/>
<source>
<context value="legalAuth"/>
<element value="time"/>
<variable value="vvv"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="time"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="entity"/>
<source>
<context value="legalAuth"/>
<element value="assignedEntity"/>
<variable value="entity"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="party"/>
<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="'urn:uuid:' + %practitioner.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentEntityPractitioner"/>
<variable value="entity"/>
<variable value="practitioner"/>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="auth"/>
<source>
<context value="src"/>
<element value="authenticator"/>
<variable value="auth"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="practitioner"/>
<transform value="create"/>
<parameter>
<valueString value="Practitioner"/>
</parameter>
</target>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid2"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</parameter>
</target>
<rule>
<name value="attester"/>
<source>
<context value="auth"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="attester"/>
<variable value="attester"/>
</target>
<rule>
<name value="mode"/>
<source>
<context value="auth"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="mode"/>
<transform value="copy"/>
<parameter>
<valueString value="official"/>
</parameter>
</target>
</rule>
<rule>
<name value="time"/>
<source>
<context value="auth"/>
<element value="time"/>
<variable value="vvv"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="time"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="entity"/>
<source>
<context value="auth"/>
<element value="assignedEntity"/>
<variable value="entity"/>
</source>
<target>
<context value="attester"/>
<contextType value="variable"/>
<element value="party"/>
<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="'urn:uuid:' + %practitioner.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentEntityPractitioner"/>
<variable value="entity"/>
<variable value="practitioner"/>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="cust"/>
<source>
<context value="src"/>
<element value="custodian"/>
<variable value="custodian"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<rule>
<name value="custodian"/>
<source>
<context value="custodian"/>
<element value="assignedCustodian"/>
<variable value="assignedCustodian"/>
</source>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="organization"/>
<transform value="create"/>
<parameter>
<valueString value="Organization"/>
</parameter>
</target>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid3"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid3"/>
</parameter>
</target>
<rule>
<name value="assignedCustodian"/>
<source>
<context value="assignedCustodian"/>
<element value="representedCustodianOrganization"/>
<variable value="srcOrg"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="custodian"/>
<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="'urn:uuid:' + %organization.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentOrganization"/>
<variable value="srcOrg"/>
<variable value="organization"/>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="documentationOf"/>
<source>
<context value="src"/>
<element value="documentationOf"/>
<variable value="docOf"/>
</source>
<rule>
<name value="docOf"/>
<source>
<context value="docOf"/>
<element value="serviceEvent"/>
<variable value="serviceEvent"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="event"/>
<variable value="event"/>
</target>
<rule>
<name value="eventCode"/>
<source>
<context value="serviceEvent"/>
<element value="code"/>
<variable value="vvv"/>
</source>
<target>
<context value="event"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="eventTime"/>
<source>
<context value="serviceEvent"/>
<element value="effectiveTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="event"/>
<contextType value="variable"/>
<element value="period"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="relatedDoc"/>
<source>
<context value="src"/>
<element value="relatedDocument"/>
<variable value="relatedDoc"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="relatesTo"/>
<variable value="relates"/>
</target>
<rule>
<name value="typeCode"/>
<source>
<context value="relatedDoc"/>
<element value="typeCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="relates"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="parentDoc"/>
<source>
<context value="relatedDoc"/>
<element value="parentDocument"/>
<variable value="parentDoc"/>
</source>
<rule>
<name value="setId"/>
<source>
<context value="parentDoc"/>
<element value="setId"/>
<variable value="vvv"/>
</source>
<target>
<context value="relates"/>
<contextType value="variable"/>
<element value="targetIdentifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
</rule>
</group>
<group>
<name value="ClinicalDocumentEntityPractitioner"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="AssignedEntity"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Practitioner"/>
<mode value="target"/>
</input>
<rule>
<name value="id"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="addr"/>
<source>
<context value="src"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="telecom"/>
<source>
<context value="src"/>
<element value="telecom"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="name"/>
<source>
<context value="src"/>
<element value="assignedPerson"/>
<variable value="person"/>
</source>
<rule>
<name value="name"/>
<source>
<context value="person"/>
<element value="name"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
</group>
<group>
<name value="ClinicalDocumentOrganization"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="CustodianOrganization"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Organization"/>
<mode value="target"/>
</input>
<rule>
<name value="id"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="name"/>
<source>
<context value="src"/>
<element value="name"/>
<variable value="v"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="name"/>
<transform value="evaluate"/>
<parameter>
<valueString value="v.other"/>
</parameter>
</target>
</rule>
<rule>
<name value="telecom"/>
<source>
<context value="src"/>
<element value="telecom"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="addr"/>
<source>
<context value="src"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</group>
<group>
<name value="ClinicalDocumentPatientRole"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="PatientRole"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Patient"/>
<mode value="target"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<rule>
<name value="identifier"/>
<source>
<context value="src"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="identifier"/>
</target>
<rule>
<name value="id"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="id"/>
</source>
<target>
<context value="identifier"/>
<contextType value="variable"/>
<element value="type"/>
<variable value="type"/>
</target>
<target>
<context value="type"/>
<contextType value="variable"/>
<element value="coding"/>
<variable value="coding"/>
</target>
<target>
<context value="coding"/>
<contextType value="variable"/>
<element value="system"/>
<variable value="system"/>
</target>
<target>
<context value="coding"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="code"/>
</target>
<rule>
<name value="system"/>
<source>
<context value="src"/>
</source>
<target>
<context value="system"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueString value="http://terminology.hl7.org/CodeSystem/v2-0203"/>
</parameter>
</target>
</rule>
<rule>
<name value="code"/>
<source>
<context value="src"/>
</source>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueString value="MR"/>
</parameter>
</target>
</rule>
<rule>
<name value="extension"/>
<source>
<context value="id"/>
<element value="extension"/>
<variable value="extension"/>
</source>
<target>
<context value="identifier"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="value"/>
</target>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="extension"/>
</parameter>
</target>
</rule>
<rule>
<name value="root"/>
<source>
<context value="id"/>
<element value="root"/>
<variable value="root"/>
</source>
<target>
<context value="identifier"/>
<contextType value="variable"/>
<element value="system"/>
<variable value="system"/>
</target>
<target>
<context value="system"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="append"/>
<parameter>
<valueString value="urn:oid:"/>
</parameter>
<parameter>
<valueId value="root"/>
</parameter>
</target>
</rule>
</rule>
<documentation value="src.id -> tgt.identifier;"/>
</rule>
<rule>
<name value="addr"/>
<source>
<context value="src"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="telecom"/>
<source>
<context value="src"/>
<element value="telecom"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="patient"/>
<source>
<context value="src"/>
<element value="patient"/>
<variable value="patient"/>
</source>
<rule>
<name value="name"/>
<source>
<context value="patient"/>
<element value="name"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="gender"/>
<source>
<context value="patient"/>
<element value="administrativeGenderCode"/>
<variable value="gender"/>
</source>
<rule>
<name value="gender"/>
<source>
<context value="gender"/>
<element value="code"/>
<variable value="v"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="gender"/>
<transform value="translate"/>
<parameter>
<valueId value="v"/>
</parameter>
<parameter>
<valueString value="#cm-v3-administrative-gender"/>
</parameter>
<parameter>
<valueString value="code"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="birthDate"/>
<source>
<context value="patient"/>
<element value="birthTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="birthDate"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="deceasedBL"/>
<source>
<context value="patient"/>
<element value="deceasedInd"/>
<variable value="indicator"/>
<condition value="patient.deceasedTime.empty()"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="deceased"/>
<variable value="bool"/>
<transform value="create"/>
<parameter>
<valueString value="boolean"/>
</parameter>
</target>
<dependent>
<name value="boolean"/>
<variable value="indicator"/>
<variable value="bool"/>
</dependent>
</rule>
<rule>
<name value="deceasedTime"/>
<source>
<context value="patient"/>
<element value="deceasedTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="deceased"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="maritalStatus"/>
<source>
<context value="patient"/>
<element value="maritalStatusCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="maritalStatus"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="language"/>
<source>
<context value="patient"/>
<element value="languageCommunication"/>
<variable value="language"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="communication"/>
<variable value="communication"/>
</target>
<rule>
<name value="communication"/>
<source>
<context value="language"/>
<element value="languageCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="communication"/>
<contextType value="variable"/>
<element value="language"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="organization"/>
<source>
<context value="src"/>
<element value="providerOrganization"/>
<variable value="org"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="organization"/>
<transform value="create"/>
<parameter>
<valueString value="Organization"/>
</parameter>
</target>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid3"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid3"/>
</parameter>
</target>
<rule>
<name value="reference"/>
<source>
<context value="org"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="managingOrganization"/>
<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="'urn:uuid:' + %organization.id"/>
</parameter>
</target>
</rule>
<rule>
<name value="id"/>
<source>
<context value="org"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="name"/>
<source>
<context value="org"/>
<element value="name"/>
<variable value="v"/>
</source>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="name"/>
<transform value="evaluate"/>
<parameter>
<valueString value="v.other"/>
</parameter>
</target>
</rule>
<rule>
<name value="telecom"/>
<source>
<context value="org"/>
<element value="telecom"/>
<variable value="vvv"/>
</source>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="addr"/>
<source>
<context value="org"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
</group>
<group>
<name value="ClinicalDocumentEncounter"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="EncompassingEncounter"/>
<mode value="source"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<input>
<name value="tgt"/>
<type value="Encounter"/>
<mode value="target"/>
</input>
<rule>
<name value="id"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</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="type"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="effectiveTime"/>
<source>
<context value="src"/>
<element value="effectiveTime"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="period"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="hospitalization"/>
<source>
<context value="src"/>
<condition
value="admissionReferralSourceCode.exists() or dischargeDispositionCode.exists()"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="hospitalization"/>
<variable value="hosp"/>
</target>
<rule>
<name value="adminReferral"/>
<source>
<context value="src"/>
<element value="admissionReferralSourceCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="hosp"/>
<contextType value="variable"/>
<element value="admitSource"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="discDisposition"/>
<source>
<context value="src"/>
<element value="dischargeDispositionCode"/>
<variable value="vvv"/>
</source>
<target>
<context value="hosp"/>
<contextType value="variable"/>
<element value="dischargeDisposition"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
</rule>
<rule>
<name value="participant"/>
<source>
<context value="src"/>
<element value="encounterParticipant"/>
<variable value="srcPart"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="participant"/>
<variable value="tgtPart"/>
</target>
<rule>
<name value="typeCode"/>
<source>
<context value="srcPart"/>
<element value="typeCode"/>
<variable value="code"/>
</source>
<target>
<context value="tgtPart"/>
<contextType value="variable"/>
<element value="type"/>
<transform value="cc"/>
<parameter>
<valueString
value="http://terminology.hl7.org/CodeSystem/v3-ParticipationType"/>
</parameter>
<parameter>
<valueId value="code"/>
</parameter>
</target>
</rule>
<rule>
<name value="time"/>
<source>
<context value="srcPart"/>
<element value="time"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgtPart"/>
<contextType value="variable"/>
<element value="period"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="entity"/>
<source>
<context value="srcPart"/>
<element value="assignedEntity"/>
<variable value="entity"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="practitioner"/>
<transform value="create"/>
<parameter>
<valueString value="Practitioner"/>
</parameter>
</target>
<target>
<context value="practitioner"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid2"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</parameter>
</target>
<rule>
<name value="entry"/>
<source>
<context value="entity"/>
</source>
<target>
<context value="tgtPart"/>
<contextType value="variable"/>
<element value="individual"/>
<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="'urn:uuid:' + %practitioner.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentEntityPractitioner"/>
<variable value="entity"/>
<variable value="practitioner"/>
</dependent>
</rule>
</rule>
</rule>
<rule>
<name value="location"/>
<source>
<context value="src"/>
<element value="location"/>
<variable value="srcLocation"/>
</source>
<rule>
<name value="facility"/>
<source>
<context value="srcLocation"/>
<element value="healthCareFacility"/>
<variable value="facility"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="location"/>
<transform value="create"/>
<parameter>
<valueString value="Location"/>
</parameter>
</target>
<target>
<context value="location"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid2"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid2"/>
</parameter>
</target>
<rule>
<name value="facLocation"/>
<source>
<context value="facility"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="location"/>
<variable value="tgtLocation"/>
</target>
<target>
<context value="tgtLocation"/>
<contextType value="variable"/>
<element value="location"/>
<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="'urn:uuid:' + %location.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentLocation"/>
<variable value="facility"/>
<variable value="bundle"/>
<variable value="location"/>
</dependent>
</rule>
</rule>
</rule>
</group>
<group>
<name value="ClinicalDocumentLocation"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="HealthCareFacility"/>
<mode value="source"/>
</input>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<input>
<name value="tgt"/>
<type value="Location"/>
<mode value="target"/>
</input>
<rule>
<name value="id"/>
<source>
<context value="src"/>
<element value="id"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</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="type"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
</rule>
<rule>
<name value="location"/>
<source>
<context value="src"/>
<element value="location"/>
<variable value="location"/>
</source>
<rule>
<name value="addr"/>
<source>
<context value="location"/>
<element value="addr"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="address"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<documentation
value="place names are usually stored with no parts location.name as srcName -> tgt.name = cast(srcName, 'string');"/>
</rule>
<rule>
<name value="org"/>
<source>
<context value="location"/>
<element value="serviceProviderOrganization"/>
<variable value="srcOrg"/>
</source>
<target>
<context value="bundle"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="e"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="organization"/>
<transform value="create"/>
<parameter>
<valueString value="Organization"/>
</parameter>
</target>
<target>
<context value="organization"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="uuid3"/>
<transform value="uuid"/>
</target>
<target>
<context value="e"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="append"/>
<parameter>
<valueString value="urn:uuid:"/>
</parameter>
<parameter>
<valueId value="uuid3"/>
</parameter>
</target>
<rule>
<name value="organization"/>
<source>
<context value="srcOrg"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="managingOrganization"/>
<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="'urn:uuid:' + %organization.id"/>
</parameter>
</target>
<dependent>
<name value="ClinicalDocumentOrganization"/>
<variable value="srcOrg"/>
<variable value="organization"/>
</dependent>
</rule>
</rule>
</rule>
</group>
<group>
<name value="ChExtEprTime"/>
<typeMode value="none"/>
<documentation
value="source dataEnterer: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.2.7 source author: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.840.1.113883.10.12.102 target: https://build.fhir.org/ig/hl7ch/ch-core//StructureDefinition-ch-ext-epr-time.html"/>
<input>
<name value="src"/>
<type value="TSDateTime"/>
<mode value="source"/>
</input>
<input>
<name value="ext"/>
<type value="Extension"/>
<mode value="target"/>
</input>
<rule>
<name value="url"/>
<source>
<context value="src"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time"/>
</parameter>
</target>
</rule>
<rule>
<name value="value"/>
<source>
<context value="src"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="value"/>
<transform value="create"/>
<parameter>
<valueString value="dateTime"/>
</parameter>
</target>
<dependent>
<name value="TSDateTime"/>
<variable value="src"/>
<variable value="value"/>
</dependent>
</rule>
</group>
<group>
<name value="ChExtEprSectionId"/>
<typeMode value="none"/>
<documentation
value="https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.45 target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-sectionid.html"/>
<input>
<name value="src"/>
<type value="II"/>
<mode value="source"/>
</input>
<input>
<name value="ext"/>
<type value="Extension"/>
<mode value="target"/>
</input>
<rule>
<name value="url"/>
<source>
<context value="src"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-sectionid"/>
</parameter>
</target>
</rule>
<rule>
<name value="value"/>
<source>
<context value="src"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="value"/>
<transform value="create"/>
<parameter>
<valueString value="Identifier"/>
</parameter>
</target>
<dependent>
<name value="II"/>
<variable value="src"/>
<variable value="value"/>
</dependent>
</rule>
</group>
<group>
<name value="NarrativeLink"/>
<typeMode value="none"/>
<documentation
value="_________________________ Template Type not specified ___________________"/>
<input>
<name value="url"/>
<mode value="source"/>
</input>
<input>
<name value="ext"/>
<type value="Extension"/>
<mode value="target"/>
</input>
<rule>
<name value="url"/>
<source>
<context value="url"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="url"/>
<transform value="copy"/>
<parameter>
<valueString
value="http://hl7.org/fhir/StructureDefinition/narrativeLink"/>
</parameter>
</target>
</rule>
<rule>
<name value="value"/>
<source>
<context value="url"/>
</source>
<target>
<context value="ext"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="value"/>
<transform value="create"/>
<parameter>
<valueString value="url"/>
</parameter>
</target>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueId value="url"/>
</parameter>
</target>
</rule>
</group>
</StructureMap>