CH ORF (R4)
3.0.0 - trial-use Switzerland flag

This page is part of the CH ORF (R4) (v3.0.0: STU 3) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

: Map ORF - TTL Representation

Draft as of 2024-12-18

Raw ttl | Download

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

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

 a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "OrfQrToBundle"] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap OrfQrToBundle</b></p><a name=\"OrfQrToBundle\"> </a><a name=\"hcOrfQrToBundle\"> </a><a name=\"OrfQrToBundle-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle<span style=\"color: navy\">&quot; = &quot;</span>OrfQrToBundle<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">ORF QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">2021-01-11 Oliver Egger</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>QuestionnaireResponseSource <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">&quot; </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/relatedperson.html\" title=\"RelatedPerson\">http://hl7.org/fhir/StructureDefinition/RelatedPerson</a><span style=\"color: navy\">&quot; </span><b>alias </b>RelatedPerson <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">&quot; </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">&quot; </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">&quot; </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">&quot; </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/extensibility.html#Extension\" title=\"Extension\">http://hl7.org/fhir/StructureDefinition/Extension</a><span style=\"color: navy\">&quot; </span><b>alias </b>Extension <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/episodeofcare.html\" title=\"EpisodeOfCare\">http://hl7.org/fhir/StructureDefinition/EpisodeOfCare</a><span style=\"color: navy\">&quot; </span><b>alias </b>EpisodeOfCare <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>QuestionnaireResponse <b>as </b><b>target</b>\r\n\r\n<b>group </b>OrfQrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr<span style=\"color: navy\"><b> -&gt; </b></span> bundle.identifier<b> as </b><span style=\"color: maroon\">documentIdentifier</span><span style=\"color: navy\">, </span> documentIdentifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">, </span> documentIdentifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">)</span> <i>&quot;documentIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> bundle.timestamp = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> bundle.type = <span style=\"color: blue\">'document'</span><span style=\"color: navy\">, </span> composition.date = <span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> composition.title = <span style=\"color: blue\">'Order and Referral by Form'</span><span style=\"color: navy\">, </span> composition.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'419891008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> composition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'721963009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'QuestionnaireResponse'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">questionnaireresp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    qr<b> then </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">)</span> <i>&quot;questionnaireresp&quot;</i><span style=\"color: navy\">;</span>\r\n    qr<span style=\"color: navy\"><b> -&gt; </b></span> questionnaireresp.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ServiceRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span> servicerequest.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then </b>QrToBundle<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;orfbundle&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;OrfQrToBundle&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>QuestionnaireResponse<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.identifier = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.basedOn<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.basedOn = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.partOf<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.partOf = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.questionnaire<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.questionnaire = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.status<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.subject<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.subject = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.encounter<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.encounter = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.authored<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.authored = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.author<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.author = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.source<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.source = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.item = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QrToGroups<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'order'<b> then </b>OrderItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grporder&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'receiver'<b> then </b>ReceiverInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;receiver&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'initiator'<b> then </b>InitiatorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grpinitiator&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'patient'<b> then </b>PatientItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grppatient&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'requestedEncounter'<b> then </b>RequestedEncounterItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grprequestedencounter&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'coverage'<b> then </b>Coverage<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grprequestedencounter&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'sender'<b> then </b>SenderAuthorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grpsender&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'receiverCopy'<b> then </b>ReceiverCopy<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;receiverCopy&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'appointment'<b> then </b>Appointment<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;appointment&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'antecedentEpisodeOfCare'<b> then </b>AntecedentEpisodeOfCareInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">)</span> <i>&quot;AntecedentEpisodeOfCareInit&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'consent'<b> then </b>Consent<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">)</span> <i>&quot;consent&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'note'<b> then </b>Note<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;note&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>OrderItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.precedentDocumentIdentifier') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>'urn:uuid:' + %item.answer.value<span style=\"color: navy\">)</span> <i>&quot;orderPrecedentDocumentIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.placerOrderIdentifier') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>placer</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'PLAC'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;orderPlacerOrderIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.placerOrderIdentifierDomain') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>placer</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;orderPlacerOrderIdentifierDomain&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.fillerOrderIdentifier') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>filler</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'FILL'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;orderFillerOrderIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.fillerOrderIdentifierDomain') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>filler</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;orderFillerOrderIdentifierDomain&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.authoredOn') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>serviceRequest.authoredOn = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.priority') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>serviceRequest.priority = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocument')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      item<b> then </b>UrgentNotificationContactForRequestItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n      item<b> then </b>ExtOrfUrgentNotificationContactForRequest<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;orderNotificationContactDocumentItems&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;ordeNnotificationContactDocument&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocumentResponse')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      item<b> then </b>UrgentNotificationContactForResponseItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n      item<b> then </b>ExtOrfUrgentNotificationContactForResponse<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;orderNotificationContactDocumentResponseItems&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;orderNotificationContactDocumentResponse&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForRequestPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;senderAuthorPractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForRequestItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocument.practitioner')<b> then </b>UrgentNotificationContactForRequestPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfUrgentNotificationContactForRequest<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>&quot;practitionerRole&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForResponsePractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;senderAuthorPractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForResponseItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocumentResponse.practitioner')<b> then </b>UrgentNotificationContactForResponsePractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfUrgentNotificationContactForResponse<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>&quot;practitionerRole&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;receiverPractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerZsr&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationZsr&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiver.practitioner')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ReceiverPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiver.organization')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>ReceiverOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Consent<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'consent.statement') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Consent'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">consent</span><span style=\"color: navy\">, </span> consent.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> consent.scope<b> as </b><span style=\"color: maroon\">scope</span><span style=\"color: navy\">, </span> scope.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'treatment'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/consentscope'</span><span style=\"color: navy\">, </span> consent.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'59284-0'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> consent.policyRule<b> as </b><span style=\"color: maroon\">policyRule</span><span style=\"color: navy\">, </span> policyRule.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'385432009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> consent.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> consent.extension<b> as </b><span style=\"color: maroon\">extcode</span><span style=\"color: navy\">, </span> extcode.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode'</span><span style=\"color: navy\">, </span> extcode.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'consent.statement.note') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> consent.extension<b> as </b><span style=\"color: maroon\">extnote</span><span style=\"color: navy\">, </span> extnote.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote'</span><span style=\"color: navy\">, </span> extnote.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;consentStatementNote&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;consentStatement&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> then </b>ReceiverItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">)</span> <i>&quot;receiver&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.personalrelation') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personalrelation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;Initiatorpersonalrelation&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.legalrelation') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-legalrelation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;Initiatorlegalrelation&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'initiator.practitionerRole')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> practitionerrole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personorganization'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item<b> then </b>InitiatorPractitionerRoleItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;InitiatorPractitionerRoleItems&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'initiator.relatedPerson')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personorganization'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item<b> then </b>InitiatorRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;InitiatorelatedPerson&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;Phone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonEmail&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorelatedPersonCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorPractitionerRoleItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'initiator.practitionerRole.practitioner')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>InitiatorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'initiator.practitionerRole.organization')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>InitiatorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;InitiatorractitionerRolePractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRolePractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRolePractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverPractitionerZsr&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRoleOrganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRoleOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRoleOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;InitiatorractitionerRoleOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> patient.generalPractitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">gp</span><span style=\"color: navy\">, </span> gp.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'familydoctor.practitioner')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>FamilyDoctorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'familydoctor.organization')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>FamilyDoctorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;FamilyDoctorInit&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorPractitionerGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorPractitionerZsr&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;familydoctorPractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;familydoctorOrganizationZsr&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'EpisodeOfCare'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\">, </span> episodeofcare.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.status = <span style=\"color: blue\">'finished'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> ref.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %episodeofcare.id<span style=\"color: navy\">)</span><b> then </b>AntecedentEpisodeOfCareItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\">)</span> <i>&quot;AntecedentEpisodeOfCareItems&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\"> : </span>EpisodeOfCare<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.start') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> episodeofcare.statusHistory<b> as </b><span style=\"color: maroon\">statusHistory</span><span style=\"color: navy\">, </span> statusHistory.status = <span style=\"color: blue\">'finished'</span><span style=\"color: navy\">, </span> statusHistory.period<b> as </b><span style=\"color: maroon\">period</span><span style=\"color: navy\">, </span> period.start = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> period.end = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.item<b> as </b><span style=\"color: maroon\">iteme</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.end') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>period.end = <span style=\"color: navy\">(</span>%iteme.answer.value<span style=\"color: navy\">)</span> <i>&quot;antecedentEpisodeOfCareEndNotSameAsStart&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;antecedentEpisodeOfCareRequestedPeriodStart&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'antecedentEpisodeOfCare.managingOrganization')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.patient = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %tgt.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.managingOrganization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>AntecedentEpisodeOfCareOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;antecedentEpisodeOfCareManagingOrganization&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;antecedentEpisodeOfCareorganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator'</span><b> then </b>InitiatorItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>&quot;receiver&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PatientItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'familydoctor'<b> then </b>FamilyDoctorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;grpfamily&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> then </b>PatientItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>patientName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.maidenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span><span style=\"color: navy\">, </span> name.use = <span style=\"color: blue\">'maiden'</span><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>patientName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.localPid') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>localpid</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'MR'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientLocalPid&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.localPidDomain') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>localpid</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientLocalPidDomain&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.birthDate') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>tgt.birthDate = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.gender') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>tgt.gender = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.maritalStatus') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.maritalStatus<b> as </b><span style=\"color: maroon\">maritalStatus</span><span style=\"color: navy\">, </span> maritalStatus.coding = <span style=\"color: maroon\">coding</span> <i>&quot;maritalStatus&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;patientMaritalStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;PatientPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientEmail&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientCountry&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.languageOfCorrespondence') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.communication<b> as </b><span style=\"color: maroon\">communication</span><span style=\"color: navy\">, </span> communication.preferred = <span style=\"color: blue\">true</span><span style=\"color: navy\">, </span> communication.language<b> as </b><span style=\"color: maroon\">language</span><span style=\"color: navy\">, </span> language.coding = <span style=\"color: maroon\">coding</span> <i>&quot;languageOfCorrespondence&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;PatientLanguageOfCorrespondence&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'patient.contactperson')<span style=\"color: navy\"><b> -&gt; </b></span>tgt.contact<b> as </b><span style=\"color: maroon\">contact</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> contact.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>contactName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> contact.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>contactName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>      item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientPhone&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;PatientContactpersonPhone&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> contact.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientEmail&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.relationship') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> contact.relationship<b> as </b><span style=\"color: maroon\">relationship</span><span style=\"color: navy\">, </span> relationship.text = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;PatientContactpersonRelationship&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;contact&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RequestedEncounterItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Encounter'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">, </span> encounter.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> encounter.status = <span style=\"color: blue\">'planned'</span><span style=\"color: navy\">, </span> serviceRequest.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> encounter.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedEncounter.class') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>encounter.class = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;requestedEncounterClass&quot;</i><span style=\"color: navy\">;</span>\r\n    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedEncounter.desiredAccommodation') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> encounter.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;requestedEncounterDesiredAccommodation&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;RequestedEncounterItems&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Coverage<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.beneficiary</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.beneficiary.ahvn13</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.beneficiary')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.beneficiary.ahvn13') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> patient.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.32'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageBeneficiaryAhvn13&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coverageBeneficiary&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg.name</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg.insuranceCardNumber</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.kvg')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'1'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.kvg.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageKvgName&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.kvg.insuranceCardNumber') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'VeKa'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageKvgInsuranceCardNumber&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coveragekvg&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg	Unfallversicherung nach UVG (fr: LAA, it: LAINF)	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg.name	Name der Versicherung	0..1	string		Definition: Coverage.payor</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg.claimNumber	Schadennummer	0..1	string		Definition: Coverage.identifier</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.uvg')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'4'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.uvg.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageUvgName&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.uvg.claimNumber') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'Claim'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageUvgClaimNumber&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coverageuvg&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg	Zusatzversicherung nach VVG (fr/it: LCA)	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg.name	Name der Versicherung	0..1	string		Definition: Coverage.payor</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg.insuranceCardNumber	Kennnummer der Versichertenkarte	0..1	string		Definition: Coverage.identifier</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.vvg')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'ZV'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.vvg.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageVvgName&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.vvg.insuranceCardNumber') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'VeKa'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageVvgInsuranceCardNumber&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coveragevvg&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.iv	Invalidenversicherung (IV)	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.iv.verfuegungsnummer</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.iv')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'2'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.iv.verfuegungsnummer') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'IV'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: blue\">'IV'</span> <i>&quot;coverageivverfuegungsnummer&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coverageiv&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.mv	Militärversicherung (MV)	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.mv.versichertennummer</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.mv')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'3'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.mv.versichertennummer') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'MV'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: blue\">'MV'</span> <i>&quot;coveragemvversichertennummer&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coveragemv&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self	Selbstzahler	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self.familyName	Name	0..1	string		Definition: Coverage.payor</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self.givenName	Vorname	0..1	string		Definition: Coverage.payor</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.self')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.patient') and answer.exists() and answer.value)<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'5'</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;payor&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'coverage.self.patientRelatedPerson') and answer.exists() and answer.value)<b> then</b><span style=\"color: navy\"> {\r\n</span>      item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'coverage.self.relatedPerson')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'5'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e6</span><span style=\"color: navy\">, </span> e6.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid6</span><span style=\"color: navy\">, </span> e6.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid6</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %relatedPerson.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then </b>CoverageRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>&quot;coverageselfrelatedPerson&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;coverageselfpatientrelated&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;self&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other	Anderer Kostenträger	0..1	group		Definition: Coverage.type</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.name	Name des Kostenträgers	0..1	string		Definition: Coverage.payor</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.id	Beliebige ID	0..1	string		Definition: Coverage.identifier</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.id.note TODO</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.other')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'8'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.other.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageOtherName&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.other.id') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageOtherId&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;coveragevvg&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>CoverageRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;Phone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonEmail&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;coverageSelfRelatedPersonCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;senderAuthorPractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerZsr&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationGln&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationZsr&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author.practitioner')<b> then </b>SenderAuthorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author.organization')<b> then </b>SenderAuthorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderDataEntererPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;senderAuthorPractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderDataEntererItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.dataenterer.practitioner')<b> then </b>SenderDataEntererPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'enterer'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>&quot;practitionerRole&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.author = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.requester = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author')<b> then </b>SenderAuthorItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;senderAuthor&quot;</i><span style=\"color: navy\">;</span>\r\n    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.dataenterer')<b> then</b><span style=\"color: navy\"> {\r\n</span>      item<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        item<b> then </b>SenderDataEntererItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n        item<b> then </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;senderDataentererItems&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;senderDataenterer&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;sender&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;Phone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonEmail&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyRelatedPersonCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>&quot;receiverCopyPractitionerRolePractitionerTitle&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRolePractitionerPhone&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRolePractitionerEmail&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRoleOrganizationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRoleOrganizationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRoleOrganizationCity&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;receiverCopyPractitionerRoleOrganizationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyPractitionerRoleItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiverCopy.practitionerRole.practitioner')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ReceiverCopyPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiverCopy.practitionerRole.organization')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>ReceiverCopyOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverPatient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;patient&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverPractitionerRole<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">res</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %res.id<span style=\"color: navy\">)</span> <i>&quot;organization&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverRelatedPerson<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">res</span><span style=\"color: navy\"> : </span>RelatedPerson, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>&quot;url&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %res.id<span style=\"color: navy\">)</span> <i>&quot;organization&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopy<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.practitionerRole')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> practitionerrole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item<b> then </b>ReceiverCopyPractitionerRoleItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n    item<b> then </b>ExtOrfCopyReceiverPractitionerRole<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;receiverCopyPractitionerRole1&quot;</i><span style=\"color: navy\">;</span>\r\n  grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.patient')<span style=\"color: navy\"><b> -&gt; </b></span>composition.extension<b> as </b><span style=\"color: maroon\">extension</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item<b> then </b>ExtOrfCopyReceiverPatient<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;receiverCopyPatient&quot;</i><span style=\"color: navy\">;</span>\r\n  grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.relatedPerson')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item<b> then </b>ReceiverCopyRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>&quot;data&quot;</i><span style=\"color: navy\">;</span>\r\n    item<b> then </b>ExtOrfCopyReceiverRelatedPerson<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>&quot;extension&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;receiverCopyRelatedPerson&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Appointment<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  grp<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Appointment'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">appointment</span><span style=\"color: navy\">, </span> appointment.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.status') and (answer.value.code = 'proposed'))<span style=\"color: navy\"><b> -&gt; </b></span>appointment.status = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      grp.item<b> as </b><span style=\"color: maroon\">itemp</span><b> where </b>(linkId.value = 'appointment.requestedPeriod')<b> then</b><span style=\"color: navy\"> {\r\n</span>        itemp.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> appointment.requestedPeriod<b> as </b><span style=\"color: maroon\">requestedPeriod</span><span style=\"color: navy\">, </span> requestedPeriod.start = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> requestedPeriod.end = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          itemp.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>requestedPeriod.end = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentRequestedPeriodendifnotsameasstart&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;appointmentRequestedPeriodStart&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;appointmentRequestedPeriod&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;proposed&quot;</i><span style=\"color: navy\">;</span>\r\n    grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.status') and ((answer.value.code = 'pending') or (answer.value.code = 'booked')))<span style=\"color: navy\"><b> -&gt; </b></span>appointment.status = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      grp.item<b> as </b><span style=\"color: maroon\">itemp</span><b> where </b>(linkId.value = 'appointment.requestedPeriod')<b> then</b><span style=\"color: navy\"> {\r\n</span>        itemp.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> appointment.start = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> appointment.end = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          itemp.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>appointment.end = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentendifnotsameasstart&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;appointmentStart&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;appointmentStartend&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;pendingorbooked&quot;</i><span style=\"color: navy\">;</span>\r\n    grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.patientInstruction') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>appointment.patientInstruction = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentPatientInstruction&quot;</i><span style=\"color: navy\">;</span>\r\n    grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'appointment.location')<b> then</b><span style=\"color: navy\"> {\r\n</span>      item<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><span style=\"color: navy\">, </span> location.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid5<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> appointment.participant<b> as </b><span style=\"color: maroon\">participant</span><span style=\"color: navy\">, </span> participant.status = <span style=\"color: blue\">'tentative'</span><span style=\"color: navy\">, </span> participant.actor = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">actor</span><span style=\"color: navy\">, </span> actor.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %location.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.name') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>location.name = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.phone') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> location.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentLocationPhone&quot;</i><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.email') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> location.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentLocationEmail&quot;</i><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span>          item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>&quot;line&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;appointmentLocationStreetAddressLine&quot;</i><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.postalCode') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentLocationPostalCode&quot;</i><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.city') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentlocationCity&quot;</i><span style=\"color: navy\">;</span>\r\n        item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.country') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>&quot;appointmentLocationCountry&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;location&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;appointmentLocation&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;Appointment&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Note<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId = 'note.text') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.note<b> as </b><span style=\"color: maroon\">note</span><span style=\"color: navy\">, </span> note.text = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;noteText&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">group QrToBundle(source qr : QuestionnaireResponseSource, target q: Questionnaire, target patient : Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target composition : Composition, target bundle : Bundle) {</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span>bundle.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;id&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span>bundle.type = <span style=\"color: blue\">'document'</span> <i>&quot;type&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<b> then </b>OrfComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;composition&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<b> then </b>QrToGroups<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>&quot;qrgroups&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">group OrfComposition(source qr : QuestionnaireResponseSource, target q: Questionnaire, target tgt : Composition, target patient: Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target bundle : Bundle) {</span>\r\n<b>group </b>OrfComposition<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'final'</span> <i>&quot;status&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span> tgt.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;subject&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span> tgt.section<b> as </b><span style=\"color: maroon\">tgtSection</span><span style=\"color: navy\">, </span> tgtSection.title = <span style=\"color: blue\">'Order-Referral'</span><span style=\"color: navy\">, </span> tgtSection.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'93037-0'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Portable medical order form'</span><span style=\"color: navy\">, </span> tgtSection.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %questionnaireresp.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtSection.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %servicerequest.id<span style=\"color: navy\">)</span> <i>&quot;sections&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">,</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">tgtSection.entry = create('Reference') as reference, reference.reference = (%q.url) &quot;sections&quot;;</span>\r\n  qr<span style=\"color: navy\"><b> -&gt; </b></span> servicerequest.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> servicerequest.intent = <span style=\"color: blue\">'order'</span><span style=\"color: navy\">, </span> servicerequest.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;servicerequest&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  ] ; # 
  fhir:url [ fhir:v "http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "3.0.0"] ; # 
  fhir:name [ fhir:v "OrfQrToBundle"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2024-12-18T08:32:08+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 Switzerland"] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "HL7 Switzerland" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "https://www.hl7.ch/" ]     ] )
  ] ) ; # 
  fhir:description [ fhir:v "ORF QuestionnaireResponse to Bundle\r\n2021-01-11 Oliver Egger\r\nQRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html\r\nQRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html\r\nBundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html"] ; # 
  fhir:jurisdiction ( [
    ( fhir:coding [
fhir:system [ fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ] ;
fhir:code [ fhir:v "CH" ]     ] )
  ] ) ; # 
  fhir:copyright [ fhir:v "CC0-1.0"] ; # 
  fhir:structure ( [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "QuestionnaireResponseSource" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Bundle" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Composition"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Composition>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Composition" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Patient>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Patient" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/RelatedPerson"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/RelatedPerson>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "RelatedPerson" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Organization"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Organization>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Organization" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Practitioner"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Practitioner>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Practitioner" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/PractitionerRole"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/PractitionerRole>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "PractitionerRole" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/ServiceRequest"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/ServiceRequest>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "ServiceRequest" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Extension"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Extension>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Extension" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/EpisodeOfCare>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "EpisodeOfCare" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "QuestionnaireResponse" ]
  ] ) ; # 
  fhir:group ( [
fhir:name [ fhir:v "OrfQrToBundle" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "qr" ] ;
fhir:type [ fhir:v "QuestionnaireResponseSource" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "documentIdentifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "documentIdentifier" ]       ] [
fhir:context [ fhir:v "documentIdentifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:ietf:rfc:3986" ]         ] )       ] [
fhir:contextType [ fhir:v "variable" ] ;
fhir:variable [ fhir:v "uuidDoc" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "documentIdentifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuidDoc" ]         ] )       ] )     ] [
fhir:name [ fhir:v "OrfQrToBundle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "composition" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Composition" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timestamp" ] ;
fhir:variable [ fhir:v "timestamp" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "now()" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "document" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "date" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "timestamp" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Order and Referral by Form" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "419891008" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://snomed.info/sct" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "category" ] ;
fhir:variable [ fhir:v "category" ]       ] [
fhir:context [ fhir:v "category" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "721963009" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://snomed.info/sct" ]         ] )       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patient" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Patient" ]         ] )       ] [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "questionnaireresp" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "QuestionnaireResponse" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "questionnaireresp" ] ;
        ( fhir:source [
fhir:context [ fhir:v "qr" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "QuestionnaireResponseMap" ] ;
          ( fhir:variable [ fhir:v "qr" ] [ fhir:v "questionnaireresp" ] )         ] )       ] [
fhir:name [ fhir:v "orfbundle" ] ;
        ( fhir:source [
fhir:context [ fhir:v "qr" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "questionnaireresp" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid4" ]           ] )         ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "servicerequest" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "ServiceRequest" ]           ] )         ] [
fhir:context [ fhir:v "servicerequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid5" ]           ] )         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "QrToBundle" ] ;
          ( fhir:variable [ fhir:v "qr" ] [ fhir:v "patient" ] [ fhir:v "questionnaireresp" ] [ fhir:v "servicerequest" ] [ fhir:v "composition" ] [ fhir:v "bundle" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "QuestionnaireResponseMap" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "QuestionnaireResponse" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "identifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "basedOn" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "basedOn" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "basedOn" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "partOf" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "partOf" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "partOf" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "questionnaire" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "questionnaire" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "questionnaire" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "status" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "subject" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "encounter" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "encounter" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "encounter" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "authored" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "authored" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "authored" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "author" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "author" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "author" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "source" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "source" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "source" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "value" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "QrToGroups" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "qr" ] ;
fhir:type [ fhir:v "QuestionnaireResponseSource" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "grporder" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'order'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "OrderItems" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "receiver" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'receiver'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverInit" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "grpinitiator" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'initiator'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "InitiatorInit" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "grppatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'patient'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "PatientItems" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "grprequestedencounter" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'requestedEncounter'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "RequestedEncounterItems" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "grprequestedencounter" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'coverage'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "Coverage" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "grpsender" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'sender'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "SenderAuthorInit" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopy" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'receiverCopy'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverCopy" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "appointment" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'appointment'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "Appointment" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "AntecedentEpisodeOfCareInit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'antecedentEpisodeOfCare'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "AntecedentEpisodeOfCareInit" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "composition" ] )       ] )     ] [
fhir:name [ fhir:v "consent" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'consent'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "Consent" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] )       ] )     ] [
fhir:name [ fhir:v "note" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'note'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "Note" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "serviceRequest" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "OrderItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "orderPrecedentDocumentIdentifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.precedentDocumentIdentifier') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Identifier" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:ietf:rfc:3986" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "orderPlacerOrderIdentifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.placerOrderIdentifier') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "placer" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v2-0203" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PLAC" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "orderPlacerOrderIdentifierDomain" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.placerOrderIdentifierDomain') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "placer" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "orderFillerOrderIdentifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.fillerOrderIdentifier') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "filler" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v2-0203" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "FILL" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "orderFillerOrderIdentifierDomain" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.fillerOrderIdentifierDomain') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "filler" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.authoredOn') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "authoredOn" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.priority') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "priority" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value.code" ]         ] )       ] )     ] [
fhir:name [ fhir:v "ordeNnotificationContactDocument" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'order.notificationContactDocument')" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "orderNotificationContactDocumentItems" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]           ] )         ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid4" ]           ] )         ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]         ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]           ] )         ] [
fhir:context [ fhir:v "practitionerDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid5" ]           ] )         ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid5" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:dependent [
fhir:name [ fhir:v "UrgentNotificationContactForRequestItems" ] ;
            ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "practitionerDataEnterer" ] )           ] )         ] [
fhir:name [ fhir:v "extension" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:dependent [
fhir:name [ fhir:v "ExtOrfUrgentNotificationContactForRequest" ] ;
            ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "extension" ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "orderNotificationContactDocumentResponse" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'order.notificationContactDocumentResponse')" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "orderNotificationContactDocumentResponseItems" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]           ] )         ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid4" ]           ] )         ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]         ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]           ] )         ] [
fhir:context [ fhir:v "practitionerDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid5" ]           ] )         ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid5" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:dependent [
fhir:name [ fhir:v "UrgentNotificationContactForResponseItems" ] ;
            ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "practitionerDataEnterer" ] )           ] )         ] [
fhir:name [ fhir:v "extension" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:dependent [
fhir:name [ fhir:v "ExtOrfUrgentNotificationContactForResponse" ] ;
            ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "extension" ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "UrgentNotificationContactForRequestPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocument.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocument.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocument.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocument.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocument.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "UrgentNotificationContactForRequestItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'order.notificationContactDocument.practitioner')" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "UrgentNotificationContactForRequestPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ExtOrfUrgentNotificationContactForRequest" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument" ]         ] )       ] )     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %practitionerRole.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "UrgentNotificationContactForResponsePractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "UrgentNotificationContactForResponseItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'order.notificationContactDocumentResponse.practitioner')" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "UrgentNotificationContactForResponsePractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ExtOrfUrgentNotificationContactForResponse" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument" ]         ] )       ] )     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %practitionerRole.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverOrganizationGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverOrganizationZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "receiverOrganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiver.organization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'receiver.practitioner')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitioner" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]         ] )       ] [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'receiver.organization')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]         ] )       ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverOrganizationItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Consent" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "consentStatement" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'consent.statement') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "consent" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Consent" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "scope" ] ;
