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="BundleToCdaCh"/>
<meta>
<versionId value="3"/>
<lastUpdated value="2021-11-04T13:44:54.811+01:00"/>
</meta>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh" = "BundleToCdaCh"
// CDA-CH document, 2.16.756.5.30.1.1.10.1.14
// 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License
// CDA-CH: https://art-decor.org/art-decor/decor-templates--hl7chcda-
// FHIR CH-Core: http://fhir.ch/ig/ch-core/index.html
uses "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target
uses "http://hl7.org/fhir/cda/StructureDefinition/Author" alias Author as target
uses "http://hl7.org/fhir/cda/StructureDefinition/RecordTarget" alias RecordTarget as target
uses "http://hl7.org/fhir/cda/StructureDefinition/DataEnterer" alias DataEnterer as target
uses "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity" alias AssignedEntity as target
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as source
uses "http://hl7.org/fhir/StructureDefinition/Person" alias Person as source
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes"
imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda"
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14
group BundleToCdaCh(source bundle : Bundle, target cda : ClinicalDocument) {
bundle -> cda.recordTarget as recordTarget, cda.author as author then BundleToClinicalDocumentCh(bundle, recordTarget, author, cda) "bundle";
}
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14
group BundleToClinicalDocumentCh(source bundle : Bundle, target recordTarget : RecordTarget, target author : Author, target cda : ClinicalDocument) extends BundleToClinicalDocument {
bundle -> author.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.9.23' "tempalteId";
bundle -> recordTarget.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.2.1' "tempalteId";
bundle -> cda.custodian as custodian, custodian.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.2.3' "tempalteId";
bundle -> cda.realmCode as realmCode then {
bundle -> realmCode.code = 'CHE' "CHE";
} "realmCode";
bundle -> cda.templateId as templateId then {
bundle -> templateId.root = '2.16.756.5.30.1.1.10.1.9' "root";
} "0-structuredBody";
bundle -> cda.templateId as templateId then {
bundle -> templateId.root = '2.16.840.1.113883.10.12.2' "root";
} "componentAsStructuredBody";
bundle -> cda.templateId as templateId then {
bundle -> templateId.root = '2.16.840.1.113883.10.12.1' "root";
} "HL7CdaR2-2005";
bundle.entry as entry then {
entry.resource as resource where $this.ofType(FHIR.Composition) then CompositionClinicalDocumentCH(bundle, resource, cda);
};
}
// _________________________ Section Level Templates _________________________
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.2
group SectionCdaRemarksCoded(source bundle : Bundle, source section : Section, target cdasection : CdaSection) extends SectionCdaSection {
section -> cdasection.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.3.2' "templateId";
section -> cdasection.entry as entry, entry.act as act, act.classCode = 'ACT', act.moodCode = 'EVN' then {
section -> act.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.2' "templateId";
section -> act.templateId as templateId, templateId.root = '2.16.840.1.113883.10.20.1.40' "templateId";
section -> act.templateId as templateId, templateId.root = '1.3.6.1.4.1.19376.1.5.3.1.4.2' "templateId";
section -> act.code as code, code.code = '48767-8', code.codeSystem = '2.16.840.1.113883.6.1', code.codeSystemName = 'LOINC', code.displayName = 'Annotation comment' "code";
// <span id="co1">
section.text as text then {
text.div as div -> act.text as text, text.reference as reference, reference.value = ('#' + %div.substring(%div.indexOf('id') + %div.substring(%div.indexOf('id')).indexOf('\"') + 1, %div.substring(%div.indexOf('id') + %div.substring(%div.indexOf('id')).indexOf('\"') + 1).indexOf('\"'))) "id";
};
section -> act.statusCode as statusCode, statusCode.code = 'completed' "completed";
} "entry";
}
group SectionCdaOriginalRepresentationObservationMedia(source binary : Binary, source section : Section, target cdasection : CdaSection) {
section -> cdasection.text = '<div xmlns=\"http://www.w3.org/1999/xhtml\">Representation of the original view:<img src=\"pdf1\"/></div>' "Section";
section -> cdasection.entry as entry then {
binary -> entry.typeCode = 'DRIV' "driv";
binary -> entry.observationMedia as observationMedia, observationMedia.classCode = 'OBS', observationMedia.moodCode = 'EVN' then {
binary -> observationMedia.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.4.83' "templateId";
binary -> observationMedia.ID = 'pdf1' "reference";
binary -> observationMedia.value as value, value.mediaType = '2.16.756.5.30.1.1.10.4.83', value.representation = 'B64' then {
binary.contentType as contentType -> value.mediaType = contentType;
binary.data as data -> value.data = data;
binary.language as lang -> observationMedia.languageCode as languageCode, languageCode.code = lang "lang";
binary where $this.language.exists() = false -> observationMedia.languageCode as languageCode, languageCode.nullFlavor = 'UNK' "langUnknown";
} "value";
} "observationMedia";
} "entry";
}
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.4.83
group SectionCdaOriginalRepresentation(source bundle : Bundle, source section : Section, target cdasection : CdaSection) extends SectionCdaSection {
section -> cdasection.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.3.45' "templateId";
section where title.exists().not() then {
section where (%bundle.entry[0].resource.language.startsWith('de')) -> cdasection.title as title, title.data = 'Original Darstellung' "titleDE";
section where (%bundle.entry[0].resource.language.startsWith('fr')) -> cdasection.title as title, title.data = 'Représentation originale' "titleFR";
section where (%bundle.entry[0].resource.language.startsWith('it')) -> cdasection.title as title, title.data = 'Rappresentazione originale' "titleIT";
section where (%bundle.entry[0].resource.language.startsWith('en')) -> cdasection.title as title, title.data = 'Original representation' "titleEN";
} "defaulttitles";
bundle.entry as entry then {
entry.fullUrl where ($this in %section.entry.reference) and $this.startsWith('urn:uuid') then {
entry.resource as binary then SectionCdaOriginalRepresentationObservationMedia(binary, section, cdasection) "patient";
} "fullUrlAsUuid";
entry.resource as binary where ('Binary' + '/' + $this.id) in %section.entry.reference then SectionCdaOriginalRepresentationObservationMedia(binary, section, cdasection) "patient";
} "patient";
}
// _________________________ Entry Level Templates ________________________
// _________________________ Header Level Templates _________________________
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.12
group PersonAssignedEntityWithId(source practitioner : Practitioner, target assignedEntity : AssignedEntity) {
practitioner.identifier as identifier -> assignedEntity.id as id then IdentifierII(identifier, id);
practitioner.address as address -> assignedEntity.addr as addr then AddressAD(address, addr);
practitioner.name as humanname -> assignedEntity.assignedPerson as assignedPerson, assignedPerson.name as en then HumanNameEN(humanname, en);
}
// source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.12
group DataEnterer(source bundle : Bundle, source practitionerRole : PractitionerRole, target assignedEntity : AssignedEntity) {
practitionerRole.practitioner as practitioner then {
practitioner.reference as reference then {
bundle.entry as entry then {
entry.fullUrl where ($this in %reference.value) and $this.startsWith('urn:uuid') then {
entry.resource : Practitioner as practitioner then PersonAssignedEntityWithId(practitioner, assignedEntity) "AssignedEntityWithId";
} "uuid";
entry.resource : Practitioner as practitioner where ('Practitioner' + '/' + $this.id) in %reference.value then PersonAssignedEntityWithId(practitioner, assignedEntity) "AssignedEntityWithId";
} "practitioner";
} "valueReference";
} "extensionPerson";
practitionerRole.organization as organization -> assignedEntity.representedOrganization as representedOrganization then {
organization.reference as reference then {
bundle.entry as entry then {
entry.fullUrl where ($this in %reference.value) and $this.startsWith('urn:uuid') then {
entry.resource : Organization as organization then Organization2CdaOrganization(organization, representedOrganization) "representedOrganization";
} "uuid";
entry.resource : Organization as organization where ('Organization' + '/' + $this.id) in %reference.value then Organization2CdaOrganization(organization, representedOrganization) "representedOrganization";
} "practitioner";
} "valueReference";
} "extensionPerson";
}
// _________________________ Template Type not specified ___________________
// source: http://hl7.org/fhir/R4/person.html
// target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36
group CompositionClinicalDocumentCH(source bundle : Bundle, source composition : Composition, target cda : ClinicalDocument) {
composition.type as type then {
type.coding as coding where $this.system = 'http://snomed.info/sct' -> cda.code as code, code.translation as translation then CodingCE(coding, translation) "translation";
};
composition.confidentiality as conf where $this.extension.where(url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-confidentialitycode').exists() -> cda.confidentialityCode as cdaconf then {
conf.extension as extension then {
extension.valueCodeableConcept as valueCodeableConcept then {
valueCodeableConcept.coding as coding then CodingCE(coding, cdaconf);
};
};
} "confidentialityCode";
// If setId exists as Composition.ch-ext-epr-setid, then map to ClinicalDocument.setId
composition.identifier as identifier where $this.system = 'urn:ietf:rfc:3986' -> cda.setId as setId then IdentifierII(identifier, setId) "IdentifierII";
// If setId doesn't exist, used bundle.identifer
composition where $this.identifier.where(system = 'urn:ietf:rfc:3986').exists() = false then {
bundle.identifier as identifier -> cda.setId as id then IdentifierII(identifier, id) "setId";
} "setIdCreated";
// If versionNumber exists as Composition.ch-ext-epr-versionnumber, then map to ClinicalDocument.versionNumber
composition.extension as ext where $this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-versionnumber' -> cda.versionNumber as versionNumber then {
ext.valueUnsignedInt as valueUnsignedInt then IntegerINT(valueUnsignedInt, versionNumber) "IntegerInt";
} "versionNumberMapped";
// If versionNumber doesn't exist, create ClinicalDocument.versionNumber = 1
composition as composition where $this.extension.where(url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-versionnumber').exists() = false -> cda.versionNumber as versionNumber then {
composition -> versionNumber.value = '1' "versionNumber";
} "versionNumberCreated";
composition.extension as extension where $this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient' -> cda.informationRecipient as informationRecipient then {
extension -> informationRecipient.typeCode = 'PRCP' "PRCP";
extension -> informationRecipient.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.2.4' "templateId";
extension.valueReference as valueReference then {
bundle.entry as entry then {
entry.fullUrl where ($this in %valueReference.reference) and $this.startsWith('urn:uuid') then {
entry.resource : Patient as patient -> informationRecipient.intendedRecipient as intendedRecipient share intendedRecipient then {
patient.address as address -> intendedRecipient.addr as addr then AddressAD(address, addr);
patient.name as humanname -> intendedRecipient.informationRecipient as informationRecipient2, informationRecipient2.name as en then HumanNameEN(humanname, en);
} "fullUrlPatient";
entry.resource : Organization as organization -> informationRecipient.intendedRecipient as intendedRecipient share intendedRecipient, intendedRecipient.receivedOrganization as receivedOrganization then Organization2CdaOrganization(organization, receivedOrganization) "organization";
} "uuid";
entry.resource : Patient as patient where (($this.id = %valueReference.reference.substring(8)) or ($this.id = %valueReference.reference.substring(9))) -> informationRecipient.intendedRecipient as intendedRecipient share intendedRecipient then {
patient.address as address -> intendedRecipient.addr as addr then AddressAD(address, addr);
patient.name as humanname -> intendedRecipient.informationRecipient as informationRecipient2, informationRecipient2.name as en then HumanNameEN(humanname, en);
} "intendedRecipient";
entry.resource : Organization as organization where (($this.id = %valueReference.reference.substring(13)) or ($this.id = %valueReference.reference.substring(9))) -> informationRecipient.intendedRecipient as intendedRecipient share intendedRecipient, intendedRecipient.receivedOrganization as receivedOrganization then Organization2CdaOrganization(organization, receivedOrganization) "organization";
};
};
} "informationRecipient";
composition.extension as extension where $this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer' -> cda.dataEnterer as dataEnterer then {
extension -> dataEnterer.templateId as templateId, templateId.root = '2.16.756.5.30.1.1.10.2.7' "templateId";
extension.extension as extensionTime where $this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time' then {
extensionTime.valueDateTime as valueDateTime -> dataEnterer.time as time then DateTimeTS(valueDateTime, time) "DateTime";
} "extensionTime";
extension.extension as extensionPerson where $this.url = 'enterer' then {
extensionPerson.valueReference as valueReference then {
bundle.entry as entry then {
entry.fullUrl where ($this in %valueReference.reference) and $this.startsWith('urn:uuid') then {
entry.resource : PractitionerRole as practitionerRole -> dataEnterer.assignedEntity as assignedEntity then DataEnterer(bundle, practitionerRole, assignedEntity) "AssignedEntityWithId";
} "uuid";
entry.resource : PractitionerRole as practitionerRole where ('PractitionerRole' + '/' + $this.id) in %valueReference.reference -> dataEnterer.assignedEntity as assignedEntity then DataEnterer(bundle, practitionerRole, assignedEntity) "AssignedEntityWithId";
} "practitioner";
};
} "extensionPerson";
} "dataEnterer";
}
</pre>
</div>
</text>
<url value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCdaCh"/>
<version value="0.3.0"/>
<name value="BundleToCdaCh"/>
<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-CH document, 2.16.756.5.30.1.1.10.1.14
2020-01-16 Oliver Egger, copyright ahdis ag, Apache License
CDA-CH: https://art-decor.org/art-decor/decor-templates--hl7chcda-
FHIR CH-Core: http://fhir.ch/ig/ch-core/index.html
"/>
<copyright value="CC-BY-SA-4.0"/>
<structure>
<url value="http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument"/>
<mode value="target"/>
<alias value="ClinicalDocument"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/cda/StructureDefinition/Author"/>
<mode value="target"/>
<alias value="Author"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/cda/StructureDefinition/RecordTarget"/>
<mode value="target"/>
<alias value="RecordTarget"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/cda/StructureDefinition/DataEnterer"/>
<mode value="target"/>
<alias value="DataEnterer"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity"/>
<mode value="target"/>
<alias value="AssignedEntity"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
<mode value="source"/>
<alias value="Bundle"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Composition"/>
<mode value="source"/>
<alias value="Composition"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Person"/>
<mode value="source"/>
<alias value="Person"/>
</structure>
<import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/FhirToCdaTypes"/>
<import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/BundleToCda"/>
<group>
<name value="BundleToCdaCh"/>
<typeMode value="none"/>
<documentation
value="source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="cda"/>
<type value="ClinicalDocument"/>
<mode value="target"/>
</input>
<rule>
<name value="bundle"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="recordTarget"/>
<variable value="recordTarget"/>
</target>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="author"/>
<variable value="author"/>
</target>
<dependent>
<name value="BundleToClinicalDocumentCh"/>
<variable value="bundle"/>
<variable value="recordTarget"/>
<variable value="author"/>
<variable value="cda"/>
</dependent>
</rule>
</group>
<group>
<name value="BundleToClinicalDocumentCh"/>
<extends value="BundleToClinicalDocument"/>
<typeMode value="none"/>
<documentation
value="source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-document.html
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="recordTarget"/>
<type value="RecordTarget"/>
<mode value="target"/>
</input>
<input>
<name value="author"/>
<type value="Author"/>
<mode value="target"/>
</input>
<input>
<name value="cda"/>
<type value="ClinicalDocument"/>
<mode value="target"/>
</input>
<rule>
<name value="tempalteId"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="author"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.9.23"/>
</parameter>
</target>
</rule>
<rule>
<name value="tempalteId"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="recordTarget"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.2.1"/>
</parameter>
</target>
</rule>
<rule>
<name value="tempalteId"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="custodian"/>
<variable value="custodian"/>
</target>
<target>
<context value="custodian"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.2.3"/>
</parameter>
</target>
</rule>
<rule>
<name value="realmCode"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="realmCode"/>
<variable value="realmCode"/>
</target>
<rule>
<name value="CHE"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="realmCode"/>
<contextType value="variable"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="CHE"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="CDA-CHv2.0-structuredBody"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<rule>
<name value="root"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.1.9"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name
value="HL7CdaR2-2005-containsClinicalDocument.componentAsStructuredBody"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<rule>
<name value="root"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.840.1.113883.10.12.2"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="HL7CdaR2-2005"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<rule>
<name value="root"/>
<source>
<context value="bundle"/>
</source>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.840.1.113883.10.12.1"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="entry"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="resource"/>
<source>
<context value="entry"/>
<element value="resource"/>
<variable value="resource"/>
<condition value="$this.ofType(FHIR.Composition)"/>
</source>
<dependent>
<name value="CompositionClinicalDocumentCH"/>
<variable value="bundle"/>
<variable value="resource"/>
<variable value="cda"/>
</dependent>
</rule>
</rule>
</group>
<group>
<name value="SectionCdaRemarksCoded"/>
<extends value="SectionCdaSection"/>
<typeMode value="none"/>
<documentation
value="_________________________ Section Level Templates _________________________
source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.2"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="section"/>
<type value="Section"/>
<mode value="source"/>
</input>
<input>
<name value="cdasection"/>
<type value="CdaSection"/>
<mode value="target"/>
</input>
<rule>
<name value="templateId"/>
<source>
<context value="section"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.3.2"/>
</parameter>
</target>
</rule>
<rule>
<name value="entry"/>
<source>
<context value="section"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="act"/>
<variable value="act"/>
</target>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="classCode"/>
<transform value="copy"/>
<parameter>
<valueString value="ACT"/>
</parameter>
</target>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="moodCode"/>
<transform value="copy"/>
<parameter>
<valueString value="EVN"/>
</parameter>
</target>
<rule>
<name value="templateId"/>
<source>
<context value="section"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.4.2"/>
</parameter>
</target>
</rule>
<rule>
<name value="templateId"/>
<source>
<context value="section"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.840.1.113883.10.20.1.40"/>
</parameter>
</target>
</rule>
<rule>
<name value="templateId"/>
<source>
<context value="section"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="1.3.6.1.4.1.19376.1.5.3.1.4.2"/>
</parameter>
</target>
</rule>
<rule>
<name value="code"/>
<source>
<context value="section"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="code"/>
</target>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="48767-8"/>
</parameter>
</target>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="codeSystem"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.840.1.113883.6.1"/>
</parameter>
</target>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="codeSystemName"/>
<transform value="copy"/>
<parameter>
<valueString value="LOINC"/>
</parameter>
</target>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="displayName"/>
<transform value="copy"/>
<parameter>
<valueString value="Annotation comment"/>
</parameter>
</target>
</rule>
<rule>
<name value="section.text"/>
<source>
<context value="section"/>
<element value="text"/>
<variable value="text"/>
</source>
<rule>
<name value="id"/>
<source>
<context value="text"/>
<element value="div"/>
<variable value="div"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="text"/>
<variable value="text"/>
</target>
<target>
<context value="text"/>
<contextType value="variable"/>
<element value="reference"/>
<variable value="reference"/>
</target>
<target>
<context value="reference"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString
value="'#' + %div.substring(%div.indexOf('id') + %div.substring(%div.indexOf('id')).indexOf('\"') + 1, %div.substring(%div.indexOf('id') + %div.substring(%div.indexOf('id')).indexOf('\"') + 1).indexOf('\"'))"/>
</parameter>
</target>
</rule>
<documentation value="<span id="co1">"/>
</rule>
<rule>
<name value="completed"/>
<source>
<context value="section"/>
</source>
<target>
<context value="act"/>
<contextType value="variable"/>
<element value="statusCode"/>
<variable value="statusCode"/>
</target>
<target>
<context value="statusCode"/>
<contextType value="variable"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueString value="completed"/>
</parameter>
</target>
</rule>
</rule>
</group>
<group>
<name value="SectionCdaOriginalRepresentationObservationMedia"/>
<typeMode value="none"/>
<input>
<name value="binary"/>
<type value="Binary"/>
<mode value="source"/>
</input>
<input>
<name value="section"/>
<type value="Section"/>
<mode value="source"/>
</input>
<input>
<name value="cdasection"/>
<type value="CdaSection"/>
<mode value="target"/>
</input>
<rule>
<name value="Section"/>
<source>
<context value="section"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString
value="<div xmlns="http://www.w3.org/1999/xhtml">Representation of the original view:<img src="pdf1"/></div>"/>
</parameter>
</target>
</rule>
<rule>
<name value="entry"/>
<source>
<context value="section"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<rule>
<name value="driv"/>
<source>
<context value="binary"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="typeCode"/>
<transform value="copy"/>
<parameter>
<valueString value="DRIV"/>
</parameter>
</target>
</rule>
<rule>
<name value="observationMedia"/>
<source>
<context value="binary"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="observationMedia"/>
<variable value="observationMedia"/>
</target>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="classCode"/>
<transform value="copy"/>
<parameter>
<valueString value="OBS"/>
</parameter>
</target>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="moodCode"/>
<transform value="copy"/>
<parameter>
<valueString value="EVN"/>
</parameter>
</target>
<rule>
<name value="templateId"/>
<source>
<context value="binary"/>
</source>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.4.83"/>
</parameter>
</target>
</rule>
<rule>
<name value="reference"/>
<source>
<context value="binary"/>
</source>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="ID"/>
<transform value="copy"/>
<parameter>
<valueString value="pdf1"/>
</parameter>
</target>
</rule>
<rule>
<name value="value"/>
<source>
<context value="binary"/>
</source>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="value"/>
</target>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="mediaType"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.4.83"/>
</parameter>
</target>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="representation"/>
<transform value="copy"/>
<parameter>
<valueString value="B64"/>
</parameter>
</target>
<rule>
<name value="contentType"/>
<source>
<context value="binary"/>
<element value="contentType"/>
<variable value="contentType"/>
</source>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="mediaType"/>
<transform value="copy"/>
<parameter>
<valueId value="contentType"/>
</parameter>
</target>
</rule>
<rule>
<name value="data"/>
<source>
<context value="binary"/>
<element value="data"/>
<variable value="data"/>
</source>
<target>
<context value="value"/>
<contextType value="variable"/>
<element value="data"/>
<transform value="copy"/>
<parameter>
<valueId value="data"/>
</parameter>
</target>
</rule>
<rule>
<name value="lang"/>
<source>
<context value="binary"/>
<element value="language"/>
<variable value="lang"/>
</source>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="languageCode"/>
<variable value="languageCode"/>
</target>
<target>
<context value="languageCode"/>
<contextType value="variable"/>
<element value="code"/>
<transform value="copy"/>
<parameter>
<valueId value="lang"/>
</parameter>
</target>
</rule>
<rule>
<name value="langUnknown"/>
<source>
<context value="binary"/>
<condition value="$this.language.exists() = false"/>
</source>
<target>
<context value="observationMedia"/>
<contextType value="variable"/>
<element value="languageCode"/>
<variable value="languageCode"/>
</target>
<target>
<context value="languageCode"/>
<contextType value="variable"/>
<element value="nullFlavor"/>
<transform value="copy"/>
<parameter>
<valueString value="UNK"/>
</parameter>
</target>
</rule>
</rule>
</rule>
</rule>
</group>
<group>
<name value="SectionCdaOriginalRepresentation"/>
<extends value="SectionCdaSection"/>
<typeMode value="none"/>
<documentation
value="source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-definitions.html#Composition.section
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.1.14
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.4.83"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="section"/>
<type value="Section"/>
<mode value="source"/>
</input>
<input>
<name value="cdasection"/>
<type value="CdaSection"/>
<mode value="target"/>
</input>
<rule>
<name value="templateId"/>
<source>
<context value="section"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.3.45"/>
</parameter>
</target>
</rule>
<rule>
<name value="defaulttitles"/>
<source>
<context value="section"/>
<condition value="title.exists().not()"/>
</source>
<rule>
<name value="titleDE"/>
<source>
<context value="section"/>
<condition
value="(%bundle.entry[0].resource.language.startsWith('de'))"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="title"/>
<variable value="title"/>
</target>
<target>
<context value="title"/>
<contextType value="variable"/>
<element value="data"/>
<transform value="copy"/>
<parameter>
<valueString value="Original Darstellung"/>
</parameter>
</target>
</rule>
<rule>
<name value="titleFR"/>
<source>
<context value="section"/>
<condition
value="(%bundle.entry[0].resource.language.startsWith('fr'))"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="title"/>
<variable value="title"/>
</target>
<target>
<context value="title"/>
<contextType value="variable"/>
<element value="data"/>
<transform value="copy"/>
<parameter>
<valueString value="Représentation originale"/>
</parameter>
</target>
</rule>
<rule>
<name value="titleIT"/>
<source>
<context value="section"/>
<condition
value="(%bundle.entry[0].resource.language.startsWith('it'))"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="title"/>
<variable value="title"/>
</target>
<target>
<context value="title"/>
<contextType value="variable"/>
<element value="data"/>
<transform value="copy"/>
<parameter>
<valueString value="Rappresentazione originale"/>
</parameter>
</target>
</rule>
<rule>
<name value="titleEN"/>
<source>
<context value="section"/>
<condition
value="(%bundle.entry[0].resource.language.startsWith('en'))"/>
</source>
<target>
<context value="cdasection"/>
<contextType value="variable"/>
<element value="title"/>
<variable value="title"/>
</target>
<target>
<context value="title"/>
<contextType value="variable"/>
<element value="data"/>
<transform value="copy"/>
<parameter>
<valueString value="Original representation"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="patient"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="fullUrlAsUuid"/>
<source>
<context value="entry"/>
<element value="fullUrl"/>
<condition
value="($this in %section.entry.reference) and $this.startsWith('urn:uuid')"/>
</source>
<rule>
<name value="patient"/>
<source>
<context value="entry"/>
<element value="resource"/>
<variable value="binary"/>
</source>
<dependent>
<name value="SectionCdaOriginalRepresentationObservationMedia"/>
<variable value="binary"/>
<variable value="section"/>
<variable value="cdasection"/>
</dependent>
</rule>
</rule>
<rule>
<name value="patient"/>
<source>
<context value="entry"/>
<element value="resource"/>
<variable value="binary"/>
<condition
value="('Binary' + '/' + $this.id) in %section.entry.reference"/>
</source>
<dependent>
<name value="SectionCdaOriginalRepresentationObservationMedia"/>
<variable value="binary"/>
<variable value="section"/>
<variable value="cdasection"/>
</dependent>
</rule>
</rule>
</group>
<group>
<name value="PersonAssignedEntityWithId"/>
<typeMode value="none"/>
<documentation
value="_________________________ Entry Level Templates ________________________
_________________________ Header Level Templates _________________________
source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.12"/>
<input>
<name value="practitioner"/>
<type value="Practitioner"/>
<mode value="source"/>
</input>
<input>
<name value="assignedEntity"/>
<type value="AssignedEntity"/>
<mode value="target"/>
</input>
<rule>
<name value="identifier"/>
<source>
<context value="practitioner"/>
<element value="identifier"/>
<variable value="identifier"/>
</source>
<target>
<context value="assignedEntity"/>
<contextType value="variable"/>
<element value="id"/>
<variable value="id"/>
</target>
<dependent>
<name value="IdentifierII"/>
<variable value="identifier"/>
<variable value="id"/>
</dependent>
</rule>
<rule>
<name value="address"/>
<source>
<context value="practitioner"/>
<element value="address"/>
<variable value="address"/>
</source>
<target>
<context value="assignedEntity"/>
<contextType value="variable"/>
<element value="addr"/>
<variable value="addr"/>
</target>
<dependent>
<name value="AddressAD"/>
<variable value="address"/>
<variable value="addr"/>
</dependent>
</rule>
<rule>
<name value="name"/>
<source>
<context value="practitioner"/>
<element value="name"/>
<variable value="humanname"/>
</source>
<target>
<context value="assignedEntity"/>
<contextType value="variable"/>
<element value="assignedPerson"/>
<variable value="assignedPerson"/>
</target>
<target>
<context value="assignedPerson"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="en"/>
</target>
<dependent>
<name value="HumanNameEN"/>
<variable value="humanname"/>
<variable value="en"/>
</dependent>
</rule>
</group>
<group>
<name value="DataEnterer"/>
<typeMode value="none"/>
<documentation
value="source: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-core-composition-epr.html
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.12"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="practitionerRole"/>
<type value="PractitionerRole"/>
<mode value="source"/>
</input>
<input>
<name value="assignedEntity"/>
<type value="AssignedEntity"/>
<mode value="target"/>
</input>
<rule>
<name value="extensionPerson"/>
<source>
<context value="practitionerRole"/>
<element value="practitioner"/>
<variable value="practitioner"/>
</source>
<rule>
<name value="valueReference"/>
<source>
<context value="practitioner"/>
<element value="reference"/>
<variable value="reference"/>
</source>
<rule>
<name value="practitioner"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="uuid"/>
<source>
<context value="entry"/>
<element value="fullUrl"/>
<condition
value="($this in %reference.value) and $this.startsWith('urn:uuid')"/>
</source>
<rule>
<name value="AssignedEntityWithId"/>
<source>
<context value="entry"/>
<type value="Practitioner"/>
<element value="resource"/>
<variable value="practitioner"/>
</source>
<dependent>
<name value="PersonAssignedEntityWithId"/>
<variable value="practitioner"/>
<variable value="assignedEntity"/>
</dependent>
</rule>
</rule>
<rule>
<name value="AssignedEntityWithId"/>
<source>
<context value="entry"/>
<type value="Practitioner"/>
<element value="resource"/>
<variable value="practitioner"/>
<condition
value="('Practitioner' + '/' + $this.id) in %reference.value"/>
</source>
<dependent>
<name value="PersonAssignedEntityWithId"/>
<variable value="practitioner"/>
<variable value="assignedEntity"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
<rule>
<name value="extensionPerson"/>
<source>
<context value="practitionerRole"/>
<element value="organization"/>
<variable value="organization"/>
</source>
<target>
<context value="assignedEntity"/>
<contextType value="variable"/>
<element value="representedOrganization"/>
<variable value="representedOrganization"/>
</target>
<rule>
<name value="valueReference"/>
<source>
<context value="organization"/>
<element value="reference"/>
<variable value="reference"/>
</source>
<rule>
<name value="practitioner"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="uuid"/>
<source>
<context value="entry"/>
<element value="fullUrl"/>
<condition
value="($this in %reference.value) and $this.startsWith('urn:uuid')"/>
</source>
<rule>
<name value="representedOrganization"/>
<source>
<context value="entry"/>
<type value="Organization"/>
<element value="resource"/>
<variable value="organization"/>
</source>
<dependent>
<name value="Organization2CdaOrganization"/>
<variable value="organization"/>
<variable value="representedOrganization"/>
</dependent>
</rule>
</rule>
<rule>
<name value="representedOrganization"/>
<source>
<context value="entry"/>
<type value="Organization"/>
<element value="resource"/>
<variable value="organization"/>
<condition
value="('Organization' + '/' + $this.id) in %reference.value"/>
</source>
<dependent>
<name value="Organization2CdaOrganization"/>
<variable value="organization"/>
<variable value="representedOrganization"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
</group>
<group>
<name value="CompositionClinicalDocumentCH"/>
<typeMode value="none"/>
<documentation
value="_________________________ Template Type not specified ___________________
source: http://hl7.org/fhir/R4/person.html
target: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.9.36"/>
<input>
<name value="bundle"/>
<type value="Bundle"/>
<mode value="source"/>
</input>
<input>
<name value="composition"/>
<type value="Composition"/>
<mode value="source"/>
</input>
<input>
<name value="cda"/>
<type value="ClinicalDocument"/>
<mode value="target"/>
</input>
<rule>
<name value="type"/>
<source>
<context value="composition"/>
<element value="type"/>
<variable value="type"/>
</source>
<rule>
<name value="translation"/>
<source>
<context value="type"/>
<element value="coding"/>
<variable value="coding"/>
<condition value="$this.system = 'http://snomed.info/sct'"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="code"/>
<variable value="code"/>
</target>
<target>
<context value="code"/>
<contextType value="variable"/>
<element value="translation"/>
<variable value="translation"/>
</target>
<dependent>
<name value="CodingCE"/>
<variable value="coding"/>
<variable value="translation"/>
</dependent>
</rule>
</rule>
<rule>
<name value="confidentialityCode"/>
<source>
<context value="composition"/>
<element value="confidentiality"/>
<variable value="conf"/>
<condition
value="$this.extension.where(url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-confidentialitycode').exists()"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="confidentialityCode"/>
<variable value="cdaconf"/>
</target>
<rule>
<name value="extension"/>
<source>
<context value="conf"/>
<element value="extension"/>
<variable value="extension"/>
</source>
<rule>
<name value="valueCodeableConcept"/>
<source>
<context value="extension"/>
<element value="valueCodeableConcept"/>
<variable value="valueCodeableConcept"/>
</source>
<rule>
<name value="coding"/>
<source>
<context value="valueCodeableConcept"/>
<element value="coding"/>
<variable value="coding"/>
</source>
<dependent>
<name value="CodingCE"/>
<variable value="coding"/>
<variable value="cdaconf"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
<rule>
<name value="IdentifierII"/>
<source>
<context value="composition"/>
<element value="identifier"/>
<variable value="identifier"/>
<condition value="$this.system = 'urn:ietf:rfc:3986'"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="setId"/>
<variable value="setId"/>
</target>
<dependent>
<name value="IdentifierII"/>
<variable value="identifier"/>
<variable value="setId"/>
</dependent>
<documentation
value="If setId exists as Composition.ch-ext-epr-setid, then map to ClinicalDocument.setId"/>
</rule>
<rule>
<name value="setIdCreated"/>
<source>
<context value="composition"/>
<condition
value="$this.identifier.where(system = 'urn:ietf:rfc:3986').exists() = false"/>
</source>
<rule>
<name value="setId"/>
<source>
<context value="bundle"/>
<element value="identifier"/>
<variable value="identifier"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="setId"/>
<variable value="id"/>
</target>
<dependent>
<name value="IdentifierII"/>
<variable value="identifier"/>
<variable value="id"/>
</dependent>
</rule>
<documentation value="If setId doesn't exist, used bundle.identifer"/>
</rule>
<rule>
<name value="versionNumberMapped"/>
<source>
<context value="composition"/>
<element value="extension"/>
<variable value="ext"/>
<condition
value="$this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-versionnumber'"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="versionNumber"/>
<variable value="versionNumber"/>
</target>
<rule>
<name value="IntegerInt"/>
<source>
<context value="ext"/>
<element value="valueUnsignedInt"/>
<variable value="valueUnsignedInt"/>
</source>
<dependent>
<name value="IntegerINT"/>
<variable value="valueUnsignedInt"/>
<variable value="versionNumber"/>
</dependent>
</rule>
<documentation
value="If versionNumber exists as Composition.ch-ext-epr-versionnumber, then map to ClinicalDocument.versionNumber"/>
</rule>
<rule>
<name value="versionNumberCreated"/>
<source>
<context value="composition"/>
<variable value="composition"/>
<condition
value="$this.extension.where(url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-versionnumber').exists() = false"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="versionNumber"/>
<variable value="versionNumber"/>
</target>
<rule>
<name value="versionNumber"/>
<source>
<context value="composition"/>
</source>
<target>
<context value="versionNumber"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="copy"/>
<parameter>
<valueString value="1"/>
</parameter>
</target>
</rule>
<documentation
value="If versionNumber doesn't exist, create ClinicalDocument.versionNumber = 1"/>
</rule>
<rule>
<name value="informationRecipient"/>
<source>
<context value="composition"/>
<element value="extension"/>
<variable value="extension"/>
<condition
value="$this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-informationrecipient'"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="informationRecipient"/>
<variable value="informationRecipient"/>
</target>
<rule>
<name value="PRCP"/>
<source>
<context value="extension"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="typeCode"/>
<transform value="copy"/>
<parameter>
<valueString value="PRCP"/>
</parameter>
</target>
</rule>
<rule>
<name value="templateId"/>
<source>
<context value="extension"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.2.4"/>
</parameter>
</target>
</rule>
<rule>
<name value="valueReference"/>
<source>
<context value="extension"/>
<element value="valueReference"/>
<variable value="valueReference"/>
</source>
<rule>
<name value="entry"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="uuid"/>
<source>
<context value="entry"/>
<element value="fullUrl"/>
<condition
value="($this in %valueReference.reference) and $this.startsWith('urn:uuid')"/>
</source>
<rule>
<name value="fullUrlPatient"/>
<source>
<context value="entry"/>
<type value="Patient"/>
<element value="resource"/>
<variable value="patient"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="intendedRecipient"/>
<variable value="intendedRecipient"/>
<listMode value="share"/>
<listRuleId value="intendedRecipient"/>
</target>
<rule>
<name value="address"/>
<source>
<context value="patient"/>
<element value="address"/>
<variable value="address"/>
</source>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="addr"/>
<variable value="addr"/>
</target>
<dependent>
<name value="AddressAD"/>
<variable value="address"/>
<variable value="addr"/>
</dependent>
</rule>
<rule>
<name value="name"/>
<source>
<context value="patient"/>
<element value="name"/>
<variable value="humanname"/>
</source>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="informationRecipient"/>
<variable value="informationRecipient2"/>
</target>
<target>
<context value="informationRecipient2"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="en"/>
</target>
<dependent>
<name value="HumanNameEN"/>
<variable value="humanname"/>
<variable value="en"/>
</dependent>
</rule>
</rule>
<rule>
<name value="organization"/>
<source>
<context value="entry"/>
<type value="Organization"/>
<element value="resource"/>
<variable value="organization"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="intendedRecipient"/>
<variable value="intendedRecipient"/>
<listMode value="share"/>
<listRuleId value="intendedRecipient"/>
</target>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="receivedOrganization"/>
<variable value="receivedOrganization"/>
</target>
<dependent>
<name value="Organization2CdaOrganization"/>
<variable value="organization"/>
<variable value="receivedOrganization"/>
</dependent>
</rule>
</rule>
<rule>
<name value="intendedRecipient"/>
<source>
<context value="entry"/>
<type value="Patient"/>
<element value="resource"/>
<variable value="patient"/>
<condition
value="(($this.id = %valueReference.reference.substring(8)) or ($this.id = %valueReference.reference.substring(9)))"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="intendedRecipient"/>
<variable value="intendedRecipient"/>
<listMode value="share"/>
<listRuleId value="intendedRecipient"/>
</target>
<rule>
<name value="address"/>
<source>
<context value="patient"/>
<element value="address"/>
<variable value="address"/>
</source>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="addr"/>
<variable value="addr"/>
</target>
<dependent>
<name value="AddressAD"/>
<variable value="address"/>
<variable value="addr"/>
</dependent>
</rule>
<rule>
<name value="name"/>
<source>
<context value="patient"/>
<element value="name"/>
<variable value="humanname"/>
</source>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="informationRecipient"/>
<variable value="informationRecipient2"/>
</target>
<target>
<context value="informationRecipient2"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="en"/>
</target>
<dependent>
<name value="HumanNameEN"/>
<variable value="humanname"/>
<variable value="en"/>
</dependent>
</rule>
</rule>
<rule>
<name value="organization"/>
<source>
<context value="entry"/>
<type value="Organization"/>
<element value="resource"/>
<variable value="organization"/>
<condition
value="(($this.id = %valueReference.reference.substring(13)) or ($this.id = %valueReference.reference.substring(9)))"/>
</source>
<target>
<context value="informationRecipient"/>
<contextType value="variable"/>
<element value="intendedRecipient"/>
<variable value="intendedRecipient"/>
<listMode value="share"/>
<listRuleId value="intendedRecipient"/>
</target>
<target>
<context value="intendedRecipient"/>
<contextType value="variable"/>
<element value="receivedOrganization"/>
<variable value="receivedOrganization"/>
</target>
<dependent>
<name value="Organization2CdaOrganization"/>
<variable value="organization"/>
<variable value="receivedOrganization"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
<rule>
<name value="dataEnterer"/>
<source>
<context value="composition"/>
<element value="extension"/>
<variable value="extension"/>
<condition
value="$this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer'"/>
</source>
<target>
<context value="cda"/>
<contextType value="variable"/>
<element value="dataEnterer"/>
<variable value="dataEnterer"/>
</target>
<rule>
<name value="templateId"/>
<source>
<context value="extension"/>
</source>
<target>
<context value="dataEnterer"/>
<contextType value="variable"/>
<element value="templateId"/>
<variable value="templateId"/>
</target>
<target>
<context value="templateId"/>
<contextType value="variable"/>
<element value="root"/>
<transform value="copy"/>
<parameter>
<valueString value="2.16.756.5.30.1.1.10.2.7"/>
</parameter>
</target>
</rule>
<rule>
<name value="extensionTime"/>
<source>
<context value="extension"/>
<element value="extension"/>
<variable value="extensionTime"/>
<condition
value="$this.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time'"/>
</source>
<rule>
<name value="DateTime"/>
<source>
<context value="extensionTime"/>
<element value="valueDateTime"/>
<variable value="valueDateTime"/>
</source>
<target>
<context value="dataEnterer"/>
<contextType value="variable"/>
<element value="time"/>
<variable value="time"/>
</target>
<dependent>
<name value="DateTimeTS"/>
<variable value="valueDateTime"/>
<variable value="time"/>
</dependent>
</rule>
</rule>
<rule>
<name value="extensionPerson"/>
<source>
<context value="extension"/>
<element value="extension"/>
<variable value="extensionPerson"/>
<condition value="$this.url = 'enterer'"/>
</source>
<rule>
<name value="valueReference"/>
<source>
<context value="extensionPerson"/>
<element value="valueReference"/>
<variable value="valueReference"/>
</source>
<rule>
<name value="practitioner"/>
<source>
<context value="bundle"/>
<element value="entry"/>
<variable value="entry"/>
</source>
<rule>
<name value="uuid"/>
<source>
<context value="entry"/>
<element value="fullUrl"/>
<condition
value="($this in %valueReference.reference) and $this.startsWith('urn:uuid')"/>
</source>
<rule>
<name value="AssignedEntityWithId"/>
<source>
<context value="entry"/>
<type value="PractitionerRole"/>
<element value="resource"/>
<variable value="practitionerRole"/>
</source>
<target>
<context value="dataEnterer"/>
<contextType value="variable"/>
<element value="assignedEntity"/>
<variable value="assignedEntity"/>
</target>
<dependent>
<name value="DataEnterer"/>
<variable value="bundle"/>
<variable value="practitionerRole"/>
<variable value="assignedEntity"/>
</dependent>
</rule>
</rule>
<rule>
<name value="AssignedEntityWithId"/>
<source>
<context value="entry"/>
<type value="PractitionerRole"/>
<element value="resource"/>
<variable value="practitionerRole"/>
<condition
value="('PractitionerRole' + '/' + $this.id) in %valueReference.reference"/>
</source>
<target>
<context value="dataEnterer"/>
<contextType value="variable"/>
<element value="assignedEntity"/>
<variable value="assignedEntity"/>
</target>
<dependent>
<name value="DataEnterer"/>
<variable value="bundle"/>
<variable value="practitionerRole"/>
<variable value="assignedEntity"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
</rule>
</group>
</StructureMap>