fhir:variable [ fhir:v "scope" ]       ] [
fhir:context [ fhir:v "scope" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "treatment" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/consentscope" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "category" ] ;
fhir:variable [ fhir:v "category" ]       ] [
fhir:context [ fhir:v "category" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "59284-0" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://loinc.org" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "policyRule" ] ;
fhir:variable [ fhir:v "policyRule" ]       ] [
fhir:context [ fhir:v "policyRule" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "385432009" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://snomed.info/sct" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extcode" ]       ] [
fhir:context [ fhir:v "extcode" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode" ]         ] )       ] [
fhir:context [ fhir:v "extcode" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]         ] )       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "itemAnswer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "consentStatementNote" ] ;
          ( fhir:source [
fhir:context [ fhir:v "answer" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'consent.statement.note') and answer.exists())" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "consent" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extnote" ]           ] [
fhir:context [ fhir:v "extnote" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote" ]             ] )           ] [
fhir:context [ fhir:v "extnote" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverInit" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "receiver" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRole" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]         ] )       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverItems" ] ;
        ( fhir:variable [ fhir:v "src" ] [ fhir:v "bundle" ] [ fhir:v "practitionerRole" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "Initiatorpersonalrelation" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.personalrelation') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ch-orf-personalrelation" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Initiatorlegalrelation" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.legalrelation') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ch-orf-legalrelation" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorPractitionerRoleItems" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId = 'initiator.practitionerRole')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerrole" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "practitionerrole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ch-orf-personorganization" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "InitiatorPractitionerRoleItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "bundle" ] [ fhir:v "practitionerrole" ] )         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorelatedPerson" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId = 'initiator.relatedPerson')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "relatedPerson" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "RelatedPerson" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ch-orf-personorganization" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patient" ] ;
fhir:variable [ fhir:v "reference" ]       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "InitiatorRelatedPersonItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "relatedPerson" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorRelatedPersonItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "relatedPerson" ] ;
fhir:type [ fhir:v "RelatedPerson" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Phone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.phone') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "InitiatorelatedPersonPhone" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "phone" ]           ] )         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorelatedPersonEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "InitiatorelatedPersonStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorelatedPersonPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorelatedPersonCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorelatedPersonCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.relatedPerson.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorPractitionerRoleItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'initiator.practitionerRole.practitioner')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitioner" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]         ] )       ] [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "InitiatorPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'initiator.practitionerRole.organization')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]         ] )       ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "InitiatorOrganizationItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRolePractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRolePractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRolePractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverPractitionerZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.practitioner.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.organization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.organization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "InitiatorractitionerRoleOrganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRoleOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.organization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRoleOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.organization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "InitiatorractitionerRoleOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'initiator.practitionerRole.organization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "FamilyDoctorInit" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "FamilyDoctorInit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRole" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]         ] )       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "generalPractitioner" ] ;
fhir:variable [ fhir:v "gp" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "gp" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'familydoctor.practitioner')" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]         ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitioner" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]           ] )         ] [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid2" ]           ] )         ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid2" ]           ] )         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "FamilyDoctorPractitionerItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )         ] )       ] [
fhir:name [ fhir:v "item" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'familydoctor.organization')" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]         ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid3" ]           ] )         ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]           ] [
fhir:value [ fhir:v "uuid3" ]           ] )         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "FamilyDoctorOrganizationItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "FamilyDoctorPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorPractitionerGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorPractitionerZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorPractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "FamilyDoctorOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "familydoctorOrganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorOrganizationGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "familydoctorOrganizationZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'familydoctor.organization.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "AntecedentEpisodeOfCareInit" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "AntecedentEpisodeOfCareItems" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "episodeofcare" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "EpisodeOfCare" ]         ] )       ] [
fhir:context [ fhir:v "episodeofcare" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "episodeofcare" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "finished" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %episodeofcare.id" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "AntecedentEpisodeOfCareItems" ] ;
        ( fhir:variable [ fhir:v "src" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "episodeofcare" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "AntecedentEpisodeOfCareItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "episodeofcare" ] ;
fhir:type [ fhir:v "EpisodeOfCare" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "antecedentEpisodeOfCareRequestedPeriodStart" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.start') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "episodeofcare" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "statusHistory" ] ;
fhir:variable [ fhir:v "statusHistory" ]       ] [
fhir:context [ fhir:v "statusHistory" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "finished" ]         ] )       ] [
fhir:context [ fhir:v "statusHistory" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "period" ] ;
fhir:variable [ fhir:v "period" ]       ] [
fhir:context [ fhir:v "period" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "start" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "period" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "antecedentEpisodeOfCareEndNotSameAsStart" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "iteme" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.end') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "period" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%iteme.answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "antecedentEpisodeOfCareManagingOrganization" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'antecedentEpisodeOfCare.managingOrganization')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]         ] )       ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "episodeofcare" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patient" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %tgt.id" ]         ] )       ] [
fhir:context [ fhir:v "episodeofcare" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "managingOrganization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "AntecedentEpisodeOfCareOrganizationItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "AntecedentEpisodeOfCareOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "antecedentEpisodeOfCareorganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InitiatorInit" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "receiver" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "InitiatorItems" ] ;
        ( fhir:variable [ fhir:v "src" ] [ fhir:v "bundle" ] [ fhir:v "patient" ] [ fhir:v "ext" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "PatientItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "grpfamily" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ] ;
fhir:condition [ fhir:v "linkId = 'familydoctor'" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "FamilyDoctorInit" ] ;
        ( fhir:variable [ fhir:v "grp" ] [ fhir:v "bundle" ] [ fhir:v "tgt" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "PatientItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "bundle" ] [ fhir:v "tgt" ] [ fhir:v "composition" ] [ fhir:v "serviceRequest" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "patientName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.maidenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "use" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "maiden" ]         ] )       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "patientName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "PatientLocalPid" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.localPid') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "localpid" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v2-0203" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "MR" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "PatientLocalPidDomain" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.localPidDomain') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "localpid" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.birthDate') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "birthDate" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.gender') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "gender" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value.code" ]         ] )       ] )     ] [
fhir:name [ fhir:v "patientMaritalStatus" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.maritalStatus') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "answer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "maritalStatus" ] ;
          ( fhir:source [
fhir:context [ fhir:v "answer" ] ;
fhir:type [ fhir:v "Coding" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "coding" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "maritalStatus" ] ;
fhir:variable [ fhir:v "maritalStatus" ]           ] [
fhir:context [ fhir:v "maritalStatus" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "coding" ]             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "PatientPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.phone') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "PatientPhone" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "phone" ]           ] )         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "PatientEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "PatientStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "PatientPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "PatientCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "PatientCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "PatientLanguageOfCorrespondence" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.languageOfCorrespondence') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "answer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "languageOfCorrespondence" ] ;
          ( fhir:source [
fhir:context [ fhir:v "answer" ] ;
fhir:type [ fhir:v "Coding" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "coding" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "communication" ] ;
fhir:variable [ fhir:v "communication" ]           ] [
fhir:context [ fhir:v "communication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "preferred" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "true"^^xsd:boolean ]             ] )           ] [
fhir:context [ fhir:v "communication" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "language" ] ;
fhir:variable [ fhir:v "language" ]           ] [
fhir:context [ fhir:v "language" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "coding" ]             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "contact" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'patient.contactperson')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contact" ] ;
fhir:variable [ fhir:v "contact" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.contactperson.familyName') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "contact" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
          ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "contactName" ]         ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "item" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.contactperson.givenName') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "contact" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
          ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "contactName" ]         ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "PatientContactpersonPhone" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.contactperson.phone') and answer.exists())" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "PatientPhone" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]           ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "phone" ]             ] )           ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "PatientEmail" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.contactperson.email') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "contact" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "email" ]           ] )         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "PatientContactpersonRelationship" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'patient.contactperson.relationship') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "contact" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "relationship" ] ;
fhir:variable [ fhir:v "relationship" ]         ] [
fhir:context [ fhir:v "relationship" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "RequestedEncounterItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "RequestedEncounterItems" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "encounter" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Encounter" ]         ] )       ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "planned" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "requestedEncounterClass" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'requestedEncounter.class') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "class" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "requestedEncounterDesiredAccommodation" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'requestedEncounter.desiredAccommodation') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]         ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation" ]           ] )         ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Coverage" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "coverageBeneficiary" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.beneficiary')" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageBeneficiaryAhvn13" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.beneficiary.ahvn13') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.32" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coveragekvg" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.kvg')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "1" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageKvgName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.kvg.name') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "coverageKvgInsuranceCardNumber" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.kvg.insuranceCardNumber') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typeid" ]         ] [
fhir:context [ fhir:v "typeid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "VeKa" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coverageuvg" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.uvg')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageUvgName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.uvg.name') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "coverageUvgClaimNumber" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.uvg.claimNumber') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typeid" ]         ] [
fhir:context [ fhir:v "typeid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Claim" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coveragevvg" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.vvg')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ZV" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageVvgName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.vvg.name') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "coverageVvgInsuranceCardNumber" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.vvg.insuranceCardNumber') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typeid" ]         ] [
fhir:context [ fhir:v "typeid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "VeKa" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coverageiv" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.iv')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "2" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageivverfuegungsnummer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.iv.verfuegungsnummer') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typeid" ]         ] [
fhir:context [ fhir:v "typeid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "IV" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "IV" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coveragemv" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.mv')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "3" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coveragemvversichertennummer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.mv.versichertennummer') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "typeid" ]         ] [
fhir:context [ fhir:v "typeid" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "MV" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "MV" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "self" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.self')" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "payor" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.patient') and answer.exists() and answer.value)" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]           ] )         ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]         ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "active" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]         ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "5" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "subject" ]         ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]           ] )         ] )       ] [
fhir:name [ fhir:v "coverageselfpatientrelated" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item2" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.patientRelatedPerson') and answer.exists() and answer.value)" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "coverageselfrelatedPerson" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'coverage.self.relatedPerson')" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]             ] )           ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]           ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "active" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]             ] )           ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]           ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]           ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]             ] )           ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "5" ]             ] )           ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e6" ]           ] [
fhir:context [ fhir:v "e6" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "relatedPerson" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "RelatedPerson" ]             ] )           ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid6" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e6" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]             ] [
fhir:value [ fhir:v "uuid6" ]             ] )           ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "subject" ]           ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %relatedPerson.id" ]             ] )           ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patient" ] ;
fhir:variable [ fhir:v "reference" ]           ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]             ] )           ] ) ;
          ( fhir:dependent [
fhir:name [ fhir:v "CoverageRelatedPersonItems" ] ;
            ( fhir:variable [ fhir:v "item" ] [ fhir:v "relatedPerson" ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coveragevvg" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "where(linkId.value = 'coverage.other')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "coverage" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coverage" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "insurance" ] ;
fhir:variable [ fhir:v "insurance" ]       ] [
fhir:context [ fhir:v "insurance" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "beneficiary" ] ;
fhir:variable [ fhir:v "subject" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]       ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/CodeSystem/bfs-medstats-25-mainguarantor" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "8" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageOtherName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.other.name') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "payor" ] ;
fhir:variable [ fhir:v "payor" ]         ] [
fhir:context [ fhir:v "payor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:variable [ fhir:v "refcontained" ]         ] [
fhir:context [ fhir:v "refcontained" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "#org" ]           ] )         ] [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "org" ]           ] )         ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "coverageOtherId" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.other.id') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "coverage" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "CoverageRelatedPersonItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "relatedPerson" ] ;
fhir:type [ fhir:v "RelatedPerson" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Phone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.phone') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageSelfRelatedPersonPhone" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "phone" ]           ] )         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coverageSelfRelatedPersonEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "coverageSelfRelatedPersonStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "coverageSelfRelatedPersonPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "coverageSelfRelatedPersonCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "coverageSelfRelatedPersonCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'coverage.self.relatedPerson.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderAuthorPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderAuthorOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationGln" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.gln') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.51.1.3" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationZsr" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.zsr') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:oid:2.16.756.5.30.1.123.100.2.1.1" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "senderAuthorOrganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.author.organization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderAuthorItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'sender.author.practitioner')" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "SenderAuthorPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'sender.author.organization')" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "SenderAuthorOrganizationItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderDataEntererPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.dataenterer.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.dataenterer.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.dataenterer.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "senderAuthorPractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'sender.dataenterer.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderDataEntererItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'sender.dataenterer.practitioner')" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "SenderDataEntererPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ChExtEprDataEnterer" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer" ]         ] )       ] )     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "enterer" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %practitionerRole.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "SenderAuthorInit" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "sender" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRole" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]         ] )       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitioner" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]         ] )       ] [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]         ] )       ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "author" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "requester" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "senderAuthor" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'sender.author')" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "SenderAuthorItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRole" ] [ fhir:v "practitioner" ] [ fhir:v "organization" ] )         ] )       ] [
fhir:name [ fhir:v "senderDataenterer" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'sender.dataenterer')" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "senderDataentererItems" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]           ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]             ] )           ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]             ] [
fhir:value [ fhir:v "uuid4" ]             ] )           ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]           ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerDataEnterer" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]             ] )           ] [
fhir:context [ fhir:v "practitionerDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]             ] [
fhir:value [ fhir:v "uuid5" ]             ] )           ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]             ] )           ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]             ] [
fhir:value [ fhir:v "uuid5" ]             ] )           ] [
fhir:context [ fhir:v "practitionerRoleDataEnterer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]             ] )           ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]             ] [
fhir:value [ fhir:v "uuid3" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ]             ] ) ;
            ( fhir:dependent [
fhir:name [ fhir:v "SenderDataEntererItems" ] ;
              ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "practitionerDataEnterer" ] [ fhir:v "organization" ] )             ] )           ] [
fhir:name [ fhir:v "extension" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ]             ] ) ;
            ( fhir:dependent [
fhir:name [ fhir:v "ChExtEprDataEnterer" ] ;
              ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerRoleDataEnterer" ] [ fhir:v "extension" ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverCopyRelatedPersonItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "relatedPerson" ] ;
fhir:type [ fhir:v "RelatedPerson" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "name" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Phone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.phone') and answer.exists())" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "receiverCopyRelatedPersonPhone" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "phone" ]           ] )         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyRelatedPersonEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "receiverCopyRelatedPersonStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyRelatedPersonPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyRelatedPersonCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyRelatedPersonCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.relatedPerson.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverCopyPractitionerItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "practitioner" ] ;
fhir:type [ fhir:v "Practitioner" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRolePractitionerTitle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.practitioner.title') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "practitionerName" ]       ] [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "prefix" ] ;
fhir:variable [ fhir:v "prefix" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] [
fhir:context [ fhir:v "prefix" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier" ]         ] )       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "code" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "AC" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRolePractitionerPhone" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.practitioner.phone') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "phone" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRolePractitionerEmail" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.practitioner.email') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "email" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverCopyOrganizationItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "organization" ] ;
fhir:type [ fhir:v "Organization" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.organization.name') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "itemAnswer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "receiverCopyPractitionerRoleOrganizationStreetAddressLine" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRoleOrganizationPostalCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.organization.postalCode') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRoleOrganizationCity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.organization.city') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPractitionerRoleOrganizationCountry" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'receiverCopy.practitionerRole.organization.country') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
        ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]       ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverCopyPractitionerRoleItems" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "practitionerRole" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'receiverCopy.practitionerRole.practitioner')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitioner" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Practitioner" ]         ] )       ] [
fhir:context [ fhir:v "practitioner" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "practitioner" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverCopyPractitionerItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitioner" ] )       ] )     ] [
fhir:name [ fhir:v "item" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'receiverCopy.practitionerRole.organization')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e3" ]       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "organization" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Organization" ]         ] )       ] [
fhir:context [ fhir:v "organization" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid3" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "practitionerRole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "organization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] [
fhir:context [ fhir:v "e3" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid3" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ReceiverCopyOrganizationItems" ] ;
        ( fhir:variable [ fhir:v "item" ] [ fhir:v "organization" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ExtOrfCopyReceiverPatient" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver" ]         ] )       ] )     ] [
fhir:name [ fhir:v "patient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ExtOrfCopyReceiverPractitionerRole" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "res" ] ;
fhir:type [ fhir:v "PractitionerRole" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver" ]         ] )       ] )     ] [
fhir:name [ fhir:v "organization" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %res.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ExtOrfCopyReceiverRelatedPerson" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "res" ] ;
fhir:type [ fhir:v "RelatedPerson" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver" ]         ] )       ] )     ] [
fhir:name [ fhir:v "organization" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %res.id" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ReceiverCopy" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "grp" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "receiverCopyPractitionerRole1" ] ;
      ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId = 'receiverCopy.practitionerRole')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "practitionerrole" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PractitionerRole" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "practitionerrole" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ReceiverCopyPractitionerRoleItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "bundle" ] [ fhir:v "practitionerrole" ] )         ] )       ] [
fhir:name [ fhir:v "extension" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ExtOrfCopyReceiverPractitionerRole" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "practitionerrole" ] [ fhir:v "extension" ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyPatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId = 'receiverCopy.patient')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "extension" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ExtOrfCopyReceiverPatient" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "patient" ] [ fhir:v "extension" ] )         ] )       ] )     ] [
fhir:name [ fhir:v "receiverCopyRelatedPerson" ] ;
      ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId = 'receiverCopy.relatedPerson')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "relatedPerson" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "RelatedPerson" ]         ] )       ] [
fhir:context [ fhir:v "composition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "relatedPerson" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patient" ] ;
fhir:variable [ fhir:v "reference" ]       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ReceiverCopyRelatedPersonItems" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "relatedPerson" ] )         ] )       ] [
fhir:name [ fhir:v "extension" ] ;
        ( fhir:source [
fhir:context [ fhir:v "item" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ExtOrfCopyReceiverRelatedPerson" ] ;
          ( fhir:variable [ fhir:v "item" ] [ fhir:v "relatedPerson" ] [ fhir:v "extension" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Appointment" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "grp" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "Appointment" ] ;
      ( fhir:source [
fhir:context [ fhir:v "grp" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e4" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "appointment" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Appointment" ]         ] )       ] [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid4" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e4" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid4" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "proposed" ] ;
        ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.status') and (answer.value.code = 'proposed'))" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value.code" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "appointmentRequestedPeriod" ] ;
          ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "itemp" ] ;
fhir:condition [ fhir:v "(linkId.value = 'appointment.requestedPeriod')" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "appointmentRequestedPeriodStart" ] ;
            ( fhir:source [
fhir:context [ fhir:v "itemp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item2" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "requestedPeriod" ] ;
fhir:variable [ fhir:v "requestedPeriod" ]             ] [
fhir:context [ fhir:v "requestedPeriod" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "start" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item2.answer.value" ]               ] )             ] [
fhir:context [ fhir:v "requestedPeriod" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item2.answer.value" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "appointmentRequestedPeriodendifnotsameasstart" ] ;
              ( fhir:source [
fhir:context [ fhir:v "itemp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "requestedPeriod" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]                 ] )               ] )             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "pendingorbooked" ] ;
        ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.status') and ((answer.value.code = 'pending') or (answer.value.code = 'booked')))" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value.code" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "appointmentStartend" ] ;
          ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "itemp" ] ;
fhir:condition [ fhir:v "(linkId.value = 'appointment.requestedPeriod')" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "appointmentStart" ] ;
            ( fhir:source [
fhir:context [ fhir:v "itemp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item2" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "start" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item2.answer.value" ]               ] )             ] [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item2.answer.value" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "appointmentendifnotsameasstart" ] ;
              ( fhir:source [
fhir:context [ fhir:v "itemp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "end" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]                 ] )               ] )             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "appointmentPatientInstruction" ] ;
        ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.patientInstruction') and answer.exists())" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "patientInstruction" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]           ] )         ] )       ] [
fhir:name [ fhir:v "appointmentLocation" ] ;
        ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "(linkId.value = 'appointment.location')" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "location" ] ;
          ( fhir:source [
fhir:context [ fhir:v "item" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e5" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "location" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Location" ]             ] )           ] [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid5" ] ;
fhir:transform [ fhir:v "uuid" ]           ] [
fhir:context [ fhir:v "e5" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %uuid5" ]             ] )           ] [
fhir:context [ fhir:v "appointment" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "participant" ] ;
fhir:variable [ fhir:v "participant" ]           ] [
fhir:context [ fhir:v "participant" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "tentative" ]             ] )           ] [
fhir:context [ fhir:v "participant" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "actor" ] ;
fhir:variable [ fhir:v "actor" ] ;
fhir:transform [ fhir:v "create" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]             ] )           ] [
fhir:context [ fhir:v "actor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %location.id" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "item" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.name') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentLocationPhone" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.phone') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]             ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "phone" ]               ] )             ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentLocationEmail" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.email') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "telecom" ] ;
fhir:variable [ fhir:v "value" ]             ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "email" ]               ] )             ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentLocationStreetAddressLine" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.streetAddressLine') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
              ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "line" ] ;
              ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "answer" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "line" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "%answer.value" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentLocationPostalCode" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.postalCode') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
              ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]             ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "postalCode" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentlocationCity" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.city') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
              ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]             ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "city" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] [
fhir:name [ fhir:v "appointmentLocationCountry" ] ;
            ( fhir:source [
fhir:context [ fhir:v "item" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item3" ] ;
fhir:condition [ fhir:v "((linkId.value = 'appointment.location.country') and answer.exists())" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "location" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "address" ] ;
fhir:variable [ fhir:v "address" ] ;
              ( fhir:listMode [ fhir:v "share" ] ) ;
fhir:listRuleId [ fhir:v "orgAddress" ]             ] [
fhir:context [ fhir:v "address" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "country" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "%item3.answer.value" ]               ] )             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Note" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "grp" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "serviceRequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "noteText" ] ;
      ( fhir:source [
fhir:context [ fhir:v "grp" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "item" ] ;
fhir:condition [ fhir:v "((linkId = 'note.text') and answer.exists())" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "serviceRequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "note" ] ;
fhir:variable [ fhir:v "note" ]       ] [
fhir:context [ fhir:v "note" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%item.answer.value" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "QrToBundle" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "qr" ] ;
fhir:type [ fhir:v "QuestionnaireResponseSource" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "questionnaireresp" ] ;
fhir:type [ fhir:v "QuestionnaireResponse" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "servicerequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "composition" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "id" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:transform [ fhir:v "uuid" ]       ] )     ] [
fhir:name [ fhir:v "type" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "document" ]         ] )       ] )     ] [
fhir:name [ fhir:v "composition" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "OrfComposition" ] ;
        ( fhir:variable [ fhir:v "qr" ] [ fhir:v "composition" ] [ fhir:v "patient" ] [ fhir:v "questionnaireresp" ] [ fhir:v "servicerequest" ] [ fhir:v "bundle" ] )       ] )     ] [
fhir:name [ fhir:v "qrgroups" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "QrToGroups" ] ;
        ( fhir:variable [ fhir:v "qr" ] [ fhir:v "patient" ] [ fhir:v "bundle" ] [ fhir:v "composition" ] [ fhir:v "servicerequest" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "OrfComposition" ] ;
fhir:typeMode [ fhir:v "none" ] ;
fhir:documentation [ fhir:v "group OrfComposition(source qr : QuestionnaireResponseSource, target q: Questionnaire, target tgt : Composition, target patient: Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target bundle : Bundle) {" ] ;
    ( fhir:input [
fhir:name [ fhir:v "qr" ] ;
fhir:type [ fhir:v "QuestionnaireResponseSource" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "tgt" ] ;
fhir:type [ fhir:v "Composition" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "questionnaireresp" ] ;
fhir:type [ fhir:v "QuestionnaireResponse" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "servicerequest" ] ;
fhir:type [ fhir:v "ServiceRequest" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "status" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "final" ]         ] )       ] )     ] [
fhir:name [ fhir:v "subject" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] )     ] [
fhir:name [ fhir:v "sections" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "tgt" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "section" ] ;
fhir:variable [ fhir:v "tgtSection" ]       ] [
fhir:context [ fhir:v "tgtSection" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "title" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Order-Referral" ]         ] )       ] [
fhir:context [ fhir:v "tgtSection" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]       ] [
fhir:context [ fhir:v "code" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://loinc.org" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "93037-0" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Portable medical order form" ]         ] )       ] [
fhir:context [ fhir:v "tgtSection" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %questionnaireresp.id" ]         ] )       ] [
fhir:context [ fhir:v "tgtSection" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %servicerequest.id" ]         ] )       ] )     ] [
fhir:name [ fhir:v "servicerequest" ] ;
      ( fhir:source [
fhir:context [ fhir:v "qr" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "servicerequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "active" ]         ] )       ] [
fhir:context [ fhir:v "servicerequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "intent" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "order" ]         ] )       ] [
fhir:context [ fhir:v "servicerequest" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %patient.id" ]         ] )       ] )     ] )
  ] ) . #