CH ORF (R4)
2.0.0-ballot - ballot Switzerland flag

This page is part of the CH ORF (R4) (v2.0.0-ballot: STU 2 Ballot 1) based on FHIR 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 - JSON Representation

Draft as of 2023-06-29

Raw json | Download


{
  "resourceType" : "StructureMap",
  "id" : "OrfQrToBundle",
  "text" : {
    "status" : "additional",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n      <pre>map &quot;http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle&quot; = &quot;OrfQrToBundle&quot;\n\n//\n// ORF QuestionnaireResponse to Bundle\n// 2021-01-11 Oliver Egger, copyright ahdis ag, Apache License \n// QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html\n// QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html\n// Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html\n\nuses &quot;http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse&quot; alias QuestionnaireResponse as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/BackboneElement&quot; alias BackboneElement as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Composition&quot; alias Composition as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/RelatedPerson&quot; alias RelatedPerson as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/PractitionerRole&quot; alias PractitionerRole as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/ServiceRequest&quot; alias ServiceRequest as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Extension&quot; alias Extension as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/EpisodeOfCare&quot; alias EpisodeOfCare as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse&quot; alias QuestionnaireResponseTarget as target\n\ngroup OrfQrToBundle(source qr : QuestionnaireResponse, target bundle : Bundle ) {\n      qr -&gt; bundle.identifier as documentIdentifier, documentIdentifier.system = 'urn:ietf:rfc:3986',  uuid() as uuidDoc, documentIdentifier.value = append('urn:uuid:', uuidDoc) &quot;documentIdentifier&quot;;\n      qr as qrcp -&gt; bundle.entry as e, \n             e.resource = create('Composition') as composition, \n             composition.id = uuid() as uuid,\n             e.fullUrl = append('urn:uuid:',uuid),\n             bundle.entry as e2, \n             bundle.timestamp = (now()) as timestamp,\n             composition.date = timestamp,\n             composition.title = 'Order and Referral by Form',\n             composition.type as type, type.coding as coding, coding.code = '419891008', coding.system = 'http://snomed.info/sct',\n             composition.category as category, category.coding as coding, coding.code = '721963009', coding.system = 'http://snomed.info/sct',\n             e2.resource = create('Patient') as patient,\n             patient.id = uuid() as uuid2,\n             e2.fullUrl = append('urn:uuid:',uuid2),\n             bundle.entry as e4, \n             e4.resource = qrcp as questionnaireresp,\n             questionnaireresp.id = uuid() as uuid4,\n             e4.fullUrl = append('urn:uuid:',uuid4),\n             bundle.entry as e5, \n             e5.resource = create('ServiceRequest') as servicerequest, \n             servicerequest.id = uuid() as uuid5,\n             e5.fullUrl = append('urn:uuid:',uuid5) then {\n               qr.questionnaire as can -&gt; bundle.entry as e6, e6.resource = (can.resolve()) as q, q.id = uuid() as uuid6, e6.fullUrl = append('urn:uuid:',uuid6) then QrToBundle(qr, q, patient, questionnaireresp, servicerequest, composition, bundle) &quot;orfbundle&quot;;\n             } &quot;orfbundle&quot;;\n}\n\ngroup QrToGroups(source qr : QuestionnaireResponse, target patient : Patient, target bundle: Bundle, target composition : Composition, target serviceRequest: ServiceRequest) {\n    qr.item as grp where linkId='order' then OrderItems(grp, bundle, composition, serviceRequest) &quot;grporder&quot;;\n    qr.item as grp where linkId='receiver' then ReceiverInit(grp, bundle, composition, serviceRequest) &quot;receiver&quot;;\n    qr.item as grp where linkId='initiator' then InitiatorInit(grp, bundle, patient, composition, serviceRequest) &quot;grpinitiator&quot;;\n    qr.item as grp where linkId='patient' then PatientItems(grp, bundle, patient, composition, serviceRequest) &quot;grppatient&quot;;\n    qr.item as grp where linkId='requestedEncounter' then RequestedEncounterItems(grp, bundle, patient, serviceRequest) &quot;grprequestedencounter&quot;;\n    qr.item as grp where linkId='coverage' then Coverage(grp, bundle, patient, serviceRequest) &quot;grprequestedencounter&quot;;\n    qr.item as grp where linkId='sender' then SenderAuthorInit(grp, bundle, composition, serviceRequest) &quot;grpsender&quot;;\n    qr.item as grp where linkId='receiverCopy' then ReceiverCopy(grp, bundle, patient, composition, serviceRequest) &quot;receiverCopy&quot;;\n    qr.item as grp where linkId='appointment' then Appointment(grp, bundle, composition, serviceRequest) &quot;appointment&quot;;\n    qr.item as grp where linkId='previousResults' then PreviousResults(grp, bundle, serviceRequest) &quot;previousResults&quot;;\n    qr.item as grp where linkId='antecedentEpisodeOfCare' then AntecedentEpisodeOfCareInit(grp, bundle, patient, composition) &quot;AntecedentEpisodeOfCareInit&quot;;\n    qr.item as grp where linkId='consent' then Consent(grp, bundle, composition) &quot;consent&quot;;\n    qr.item as grp where linkId='note' then Note(grp, serviceRequest) &quot;note&quot;;\n}\n\ngroup OrderItems(source src : BackboneElement, target bundle: Bundle, target composition, target serviceRequest : ServiceRequest) {\n\n  src.item as item where (linkId.value = 'order.precedentDocumentIdentifier' and answer.exists())   -&gt; composition.extension as ext, ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument',\n                                                                        ext.value = create('Identifier') as value, value.system='urn:ietf:rfc:3986', value.value=('urn:uuid:'+item.answer.valueString) &quot;order.precedentDocumentIdentifier&quot;; \n\n  src.item as item where (linkId.value = 'order.placerOrderIdentifier' and answer.exists()) -&gt; serviceRequest.identifier as value share placer, \n                                                                                   value.type as type, type.coding as coding,\n                                                                                   coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',\n                                                                                   coding.code = 'PLAC',\n                                                                                   value.value=(item.answer.valueString) &quot;order.placerOrderIdentifier&quot;; \n  src.item as item where (linkId.value = 'order.placerOrderIdentifierDomain' and answer.exists()) -&gt; serviceRequest.identifier as value share placer, \n                                                                                   value.system=(item.answer.valueString) &quot;order.placerOrderIdentifierDomain&quot;; \n  src.item as item where (linkId.value = 'order.fillerOrderIdentifier' and answer.exists()) -&gt; serviceRequest.identifier as value share filler, \n                                                                                   value.type as type, type.coding as coding,\n                                                                                   coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',\n                                                                                   coding.code = 'FILL',\n                                                                                   value.value=(item.answer.valueString) &quot;order.fillerOrderIdentifier&quot;; \n  src.item as item where (linkId.value = 'order.fillerOrderIdentifierDomain' and answer.exists()) -&gt; serviceRequest.identifier as value share filler, \n                                                                                   value.system=(item.answer.valueString) &quot;order.fillerOrderIdentifierDomain&quot;; \n\n  src.item as item where (linkId.value = 'order.dateTime' and answer.exists()) -&gt; serviceRequest.authoredOn = (item.answer.value);\n\n  src.item as item where (linkId.value = 'order.priority' and answer.exists()) -&gt; serviceRequest.priority = (item.answer.value.code);\n\n  src.item as item where (linkId.value = 'order.notificationContactDocument') then {\n      item -&gt; bundle.entry as e4, \n               e4.resource = create('PractitionerRole') as practitionerRoleDataEnterer, \n               practitionerRoleDataEnterer.id = uuid() as uuid4,\n               e4.fullUrl = append('urn:uuid:',uuid4),\n               composition.extension as extension,\n               bundle.entry as e5, \n               e5.resource = create('Practitioner') as practitionerDataEnterer, \n               practitionerDataEnterer.id = uuid() as uuid5,\n               e5.fullUrl = append('urn:uuid:',uuid5),\n               practitionerRoleDataEnterer.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid5)\n//   ,\n// FIXME not known here               practitionerRoleDataEnterer.organization = create('Reference') as reference, reference.type='Organization', reference.reference = append('urn:uuid:',uuid3) \n               then {\n                     item then UrgentNotificationContactForRequestItems(item, practitionerRoleDataEnterer, practitionerDataEnterer) &quot;data&quot;;\n                     item then ExtOrfUrgentNotificationContactForRequest(item, practitionerRoleDataEnterer, extension) &quot;extension&quot;;\n                  } &quot;order.notificationContactDocument.items&quot;;\n      } &quot;order.notificationContactDocument&quot;;\n   \n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse') then {\n      item -&gt; bundle.entry as e4, \n               e4.resource = create('PractitionerRole') as practitionerRoleDataEnterer, \n               practitionerRoleDataEnterer.id = uuid() as uuid4,\n               e4.fullUrl = append('urn:uuid:',uuid4),\n               composition.extension as extension,\n               bundle.entry as e5, \n               e5.resource = create('Practitioner') as practitionerDataEnterer, \n               practitionerDataEnterer.id = uuid() as uuid5,\n               e5.fullUrl = append('urn:uuid:',uuid5),\n               practitionerRoleDataEnterer.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid5)\n// ,\n// FIXME not known here practitionerRoleDataEnterer.organization = create('Reference') as reference, reference.type='Organization', reference.reference = append('urn:uuid:',uuid3) \n               then {\n                     item then UrgentNotificationContactForResponseItems(item, practitionerRoleDataEnterer, practitionerDataEnterer) &quot;data&quot;;\n                     item then ExtOrfUrgentNotificationContactForResponse(item, practitionerRoleDataEnterer, extension) &quot;extension&quot;;\n                  } &quot;order.notificationContactDocumentResponse.items&quot;;\n      } &quot;order.notificationContactDocumentResponse&quot;;\n}\n\ngroup UrgentNotificationContactForRequestPractitionerItems(source src : BackboneElement, target practitioner: Practitioner) {\n   src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;sender.author.practitioner.title&quot;; \n     src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.email&quot;; \n}\n\ngroup UrgentNotificationContactForRequestItems(source src : BackboneElement, target practitionerRole: practitionerRole, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'order.notificationContactDocument.practitioner') then UrgentNotificationContactForRequestPractitionerItems(item, practitioner);\n}\n\ngroup ExtOrfUrgentNotificationContactForRequest(source src: BackboneElement, target practitionerRole: PractitionerRole, target ext: Extension) {\n  src -&gt; ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument' &quot;url&quot;;\n  src -&gt; ext.value = create('Reference') as reference, \n                reference.reference = ('urn:uuid:'+%practitionerRole.id) &quot;practitionerRole&quot;;\n}\n\ngroup UrgentNotificationContactForResponsePractitionerItems(source src : BackboneElement, target practitioner: Practitioner) {\n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;sender.author.practitioner.title&quot;; \n     src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.email&quot;; \n}\n\ngroup UrgentNotificationContactForResponseItems(source src : BackboneElement, target practitionerRole: practitionerRole, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'order.notificationContactDocumentResponse.practitioner') then UrgentNotificationContactForResponsePractitionerItems(item, practitioner);\n}\n\ngroup ExtOrfUrgentNotificationContactForResponse(source src: BackboneElement, target practitionerRole: PractitionerRole, target ext: Extension) {\n  src -&gt; ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument' &quot;url&quot;;\n  src -&gt; ext.value = create('Reference') as reference, \n                 reference.reference = ('urn:uuid:'+%practitionerRole.id) &quot;practitionerRole&quot;;\n}\n\n\ngroup ReceiverPractitionerItems(source src : BackboneElement, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'receiver.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'receiver.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'receiver.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;receiver.practitioner.title&quot;; \n   src.item as item where (linkId.value = 'receiver.practitioner.gln' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.gln&quot;; \n   src.item as item where (linkId.value = 'receiver.practitioner.zsr' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.zsr&quot;; \n   src.item as item where (linkId.value = 'receiver.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'receiver.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.email&quot;; \n}\n\ngroup ReceiverOrganizationItems(source src : BackboneElement, target organization : Organization) {\n   src.item as item where (linkId.value = 'receiver.organization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'receiver.organization.gln' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;receiver.organization.gln&quot;;\n   src.item as item where (linkId.value = 'receiver.organization.zsr' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;receiver.organization.zsr&quot;; \n   src.item as item where (linkId.value = 'receiver.organization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;receiver.organization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'receiver.organization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;receiver.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'receiver.organization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;receiver.organization.city&quot;;\n   src.item as item where (linkId.value = 'receiver.organization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;receiver.organization.country&quot;;\n}\n\ngroup ReceiverItems(source src : BackboneElement, target bundle: Bundle, target practitionerRole: practitionerRole) {\n   src.item as item where (linkId.value = 'receiver.practitioner') -&gt; \n      bundle.entry as e2, \n      e2.resource = create('Practitioner') as practitioner, \n      practitioner.id = uuid() as uuid2,\n      practitionerRole.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid2),\n      e2.fullUrl = append('urn:uuid:',uuid2) then ReceiverPractitionerItems(item, practitioner);\n   src.item as item where (linkId.value = 'receiver.organization') -&gt;\n     bundle.entry as e3, \n     e3.resource = create('Organization') as organization, \n     organization.id = uuid() as uuid3,\n     practitionerRole.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3), \n     e3.fullUrl = append('urn:uuid:',uuid3) then ReceiverOrganizationItems(item, organization);\n}\n\ngroup Consent(source src : BackboneElement, target bundle: Bundle, target composition : Composition) {\n   src.item as item where (linkId.value = 'consent.statement' and answer.exists()) -&gt; bundle.entry as e, \n          e.resource = create('Consent') as consent,\n          consent.status = 'active', \n          consent.scope as scope, scope.coding as coding, coding.code = 'treatment', coding.system= 'http://terminology.hl7.org/CodeSystem/consentscope',\n          consent.category as category, category.coding as coding, coding.code = '59284-0', coding.system= 'http://loinc.org',\n          consent.policyRule as policyRule, policyRule.coding as coding, coding.code = '385432009', coding.system= 'http://snomed.info/sct',\n          consent.id = uuid() as uuid,\n          e.fullUrl = append('urn:uuid:',uuid),\n          composition.extension as ext, \n          ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent',\n          ext.value = create('Reference') as reference, \n          consent.extension as extcode,\n          extcode.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode',\n          extcode.value = create('CodeableConcept') as cc, cc.coding = (item.answer.value),\n          reference.reference = append('urn:uuid:',uuid) then {\n            item.answer as answer then {\n               answer.item as item where (linkId.value = 'consent.statement.note' and answer.exists())\n               -&gt; consent.extension as extnote,\n                  extnote.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote',\n                  extnote.value = (item.answer.value) &quot;consent.statement.note&quot;;\n            } &quot;item.answer&quot;;\n          } &quot;consent.statement&quot;;\n}\n\ngroup ReceiverInit(source src : BackboneElement, target bundle: Bundle, target composition : Composition, target serviceRequest: ServiceRequest) {\n   src -&gt; bundle.entry as e, \n          e.resource = create('PractitionerRole') as practitionerRole, \n          practitionerRole.id = uuid() as uuid,\n          e.fullUrl = append('urn:uuid:',uuid),\n          composition.extension as ext, \n          ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver',\n          ext.value = create('Reference') as reference, \n          reference.reference = append('urn:uuid:',uuid) then\n          ReceiverItems(src, bundle, practitionerRole) &quot;receiver&quot;;\n}\n\ngroup InitiatorItems(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target ext: Extension) {\n   src.item as item where (linkId.value = 'initiator.personalrelation' and answer.exists()) -&gt; \n      ext.extension as extension, \n      extension.url = 'ch-orf-personalrelation', \n      extension.value = (item.answer.value) &quot;initiator.personalrelation&quot;;\n   src.item as item where (linkId.value = 'initiator.legalrelation' and answer.exists()) -&gt; \n      ext.extension as extension, \n      extension.url = 'ch-orf-legalrelation', \n      extension.value = (item.answer.value) &quot;initiator.legalrelation&quot;;\n   src.item as item where (linkId='initiator.practitionerRole') -&gt; bundle.entry as e4, \n      e4.resource = create('PractitionerRole') as practitionerrole, \n      ext.extension as extension,\n      practitionerrole.id = uuid() as uuid4,\n      extension.url = 'ch-orf-personorganization',\n      extension.value =  create('Reference') as reference, \n      reference.reference = append('urn:uuid:',uuid4),\n      e4.fullUrl = append('urn:uuid:',uuid4) then {\n         item then InitiatorPractitionerRoleItems(item, bundle, practitionerrole) &quot;data&quot;;\n      } &quot;InitiatorPractitionerRoleItems&quot;;\n   src.item as item where (linkId='initiator.relatedPerson') -&gt; bundle.entry as e4, \n            e4.resource = create('RelatedPerson') as relatedPerson,\n            ext.extension as extension, \n            extension.url = 'ch-orf-personorganization',\n            extension.value =  create('Reference') as reference, \n            relatedPerson.id = uuid() as uuid4,\n            reference.reference = append('urn:uuid:',uuid4),\n            relatedPerson.patient as reference,\n            reference.reference = ('urn:uuid:'+%patient.id),\n            e4.fullUrl = append('urn:uuid:',uuid4) then {\n               item then InitiatorRelatedPersonItems(item, relatedPerson) &quot;data&quot;;\n            } &quot;initiator.relatedPerson&quot;;\n}\n\ngroup InitiatorRelatedPersonItems(source src : BackboneElement, target relatedPerson: RelatedPerson) {\n   src.item as item where (linkId.value = 'initiator.relatedPerson.familyName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'initiator.relatedPerson.givenName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'initiator.relatedPerson.phone' and answer.exists()) then {\n      item.answer as answer -&gt; relatedPerson.telecom as value, value.system = 'phone',\n                                value.value= (answer.value) &quot;initiator.relatedPerson.phone&quot;; \n   } &quot;phone&quot;;\n   src.item as item where (linkId.value = 'initiator.relatedPerson.email' and answer.exists()) -&gt; relatedPerson.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;initiator.relatedPerson.email&quot;; \n   src.item as item where (linkId.value = 'initiator.relatedPerson.streetAddressLine' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;initiator.relatedPerson.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'initiator.relatedPerson.postalCode' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;initiator.relatedPerson.postalCode&quot;;\n   src.item as item where (linkId.value = 'initiator.relatedPerson.city' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.city = (item.answer.value) &quot;initiator.relatedPerson.city&quot;;\n   src.item as item where (linkId.value = 'initiator.relatedPerson.country' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.country = (item.answer.value) &quot;initiator.relatedPerson.country&quot;;\n}\n\n\ngroup InitiatorPractitionerRoleItems(source src : BackboneElement, target bundle: Bundle, target practitionerRole: practitionerRole) {\n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner') -&gt; \n      bundle.entry as e2, \n      e2.resource = create('Practitioner') as practitioner, \n      practitioner.id = uuid() as uuid2,\n      practitionerRole.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid2),\n      e2.fullUrl = append('urn:uuid:',uuid2) then InitiatorPractitionerItems(item, practitioner);\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization') -&gt;\n     bundle.entry as e3, \n     e3.resource = create('Organization') as organization, \n     organization.id = uuid() as uuid3,\n     practitionerRole.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3), \n     e3.fullUrl = append('urn:uuid:',uuid3) then InitiatorOrganizationItems(item, organization);\n}\n\ngroup InitiatorPractitionerItems(source src : BackboneElement, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;initiator.practitionerRole.practitioner.title&quot;; \n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;initiator.practitionerRole.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;initiator.practitionerRole.practitioner.email&quot;; \n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.gln' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.gln&quot;; \n   src.item as item where (linkId.value = 'initiator.practitionerRole.practitioner.zsr' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;receiver.practitioner.zsr&quot;; \n}\n\ngroup InitiatorOrganizationItems(source src : BackboneElement, target organization : Organization) {\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;initiator.practitionerRole.organization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;initiator.practitionerRole.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;initiator.practitionerRole.organization.city&quot;;\n   src.item as item where (linkId.value = 'initiator.practitionerRole.organization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;initiator.practitionerRole.organization.country&quot;;\n}\n\ngroup FamilyDoctorInit(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target composition : Composition, target serviceRequest: ServiceRequest) {\n  src -&gt; bundle.entry as e4, \n  e4.resource = create('PractitionerRole') as practitionerRole,\n  practitionerRole.id = uuid() as uuid4,\n  patient.generalPractitioner = create('Reference') as gp, \n  gp.reference = append('urn:uuid:',uuid4),\n  e4.fullUrl = append('urn:uuid:',uuid4) then {\n     src.item as item where (linkId.value = 'familydoctor.practitioner') -&gt; \n     bundle.entry as e2, \n     e2.resource = create('Practitioner') as practitioner, \n    practitioner.id = uuid() as uuid2,\n     practitionerRole.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid2),\n     e2.fullUrl = append('urn:uuid:',uuid2) then FamilyDoctorPractitionerItems(item, practitioner);\n\n     src.item as item where (linkId.value = 'familydoctor.organization') -&gt;\n     bundle.entry as e3, \n     e3.resource = create('Organization') as organization, \n     organization.id = uuid() as uuid3,\n     practitionerRole.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3), \n     e3.fullUrl = append('urn:uuid:',uuid3) then FamilyDoctorOrganizationItems(item, organization);\n } &quot;FamilyDoctorInit&quot;;\n}\n\ngroup FamilyDoctorPractitionerItems(source src : BackboneElement, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'familydoctor.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'familydoctor.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'familydoctor.practitioner.gln' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;familydoctor.practitioner.gln&quot;; \n   src.item as item where (linkId.value = 'familydoctor.practitioner.zsr' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;familydoctor.practitioner.zsr&quot;; \n   src.item as item where (linkId.value = 'familydoctor.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;familydoctor.practitioner.title&quot;; \n   src.item as item where (linkId.value = 'familydoctor.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;familydoctor.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'familydoctor.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;familydoctor.practitioner.email&quot;; \n}\n\ngroup FamilyDoctorOrganizationItems(source src : BackboneElement, target organization : Organization) {\n   src.item as item where (linkId.value = 'familydoctor.organization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'familydoctor.organization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;familydoctor.organization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'familydoctor.organization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;familydoctor.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'familydoctor.organization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;familydoctor.organization.city&quot;;\n   src.item as item where (linkId.value = 'familydoctor.organization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;familydoctor.organization.country&quot;;\n   src.item as item where (linkId.value = 'familydoctor.organization.gln' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;familydoctor.organization.gln&quot;;\n   src.item as item where (linkId.value = 'familydoctor.organization.zsr' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;familydoctorr.organization.zsr&quot;; \n}\n\ngroup AntecedentEpisodeOfCareInit(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target composition : Composition) {\n   src -&gt; composition.extension as ext, \n          ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare',\n          bundle.entry as e4, \n          e4.resource = create('EpisodeOfCare') as episodeofcare, \n          episodeofcare.id = uuid() as uuid4,\n          e4.fullUrl = ('urn:uuid:'+%uuid4),\n          episodeofcare.status = 'finished',\n          ext.value = create('Reference') as ref, ref.reference = ('urn:uuid:'+%episodeofcare.id)\n          then AntecedentEpisodeOfCareItems(src, bundle, patient, episodeofcare) &quot;AntecedentEpisodeOfCareItems&quot;;\n}\n\ngroup AntecedentEpisodeOfCareItems(source src : BackboneElement, target bundle: Bundle, target tgt: Patient, target episodeofcare : EpisodeOfCare) {\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.start' and answer.exists()) -&gt; episodeofcare.statusHistory as statusHistory, statusHistory.status='finished', statusHistory.period as period, period.start = (item.answer.value), period.end = (item.answer.value) then {\n        src.item as iteme where (linkId.value = 'antecedentEpisodeOfCare.end' and answer.exists()) -&gt; period.end = (iteme.answer.value) &quot;antecedentEpisodeOfCareEndNotSameAsStart&quot;;\n   } &quot;antecedentEpisodeOfCare.requestedPeriod.start&quot;;\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization') -&gt; \n      bundle.entry as e3, \n          e3.resource = create('Organization') as organization, \n          organization.id = uuid() as uuid3,\n          e3.fullUrl = append('urn:uuid:',uuid3),\n          episodeofcare.patient = create('Reference') as reference, reference.reference = ('urn:uuid:'+%tgt.id),\n          episodeofcare.managingOrganization = create('Reference') as reference, \n          reference.reference = append('urn:uuid:',uuid3) then AntecedentEpisodeOfCareOrganizationItems(item, organization) &quot;antecedentEpisodeOfCare.managingOrganization&quot;;\n}\n\ngroup AntecedentEpisodeOfCareOrganizationItems(source src : BackboneElement, target organization : Organization) {\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n      item.answer as answer -&gt; address.line = (answer.value) &quot;antecedentEpisodeOfCareorganization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;sender.author.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;sender.author.organization.city&quot;;\n   src.item as item where (linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;sender.author.organization.country&quot;;\n}\n\ngroup InitiatorInit(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target composition : Composition, target serviceRequest: ServiceRequest) {\n   src -&gt; composition.extension as ext, \n          ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator'\n          then InitiatorItems(src, bundle, patient, ext) &quot;receiver&quot;;\n}\n\ngroup PatientItems(source src : BackboneElement, target bundle: Bundle, target tgt: Patient, target composition : Composition, target serviceRequest: ServiceRequest) {\n  src.item as grp where linkId='familydoctor' then FamilyDoctorInit(grp, bundle, tgt, composition, serviceRequest) &quot;grpfamily&quot;;\n\n  src.item as item then PatientItems(item, bundle, tgt, composition, serviceRequest);\n  src.item as item where (linkId.value = 'patient.familyName' and answer.exists()) -&gt; tgt.name as name share patientName,name.family = (item.answer.value);\n  src.item as item where (linkId.value = 'patient.maidenName' and answer.exists()) -&gt; tgt.name as name, name.use = 'maiden', name.family = (item.answer.value);\n  src.item as item where (linkId.value = 'patient.givenName' and answer.exists()) -&gt; tgt.name as name share patientName, name.given = (item.answer.value);\n  src.item as item where (linkId.value = 'patient.localPid' and answer.exists()) -&gt; tgt.identifier as value share localpid, \n                                                                                   value.type as type, type.coding as coding,\n                                                                                   coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',\n                                                                                   coding.code = 'MR',\n                                                                                   value.value=(item.answer.valueString) &quot;patient.localPid&quot;;\n  src.item as item where (linkId.value = 'patient.localPidDomain' and answer.exists()) -&gt; tgt.identifier as value share localpid, \n                                                                                   value.system=(item.answer.valueString) &quot;patient.localPidDomain&quot;; \n  src.item as item where (linkId.value = 'patient.birthDate' and answer.exists()) -&gt; tgt.birthDate = (item.answer.value);\n  src.item as item where (linkId.value = 'patient.gender' and answer.exists()) -&gt; tgt.gender = (item.answer.value.code);\n  src.item as item where (linkId.value = 'patient.maritalStatus' and answer.exists()) then {\n   item.answer as answer then {\n      answer.value: Coding as coding -&gt; tgt.maritalStatus as maritalStatus, maritalStatus.coding = coding &quot;maritalStatus&quot;; \n      } &quot;answer&quot;;\n  } &quot;patient.maritalStatus&quot;; \n  src.item as item where (linkId.value = 'patient.phone' and answer.exists()) then {\n   item.answer as answer -&gt; tgt.telecom as value, value.system = 'phone', value.value=(answer.value) &quot;patient.phone&quot;;  \n  } &quot;patient.phone&quot;;\n  src.item as item where (linkId.value = 'patient.email' and answer.exists()) -&gt; tgt.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;patient.email&quot;; \n  src.item as item where (linkId.value = 'patient.streetAddressLine' and answer.exists()) -&gt; tgt.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;patient.streetAddressLine&quot;;\n  } &quot;item.answer&quot;;\n  src.item as item where (linkId.value = 'patient.postalCode' and answer.exists()) -&gt; tgt.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;patient.postalCode&quot;;\n  src.item as item where (linkId.value = 'patient.city' and answer.exists()) -&gt; tgt.address as address share orgAddress, address.city = (item.answer.value) &quot;patient.city&quot;;\n  src.item as item where (linkId.value = 'patient.country' and answer.exists()) -&gt; tgt.address as address share orgAddress, address.country = (item.answer.value) &quot;patient.country&quot;;\n\n  src.item as item where (linkId.value = 'patient.languageOfCorrespondence' and answer.exists()) then {\n   item.answer as answer then {\n      answer.value: Coding as coding -&gt; tgt.communication as communication, communication.preferred = true, communication.language as language, language.coding = coding &quot;languageOfCorrespondence&quot;; \n      } &quot;answer&quot;;\n  } &quot;patient.languageOfCorrespondence&quot;; \n\n  src.item as item where (linkId.value = 'patient.contactperson') -&gt; tgt.contact as contact then {\n   item.item as item where (linkId.value = 'patient.contactperson.familyName' and answer.exists()) -&gt; contact.name as name share contactName,name.family = (item.answer.value);\n   item.item as item where (linkId.value = 'patient.contactperson.givenName' and answer.exists()) -&gt; contact.name as name share contactName, name.given = (item.answer.value);\n\n   src.item as item where (linkId.value = 'patient.contactperson.phone' and answer.exists()) then {\n      item.answer as answer -&gt; tgt.telecom as value, value.system = 'phone', value.value=(answer.value) &quot;patient.phone&quot;;  \n     } &quot;patient.contactperson.phone&quot;;\n   \n   item.item as item where (linkId.value = 'patient.contactperson.email' and answer.exists()) -&gt; contact.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;patient.email&quot;; \n   item.item as item where (linkId.value = 'patient.contactperson.relationship' and answer.exists()) -&gt; contact.relationship as relationship, \n                                                                                   relationship.text=(item.answer.value) &quot;patient.contactperson.relationship&quot;; \n  } &quot;contact&quot;;\n}\n\ngroup RequestedEncounterItems(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target serviceRequest : ServiceRequest) {\n  src -&gt; bundle.entry as e4, \n                e4.resource = create('Encounter') as encounter, \n                encounter.id = uuid() as uuid4,\n                e4.fullUrl = ('urn:uuid:'+%uuid4),\n                encounter.status = 'planned',\n                serviceRequest.extension as extension,\n                encounter.subject = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n                extension.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails',\n                extension.value = create('Reference') as reference, reference.reference = ('urn:uuid:'+%uuid4)                \n                then {\n                  src.item as item where (linkId.value = 'requestedEncounter.class' and answer.exists()) -&gt; \n                      encounter.class = (item.answer.value) &quot;requestedEncounter.class&quot;;\n                  src.item as item where (linkId.value = 'requestedEncounter.desiredAccommodation' and answer.exists()) -&gt; \n                      encounter.extension as extension,\n                      extension.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation', \n                      extension.value = (item.answer.value) &quot;requestedEncounter.desiredAccommodation&quot;;\n   } &quot;RequestedEncounterItems&quot;;\n }\n\n group Coverage(source src : BackboneElement, target bundle: Bundle, target patient: Patient, target serviceRequest : ServiceRequest) {\n// coverage.beneficiary\n// coverage.beneficiary.ahvn13\n     src.item as item where where (linkId.value = 'coverage.beneficiary') then {\n      item.item as item where (linkId.value = 'coverage.beneficiary.ahvn13' and answer.exists()) -&gt; \n         patient.identifier as identifier, identifier.system = 'urn:oid:2.16.756.5.32', identifier.value = (item.answer.value) &quot;coverage.beneficiary.ahvn13&quot;;\n     } &quot;coverage.beneficiary&quot;;\n\n//   coverage.kvg\t\n//   coverage.kvg.name\t \n//   coverage.kvg.insuranceCardNumber\t\n      src.item as item where where (linkId.value = 'coverage.kvg') -&gt; bundle.entry as e4, \n      e4.resource = create('Coverage') as coverage, \n      coverage.id = uuid() as uuid4,\n      e4.fullUrl = ('urn:uuid:'+%uuid4),\n      serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n      coverage.status = 'active',\n      coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n      coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'KVG' then {\n         item.item as item where (linkId.value = 'coverage.kvg.name' and answer.exists()) -&gt;\n           coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n           coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = (item.answer.value) &quot;coverage.kvg.name&quot;;\n         item.item as item where (linkId.value = 'coverage.kvg.insuranceCardNumber' and answer.exists()) -&gt;\n           coverage.identifier as identifier, identifier.type as typeid, typeid.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype', coding.code = 'VeKa', \n           identifier.value = (item.answer.value) &quot;coverage.kvg.insuranceCardNumber&quot;;\n      } &quot;coveragekvg&quot;;\n//   coverage.uvg\tUnfallversicherung (nach UVG)\t0..1\tgroup\t\tDefinition: Coverage.type\n//   coverage.uvg.name\tName der Versicherung\t0..1\tstring\t\tDefinition: Coverage.payor\n//   coverage.uvg.claimNumber\tSchadennummer\t0..1\tstring\t\tDefinition: Coverage.identifier\n   src.item as item where where (linkId.value = 'coverage.uvg') -&gt; bundle.entry as e4, \n      e4.resource = create('Coverage') as coverage, \n      coverage.id = uuid() as uuid4,\n      e4.fullUrl = ('urn:uuid:'+%uuid4),\n      serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n      coverage.status = 'active',\n      coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n      coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'UVG' then {\n         item.item as item where (linkId.value = 'coverage.uvg.name' and answer.exists()) -&gt;\n           coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n           coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = (item.answer.value) &quot;coverage.uvg.name&quot;;\n         item.item as item where (linkId.value = 'coverage.uvg.claimNumber' and answer.exists()) -&gt;\n           coverage.identifier as identifier, identifier.type as typeid, typeid.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype', coding.code = 'Claim', \n           identifier.value = (item.answer.value) &quot;coverage.uvg.claimNumber&quot;;\n      } &quot;coverageuvg&quot;;\n//  coverage.vvg\tZusatzversicherung (nach VVG)\t0..1\tgroup\t\tDefinition: Coverage.type\n//  coverage.vvg.name\tName der Versicherung\t0..1\tstring\t\tDefinition: Coverage.payor\n//  coverage.vvg.insuranceCardNumber\tKennnummer der Versichertenkarte\t0..1\tstring\t\tDefinition: Coverage.identifier\n src.item as item where where (linkId.value = 'coverage.vvg') -&gt; bundle.entry as e4, \n      e4.resource = create('Coverage') as coverage, \n      coverage.id = uuid() as uuid4,\n      e4.fullUrl = ('urn:uuid:'+%uuid4),\n      serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n      coverage.status = 'active',\n      coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n      coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'VVG' then {\n         item.item as item where (linkId.value = 'coverage.vvg.name' and answer.exists()) -&gt;\n           coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n           coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = (item.answer.value) &quot;coverage.vvg.name&quot;;\n         item.item as item where (linkId.value = 'coverage.vvg.insuranceCardNumber' and answer.exists()) -&gt;\n           coverage.identifier as identifier, identifier.type as typeid, typeid.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype', coding.code = 'VeKa', \n           identifier.value = (item.answer.value) &quot;coverage.vvg.insuranceCardNumber&quot;;\n      } &quot;coveragevvg&quot;;\n\n// coverage.iv\tInvalidenversicherung (IV)\t0..1\tgroup\t\tDefinition: Coverage.type\n// coverage.iv.verfuegungsnummer\nsrc.item as item where where (linkId.value = 'coverage.iv') -&gt; bundle.entry as e4, \n   e4.resource = create('Coverage') as coverage, \n   coverage.id = uuid() as uuid4,\n   e4.fullUrl = ('urn:uuid:'+%uuid4),\n   serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n   coverage.status = 'active',\n   coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n   coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'IVG' then {\n      item.item as item where (linkId.value = 'coverage.iv.verfuegungsnummer' and answer.exists()) -&gt;\n      coverage.identifier as identifier, identifier.type as typeid, typeid.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype', coding.code = 'IV', \n      identifier.value = (item.answer.value),\n      coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n      coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = 'IV' &quot;coverage.iv.verfuegungsnummer&quot;;\n   } &quot;coverageiv&quot;;\n\n // coverage.mv\tMilitärversicherung (MV)\t0..1\tgroup\t\tDefinition: Coverage.type\n// coverage.mv.versichertennummer\nsrc.item as item where where (linkId.value = 'coverage.mv') -&gt; bundle.entry as e4, \n   e4.resource = create('Coverage') as coverage, \n   coverage.id = uuid() as uuid4,\n   e4.fullUrl = ('urn:uuid:'+%uuid4),\n   serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n   coverage.status = 'active',\n   coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n   coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'MVG' then {\n      item.item as item where (linkId.value = 'coverage.mv.versichertennummer' and answer.exists()) -&gt;\n      coverage.identifier as identifier, identifier.type as typeid, typeid.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype', coding.code = 'MV', \n      identifier.value = (item.answer.value),\n      coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n      coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = 'MV' &quot;coverage.mv.versichertennummer&quot;;\n   } &quot;coveragemv&quot;;\n      \n   // coverage.self\tSelbstzahler\t0..1\tgroup\t\tDefinition: Coverage.type\n   // coverage.self.familyName\tName\t0..1\tstring\t\tDefinition: Coverage.payor\n   // coverage.self.givenName\tVorname\t0..1\tstring\t\tDefinition: Coverage.payor\n   src.item as item where where (linkId.value = 'coverage.self') then {\n      \n      item.item as item where (linkId.value = 'coverage.self.patient' and answer.exists() and answer.value) -&gt;\n         bundle.entry as e4, \n         e4.resource = create('Coverage') as coverage, \n         coverage.id = uuid() as uuid4,\n         e4.fullUrl = ('urn:uuid:'+%uuid4),\n         serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n         coverage.status = 'active',\n         coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n         coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'Self',\n         coverage.payor  as subject, subject.reference = ('urn:uuid:'+%patient.id) &quot;payor&quot;;\n\n      item.item as item2 where (linkId.value = 'coverage.self.patientRelatedPerson' and answer.exists() and answer.value) then {        \n            item.item as item where (linkId.value = 'coverage.self.relatedPerson') -&gt;\n            bundle.entry as e5, \n            e5.resource = create('Coverage') as coverage, \n            coverage.id = uuid() as uuid4,\n            e5.fullUrl = ('urn:uuid:'+%uuid4),\n            serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n            coverage.status = 'active',\n            coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n            coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'Self',\n            bundle.entry as e6, \n            e6.resource = create('RelatedPerson') as relatedPerson, \n            relatedPerson.id = uuid() as uuid6,\n            e6.fullUrl = append('urn:uuid:',uuid6),\n            coverage.payor as subject, subject.reference = ('urn:uuid:'+%relatedPerson.id),\n            relatedPerson.patient as reference, reference.reference = ('urn:uuid:'+%patient.id)\n            then \n              CoverageRelatedPersonItems(item,relatedPerson) &quot;coverage.self.relatedPerson&quot;;\n      } &quot;coverage.self.patientrelated.&quot;;\n   } &quot;self&quot;;\n \n// coverage.other\tAnderer Kostenträger\t0..1\tgroup\t\tDefinition: Coverage.type\n// coverage.other.name\tName des Kostenträgers\t0..1\tstring\t\tDefinition: Coverage.payor\n// coverage.other.id\tBeliebige ID\t0..1\tstring\t\tDefinition: Coverage.identifier\n// coverage.other.id.note TODO\n   src.item as item where where (linkId.value = 'coverage.other') -&gt; bundle.entry as e4, \n   e4.resource = create('Coverage') as coverage, \n   coverage.id = uuid() as uuid4,\n   e4.fullUrl = ('urn:uuid:'+%uuid4),\n   serviceRequest.insurance as insurance, insurance.reference = ('urn:uuid:'+%uuid4),\n   coverage.status = 'active',\n   coverage.beneficiary = create('Reference') as subject, subject.reference = ('urn:uuid:'+%patient.id),\n   coverage.type as type, type.coding as coding, coding.system = 'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype', coding.code = 'Other' then {\n      item.item as item where (linkId.value = 'coverage.other.name' and answer.exists()) -&gt;\n      coverage.payor as payor, payor.reference as refcontained, refcontained.value = '#org', \n      coverage.contained = create('Organization') as organization, organization.id = 'org', organization.name = (item.answer.value) &quot;coverage.other.name&quot;;\n      item.item as item where (linkId.value = 'coverage.other.id' and answer.exists()) -&gt;\n      coverage.identifier as identifier, identifier.value = (item.answer.value) &quot;coverage.other.id&quot;;\n   } &quot;coveragevvg&quot;;\n}\n\ngroup CoverageRelatedPersonItems(source src : BackboneElement, target relatedPerson: RelatedPerson) {\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.familyName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.givenName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.phone' and answer.exists()) then {\n      item.answer as answer -&gt; relatedPerson.telecom as value, value.system = 'phone',\n                                value.value= (answer.value) &quot;coverage.self.relatedPerson.phone&quot;; \n   } &quot;phone&quot;;\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.email' and answer.exists()) -&gt; relatedPerson.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;coverage.self.relatedPerson.email&quot;; \n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.streetAddressLine' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;coverage.self.relatedPerson.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.postalCode' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;coverage.self.relatedPerson.postalCode&quot;;\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.city' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.city = (item.answer.value) &quot;coverage.self.relatedPerson.city&quot;;\n   src.item as item where (linkId.value = 'coverage.self.relatedPerson.country' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.country = (item.answer.value) &quot;coverage.self.relatedPerson.country&quot;;\n}\n\n\ngroup SenderAuthorPractitionerItems(source src : BackboneElement, target practitioner: Practitioner) {\n   src.item as item where (linkId.value = 'sender.author.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'sender.author.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'sender.author.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;sender.author.practitioner.title&quot;; \n   src.item as item where (linkId.value = 'sender.author.practitioner.gln' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.gln&quot;; \n   src.item as item where (linkId.value = 'sender.author.practitioner.zsr' and answer.exists()) -&gt; practitioner.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;recsender.author.practitioner.zsr&quot;; \n   src.item as item where (linkId.value = 'sender.author.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'sender.author.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.email&quot;; \n}\n\ngroup SenderAuthorOrganizationItems(source src : BackboneElement, target organization: Organization) {\n   src.item as item where (linkId.value = 'sender.author.organization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'sender.author.organization.gln' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.51.1.3',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.organization.gln&quot;;\n   src.item as item where (linkId.value = 'sender.author.organization.zsr' and answer.exists()) -&gt; organization.identifier as value, \n                                                                                   value.system = 'urn:oid:2.16.756.5.30.1.123.100.2.1.1',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.organization.zsr&quot;; \n   src.item as item where (linkId.value = 'sender.author.organization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;sender.author.organization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'sender.author.organization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;sender.author.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'sender.author.organization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;sender.author.organization.city&quot;;\n   src.item as item where (linkId.value = 'sender.author.organization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;sender.author.organization.country&quot;;\n}\n\ngroup SenderAuthorItems(source src : BackboneElement, target practitionerRole: practitionerRole, target practitioner : Practitioner, target organization: Organization) {\n   src.item as item where (linkId.value = 'sender.author.practitioner') then SenderAuthorPractitionerItems(item, practitioner);\n   src.item as item where (linkId.value = 'sender.author.organization') then SenderAuthorOrganizationItems(item, organization);\n}\n\ngroup SenderDataEntererPractitionerItems(source src : BackboneElement, target practitioner: Practitioner) {\n   src.item as item where (linkId.value = 'sender.dataenterer.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'sender.dataenterer.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'sender.dataenterer.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'sender.dataenterer.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;sender.author.practitioner.email&quot;; \n}\n\ngroup SenderDataEntererItems(source src : BackboneElement, target practitionerRole: practitionerRole, target practitioner : Practitioner, target organization: Organization) {\n   src.item as item where (linkId.value = 'sender.dataenterer.practitioner') then SenderDataEntererPractitionerItems(item, practitioner);\n}\n\ngroup ChExtEprDataEnterer(source src: BackboneElement, target practitionerRole: PractitionerRole, target ext: Extension) {\n  src -&gt; ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer' &quot;url&quot;;\n  src -&gt; ext.extension as ext, ext.url='enterer', ext.value = create('Reference') as reference, \n                 reference.reference = ('urn:uuid:'+%practitionerRole.id) &quot;practitionerRole&quot;;\n}\n\ngroup SenderAuthorInit(source src : BackboneElement, target bundle: Bundle, target composition : Composition, target serviceRequest: ServiceRequest) {\n   src -&gt; bundle.entry as e, \n          e.resource = create('PractitionerRole') as practitionerRole, \n          practitionerRole.id = uuid() as uuid,\n          e.fullUrl = append('urn:uuid:',uuid),\n          bundle.entry as e2, \n          e2.resource = create('Practitioner') as practitioner, \n          practitioner.id = uuid() as uuid2,\n          e2.fullUrl = append('urn:uuid:',uuid2),\n          bundle.entry as e3, \n          e3.resource = create('Organization') as organization, \n          organization.id = uuid() as uuid3,\n          e3.fullUrl = append('urn:uuid:',uuid3),\n          composition.author = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid),\n          serviceRequest.requester = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid),\n          practitionerRole.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid2),\n          practitionerRole.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3) then {\n             src.item as item where (linkId.value = 'sender.author') then SenderAuthorItems(item, practitionerRole, practitioner, organization) &quot;sender.author&quot;;\n             src.item as item where (linkId.value = 'sender.dataenterer') then {\n               item -&gt; bundle.entry as e4, \n                      e4.resource = create('PractitionerRole') as practitionerRoleDataEnterer, \n                      practitionerRoleDataEnterer.id = uuid() as uuid4,\n                      e4.fullUrl = append('urn:uuid:',uuid4),\n                      composition.extension as extension,\n                      bundle.entry as e5, \n                      e5.resource = create('Practitioner') as practitionerDataEnterer, \n                      practitionerDataEnterer.id = uuid() as uuid5,\n                      e5.fullUrl = append('urn:uuid:',uuid5),\n                      practitionerRoleDataEnterer.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid5),\n                      practitionerRoleDataEnterer.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3) \n                      then {\n                            item then SenderDataEntererItems(item, practitionerRoleDataEnterer, practitionerDataEnterer, organization) &quot;data&quot;;\n                            item then ChExtEprDataEnterer(item, practitionerRoleDataEnterer, extension) &quot;extension&quot;;\n                         } &quot;sender.dataenterer.items&quot;;\n             } &quot;sender.dataenterer&quot;;\n          } &quot;sender&quot;;\n}\n\ngroup ReceiverCopyRelatedPersonItems(source src : BackboneElement, target relatedPerson: RelatedPerson) {\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.familyName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.givenName' and answer.exists()) -&gt; relatedPerson.name as name share name, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.phone' and answer.exists()) then {\n      item.answer as answer -&gt; relatedPerson.telecom as value, value.system = 'phone',\n                                value.value= (answer.value) &quot;receiverCopy.relatedPerson.phone&quot;; \n   } &quot;phone&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.email' and answer.exists()) -&gt; relatedPerson.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;receiverCopy.relatedPerson.email&quot;; \n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.streetAddressLine' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;receiverCopy.relatedPerson.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.postalCode' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;receiverCopy.relatedPerson.postalCode&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.city' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.city = (item.answer.value) &quot;receiverCopy.relatedPerson.city&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.relatedPerson.country' and answer.exists()) -&gt; relatedPerson.address as address share orgAddress, address.country = (item.answer.value) &quot;receiverCopy.relatedPerson.country&quot;;\n}\n\ngroup ReceiverCopyPractitionerItems(source src : BackboneElement, target practitioner : Practitioner) {\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.family = (item.answer.value);\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName' and answer.exists()) -&gt; practitioner.name as name share practitionerName, name.given = (item.answer.value);\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner.title' and answer.exists()) -&gt; practitioner.name as name share practitionerName, \n                                                                        name.prefix = (item.answer.value) as prefix,\n                                                                        prefix.extension as ext, ext.url = 'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier',\n                                                                        ext.value = create('code') as value, value.value='AC' &quot;receiverCopy.practitionerRole.practitioner.title&quot;; \n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner.phone' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'phone',\n                                                                                   value.value=(item.answer.value) &quot;receiverCopy.practitionerRole.practitioner.phone&quot;; \n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner.email' and answer.exists()) -&gt; practitioner.telecom as value, \n                                                                                   value.system = 'email',\n                                                                                   value.value=(item.answer.value) &quot;receiverCopy.practitionerRole.practitioner.email&quot;; \n}\n\ngroup ReceiverCopyOrganizationItems(source src : BackboneElement, target organization : Organization) {\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization.name' and answer.exists()) -&gt; organization.name = (item.answer.value);\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine' and answer.exists()) -&gt; organization.address as address share orgAddress then {\n     item.answer as answer -&gt; address.line = (answer.value) &quot;receiverCopy.practitionerRole.organization.streetAddressLine&quot;;\n   } &quot;item.answer&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization.postalCode' and answer.exists()) -&gt; organization.address as address share orgAddress, address.postalCode = (item.answer.value) &quot;receiverCopy.practitionerRole.organization.postalCode&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization.city' and answer.exists()) -&gt; organization.address as address share orgAddress, address.city = (item.answer.value) &quot;receiverCopy.practitionerRole.organization.city&quot;;\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization.country' and answer.exists()) -&gt; organization.address as address share orgAddress, address.country = (item.answer.value) &quot;receiverCopy.practitionerRole.organization.country&quot;;\n}\n\ngroup ReceiverCopyPractitionerRoleItems(source src : BackboneElement, target bundle: Bundle, target practitionerRole: practitionerRole) {\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.practitioner') -&gt; \n      bundle.entry as e2, \n      e2.resource = create('Practitioner') as practitioner, \n      practitioner.id = uuid() as uuid2,\n      practitionerRole.practitioner = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid2),\n      e2.fullUrl = append('urn:uuid:',uuid2) then ReceiverCopyPractitionerItems(item, practitioner);\n   src.item as item where (linkId.value = 'receiverCopy.practitionerRole.organization') -&gt;\n     bundle.entry as e3, \n     e3.resource = create('Organization') as organization, \n     organization.id = uuid() as uuid3,\n     practitionerRole.organization = create('Reference') as reference, reference.reference = append('urn:uuid:',uuid3), \n     e3.fullUrl = append('urn:uuid:',uuid3) then ReceiverCopyOrganizationItems(item, organization);\n}\n\ngroup ExtOrfCopyReceiverPatient(source src: BackboneElement, target patient: Patient, target ext: Extension) {\n  src -&gt; ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver' &quot;url&quot;;\n  src -&gt; ext.value = create('Reference') as reference, \n                reference.reference = ('urn:uuid:'+%patient.id) &quot;patient&quot;;\n}\n\ngroup ExtOrfCopyReceiver(source src: BackboneElement, target res, target ext: Extension) {\n  src -&gt; ext.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver' &quot;url&quot;;\n  src -&gt; ext.value = create('Reference') as reference, \n                reference.reference = ('urn:uuid:'+%res.id) &quot;organization&quot;;\n}\n\ngroup ReceiverCopy(source grp : BackboneElement, target bundle: Bundle, target patient: Patient, target composition : Composition, target serviceRequest: ServiceRequest) {\n  grp.item as item where (linkId='receiverCopy.practitionerRole') -&gt; bundle.entry as e4, \n            e4.resource = create('PractitionerRole') as practitionerrole, \n            composition.extension as extension,\n            practitionerrole.id = uuid() as uuid4,\n            e4.fullUrl = append('urn:uuid:',uuid4) then {\n               item then ReceiverCopyPractitionerRoleItems(item, bundle, practitionerrole) &quot;data&quot;;\n               item then ExtOrfCopyReceiver(item, practitionerrole, extension) &quot;extension&quot;;\n            } &quot;receiverCopyPractitionerRole1&quot;;\n   grp.item as item where (linkId='receiverCopy.patient') -&gt;  \n            composition.extension as extension then {\n               item then ExtOrfCopyReceiver(item, patient, extension) &quot;extension&quot;;\n            } &quot;receiverCopyPractitionerRole2&quot;;\n   grp.item as item where (linkId='receiverCopy.relatedPerson') -&gt; bundle.entry as e4, \n            e4.resource = create('RelatedPerson') as relatedPerson, \n            composition.extension as extension,\n            relatedPerson.id = uuid() as uuid4,\n            relatedPerson.patient as reference,\n            reference.reference = ('urn:uuid:'+%patient.id),\n            e4.fullUrl = append('urn:uuid:',uuid4) then {\n               item then ReceiverCopyRelatedPersonItems(item, relatedPerson) &quot;data&quot;;\n               item then ExtOrfCopyReceiver(item, relatedPerson, extension) &quot;extension&quot;;\n            } &quot;receiverCopyPractitionerRole3&quot;;\n}\n\ngroup Appointment(source grp : BackboneElement, target bundle: Bundle, target composition : Composition, target serviceRequest: ServiceRequest) {\n   grp.item -&gt; bundle.entry as e4, \n   e4.resource = create('Appointment') as appointment, \n   appointment.id = uuid() as uuid4,\n   e4.fullUrl = ('urn:uuid:'+%uuid4),\n   serviceRequest.extension as extension,\n   extension.url = 'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime',\n   extension.value = create('Reference') as reference, reference.reference = ('urn:uuid:'+%uuid4)                \n   then {\n      grp.item as item where (linkId.value = 'appointment.status' and answer.value.code='proposed') -&gt; appointment.status = (item.answer.value.code) then {\n         grp.item as itemp where (linkId.value = 'appointment.requestedPeriod') then {\n           itemp.item as item2 where (linkId.value = 'appointment.requestedPeriod.start' and answer.exists()) -&gt; appointment.requestedPeriod as requestedPeriod, requestedPeriod.start = (item2.answer.value), requestedPeriod.end = (item2.answer.value) then {\n           itemp.item as item3 where (linkId.value = 'appointment.requestedPeriod.end' and answer.exists()) -&gt; requestedPeriod.end = (item3.answer.value) &quot;appointment.requestedPeriod.end.if.not.same.as.start&quot;;\n           } &quot;appointment.requestedPeriod.start&quot;;\n         } &quot;appointment.requestedPeriod&quot;;\n      } &quot;proposed&quot;;\n      grp.item as item where (linkId.value = 'appointment.status' and (answer.value.code='pending' or answer.value.code='booked')) -&gt; appointment.status = (item.answer.value.code) then {\n         grp.item as itemp where (linkId.value = 'appointment.requestedPeriod') then {\n           itemp.item as item2 where (linkId.value = 'appointment.requestedPeriod.start' and answer.exists()) -&gt; appointment.start = (item2.answer.value), appointment.end = (item2.answer.value) then {\n           itemp.item as item3 where (linkId.value = 'appointment.requestedPeriod.end' and answer.exists()) -&gt; appointment.end = (item3.answer.value) &quot;appointment.end.if.not.same.as.start&quot;;\n           } &quot;appointment.start&quot;;\n         } &quot;appointment.startend&quot;;\n      } &quot;pendingorbooked&quot;;\n      grp.item as item where (linkId.value = 'appointment.patientInstruction' and answer.exists()) -&gt; appointment.patientInstruction = (item.answer.value) &quot;appointment.patientInstruction&quot;;\n      grp.item as item where (linkId.value = 'appointment.location') then {\n         item -&gt; bundle.entry as e5, \n         e5.resource = create('Location') as location, \n         location.id = uuid() as uuid5,\n         e5.fullUrl = ('urn:uuid:'+%uuid5),\n         appointment.participant as participant, participant.status = 'tentative', participant.actor = create('Reference') as actor, actor.reference = ('urn:uuid:'+%location.id) then {\n            item.item as item3 where (linkId.value = 'appointment.location.name' and answer.exists()) -&gt; location.name = (item3.answer.value);\n            item.item as item3 where (linkId.value = 'appointment.location.phone' and answer.exists()) -&gt; location.telecom as value, value.system = 'phone', value.value=(item3.answer.value) &quot;appointment.location.phone&quot;; \n            item.item as item3 where (linkId.value = 'appointment.location.email' and answer.exists()) -&gt; location.telecom as value, value.system = 'email', value.value=(item3.answer.value) &quot;appointment.location.email&quot;; \n            item.item as item3 where (linkId.value = 'appointment.location.streetAddressLine' and answer.exists()) -&gt; location.address as address share orgAddress then {\n               item.answer as answer -&gt; address.line = (answer.value) &quot;line&quot;;\n            } &quot;appointment.location.streetAddressLine&quot;;\n            item.item as item3 where (linkId.value = 'appointment.location.postalCode' and answer.exists()) -&gt; location.address as address share orgAddress, address.postalCode = (item3.answer.value) &quot;appointment.location.postalCode&quot;;\n            item.item as item3 where (linkId.value = 'appointment.location.city' and answer.exists()) -&gt; location.address as address share orgAddress, address.city = (item3.answer.value) &quot;appointment.location.city&quot;;\n            item.item as item3 where (linkId.value = 'appointment.location.country' and answer.exists()) -&gt; location.address as address share orgAddress, address.country = (item3.answer.value) &quot;appointment.location.country&quot;;\n         } &quot;location&quot;;\n      } &quot;appointment.location&quot;;\n   } &quot;Appointment&quot;;\n}\n\ngroup PreviousResults(source grp : BackboneElement, target bundle: Bundle, target serviceRequest: ServiceRequest) {\n   grp.item as item where (linkId='previousResults.attachment' and answer.exists()) then {\n      item.answer as answer then {\n         answer.value: Attachment as attachment -&gt; \n            bundle.entry as e, \n            e.resource = create('Media') as media, \n            media.id = uuid() as uuid,\n            media.status = 'completed',\n            e.fullUrl = append('urn:uuid:',uuid), \n            media.content = attachment,\n            serviceRequest.supportingInfo as supportingInfo,\n            supportingInfo.reference = ('urn:uuid:'+uuid)\n            &quot;media&quot;; \n      } &quot;answer&quot;;\n   } &quot;item&quot;;\n}\n\ngroup Note(source grp : BackboneElement, target serviceRequest: ServiceRequest) {\n   grp.item as item where (linkId='note.text' and answer.exists()) -&gt; serviceRequest.note as note, note.text = (item.answer.value) &quot;note.text&quot;;\n}\n\ngroup QrToBundle(source qr : QuestionnaireResponse, target q: Questionnaire, target patient : Patient, target questionnaireresp: QuestionnaireResponseTarget, target servicerequest: ServiceRequest, target composition : Composition, target bundle : Bundle) {\n  qr -&gt; bundle.id = uuid() &quot;id&quot;;\n  qr -&gt; bundle.type = 'document' &quot;type&quot;;\n  qr then OrfComposition(qr, q, composition, patient, questionnaireresp, servicerequest, bundle) &quot;composition&quot;;\n  qr then QrToGroups(qr, patient, bundle, composition, servicerequest) &quot;qrgroups&quot;;\n}\n\ngroup OrfComposition(source qr : QuestionnaireResponse, target q: Questionnaire, target tgt : Composition, target patient: Patient, target questionnaireresp: QuestionnaireResponseTarget, target servicerequest: ServiceRequest, target bundle : Bundle) {\n  qr -&gt; tgt.status = 'final' &quot;status&quot;;\n  qr -&gt; tgt.subject = create('Reference') as reference, reference.reference = ('urn:uuid:'+%patient.id) &quot;subject&quot;;\n  qr -&gt; tgt.section as tgtSection, \n     tgtSection.title = 'Order-Referral', \n     tgtSection.code as code, code.coding as coding, coding.system='http://loinc.org', coding.code='93037-0', coding.display='Portable medical order form',\n     tgtSection.entry = create('Reference') as reference, reference.reference = ('urn:uuid:'+%questionnaireresp.id),\n     tgtSection.entry = create('Reference') as reference, reference.reference = ('urn:uuid:'+%servicerequest.id),\n     tgtSection.entry = create('Reference') as reference, reference.reference = ('urn:uuid:'+%q.id) &quot;sections&quot;;\n  qr -&gt; servicerequest.status = 'active',\n      servicerequest.intent = 'order',\n      servicerequest.subject = create('Reference') as reference, reference.reference = ('urn:uuid:'+%patient.id) &quot;servicerequest&quot;;\n}</pre>\n    </div>"
  },
  "url" : "http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle",
  "version" : "2.0.0-ballot",
  "name" : "OrfQrToBundle",
  "status" : "draft",
  "date" : "2023-06-29T21:20:25+02:00",
  "publisher" : "HL7 Switzerland",
  "contact" : [
    {
      "name" : "HL7 Switzerland",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://www.hl7.ch/"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "CH"
        }
      ]
    }
  ],
  "copyright" : "CC0-1.0",
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode" : "source",
      "alias" : "QuestionnaireResponse"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/BackboneElement",
      "mode" : "source",
      "alias" : "BackboneElement"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "Bundle"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Composition",
      "mode" : "target",
      "alias" : "Composition"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
      "mode" : "target",
      "alias" : "Patient"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
      "mode" : "target",
      "alias" : "RelatedPerson"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Organization",
      "mode" : "target",
      "alias" : "Organization"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
      "mode" : "target",
      "alias" : "Practitioner"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
      "mode" : "target",
      "alias" : "PractitionerRole"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
      "mode" : "target",
      "alias" : "ServiceRequest"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Extension",
      "mode" : "target",
      "alias" : "Extension"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare",
      "mode" : "target",
      "alias" : "EpisodeOfCare"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode" : "target",
      "alias" : "QuestionnaireResponseTarget"
    }
  ],
  "group" : [
    {
      "name" : "OrfQrToBundle",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "qr",
          "type" : "QuestionnaireResponse",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "documentIdentifier",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "documentIdentifier"
            },
            {
              "context" : "documentIdentifier",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:ietf:rfc:3986"
                }
              ]
            },
            {
              "contextType" : "variable",
              "variable" : "uuidDoc",
              "transform" : "uuid"
            },
            {
              "context" : "documentIdentifier",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuidDoc"
                }
              ]
            }
          ]
        },
        {
          "name" : "orfbundle",
          "source" : [
            {
              "context" : "qr",
              "variable" : "qrcp"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "composition",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Composition"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "timestamp",
              "variable" : "timestamp",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "now()"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "date",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "timestamp"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "title",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Order and Referral by Form"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "419891008"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://snomed.info/sct"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "category",
              "variable" : "category"
            },
            {
              "context" : "category",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "721963009"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://snomed.info/sct"
                }
              ]
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "patient",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Patient"
                }
              ]
            },
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "questionnaireresp",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "qrcp"
                }
              ]
            },
            {
              "context" : "questionnaireresp",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e5"
            },
            {
              "context" : "e5",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "servicerequest",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "ServiceRequest"
                }
              ]
            },
            {
              "context" : "servicerequest",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid5",
              "transform" : "uuid"
            },
            {
              "context" : "e5",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid5"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "orfbundle",
              "source" : [
                {
                  "context" : "qr",
                  "element" : "questionnaire",
                  "variable" : "can"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e6"
                },
                {
                  "context" : "e6",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "q",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "can.resolve()"
                    }
                  ]
                },
                {
                  "context" : "q",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid6",
                  "transform" : "uuid"
                },
                {
                  "context" : "e6",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid6"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "QrToBundle",
                  "variable" : [
                    "qr",
                    "q",
                    "patient",
                    "questionnaireresp",
                    "servicerequest",
                    "composition",
                    "bundle"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "QrToGroups",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "qr",
          "type" : "QuestionnaireResponse",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "grporder",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'order'"
            }
          ],
          "dependent" : [
            {
              "name" : "OrderItems",
              "variable" : [
                "grp",
                "bundle",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "receiver",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'receiver'"
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverInit",
              "variable" : [
                "grp",
                "bundle",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "grpinitiator",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'initiator'"
            }
          ],
          "dependent" : [
            {
              "name" : "InitiatorInit",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "grppatient",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'patient'"
            }
          ],
          "dependent" : [
            {
              "name" : "PatientItems",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "grprequestedencounter",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'requestedEncounter'"
            }
          ],
          "dependent" : [
            {
              "name" : "RequestedEncounterItems",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "grprequestedencounter",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'coverage'"
            }
          ],
          "dependent" : [
            {
              "name" : "Coverage",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "grpsender",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'sender'"
            }
          ],
          "dependent" : [
            {
              "name" : "SenderAuthorInit",
              "variable" : [
                "grp",
                "bundle",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'receiverCopy'"
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverCopy",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "appointment",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'appointment'"
            }
          ],
          "dependent" : [
            {
              "name" : "Appointment",
              "variable" : [
                "grp",
                "bundle",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "previousResults",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'previousResults'"
            }
          ],
          "dependent" : [
            {
              "name" : "PreviousResults",
              "variable" : [
                "grp",
                "bundle",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "AntecedentEpisodeOfCareInit",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'antecedentEpisodeOfCare'"
            }
          ],
          "dependent" : [
            {
              "name" : "AntecedentEpisodeOfCareInit",
              "variable" : [
                "grp",
                "bundle",
                "patient",
                "composition"
              ]
            }
          ]
        },
        {
          "name" : "consent",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'consent'"
            }
          ],
          "dependent" : [
            {
              "name" : "Consent",
              "variable" : [
                "grp",
                "bundle",
                "composition"
              ]
            }
          ]
        },
        {
          "name" : "note",
          "source" : [
            {
              "context" : "qr",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'note'"
            }
          ],
          "dependent" : [
            {
              "name" : "Note",
              "variable" : [
                "grp",
                "serviceRequest"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "OrderItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "order.precedentDocumentIdentifier",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.precedentDocumentIdentifier') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Identifier"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:ietf:rfc:3986"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "order.placerOrderIdentifier",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.placerOrderIdentifier') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "placer"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "PLAC"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "order.placerOrderIdentifierDomain",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.placerOrderIdentifierDomain') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "placer"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "order.fillerOrderIdentifier",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.fillerOrderIdentifier') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "filler"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "FILL"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "order.fillerOrderIdentifierDomain",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.fillerOrderIdentifierDomain') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "filler"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.dateTime') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "authoredOn",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.priority') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "priority",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value.code"
                }
              ]
            }
          ]
        },
        {
          "name" : "order.notificationContactDocument",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'order.notificationContactDocument')"
            }
          ],
          "rule" : [
            {
              "name" : "order.notificationContactDocument.items",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e4"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerRoleDataEnterer",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "practitionerRoleDataEnterer",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid4",
                  "transform" : "uuid"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid4"
                    }
                  ]
                },
                {
                  "context" : "composition",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "extension"
                },
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e5"
                },
                {
                  "context" : "e5",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerDataEnterer",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Practitioner"
                    }
                  ]
                },
                {
                  "context" : "practitionerDataEnterer",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid5",
                  "transform" : "uuid"
                },
                {
                  "context" : "e5",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid5"
                    }
                  ]
                },
                {
                  "context" : "practitionerRoleDataEnterer",
                  "contextType" : "variable",
                  "element" : "practitioner",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid5"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "data",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "UrgentNotificationContactForRequestItems",
                      "variable" : [
                        "item",
                        "practitionerRoleDataEnterer",
                        "practitionerDataEnterer"
                      ]
                    }
                  ]
                },
                {
                  "name" : "extension",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ExtOrfUrgentNotificationContactForRequest",
                      "variable" : [
                        "item",
                        "practitionerRoleDataEnterer",
                        "extension"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "order.notificationContactDocumentResponse",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'order.notificationContactDocumentResponse')"
            }
          ],
          "rule" : [
            {
              "name" : "order.notificationContactDocumentResponse.items",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e4"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerRoleDataEnterer",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "PractitionerRole"
                    }
                  ]
                },
                {
                  "context" : "practitionerRoleDataEnterer",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid4",
                  "transform" : "uuid"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid4"
                    }
                  ]
                },
                {
                  "context" : "composition",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "extension"
                },
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e5"
                },
                {
                  "context" : "e5",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitionerDataEnterer",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Practitioner"
                    }
                  ]
                },
                {
                  "context" : "practitionerDataEnterer",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid5",
                  "transform" : "uuid"
                },
                {
                  "context" : "e5",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid5"
                    }
                  ]
                },
                {
                  "context" : "practitionerRoleDataEnterer",
                  "contextType" : "variable",
                  "element" : "practitioner",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid5"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "data",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "UrgentNotificationContactForResponseItems",
                      "variable" : [
                        "item",
                        "practitionerRoleDataEnterer",
                        "practitionerDataEnterer"
                      ]
                    }
                  ]
                },
                {
                  "name" : "extension",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "ExtOrfUrgentNotificationContactForResponse",
                      "variable" : [
                        "item",
                        "practitionerRoleDataEnterer",
                        "extension"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "UrgentNotificationContactForRequestPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "UrgentNotificationContactForRequestItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'order.notificationContactDocument.practitioner')"
            }
          ],
          "dependent" : [
            {
              "name" : "UrgentNotificationContactForRequestPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtOrfUrgentNotificationContactForRequest",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "PractitionerRole",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "url",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument"
                }
              ]
            }
          ]
        },
        {
          "name" : "practitionerRole",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %practitionerRole.id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "UrgentNotificationContactForResponsePractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "UrgentNotificationContactForResponseItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'order.notificationContactDocumentResponse.practitioner')"
            }
          ],
          "dependent" : [
            {
              "name" : "UrgentNotificationContactForResponsePractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtOrfUrgentNotificationContactForResponse",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "PractitionerRole",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "url",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument"
                }
              ]
            }
          ]
        },
        {
          "name" : "practitionerRole",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %practitionerRole.id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.organization.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.organization.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "receiver.organization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiver.organization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'receiver.practitioner')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitioner",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Practitioner"
                }
              ]
            },
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "practitioner",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'receiver.organization')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "organization",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Organization"
                }
              ]
            },
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "organization",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverOrganizationItems",
              "variable" : [
                "item",
                "organization"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Consent",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "consent.statement",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'consent.statement') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "consent",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Consent"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "scope",
              "variable" : "scope"
            },
            {
              "context" : "scope",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "treatment"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://terminology.hl7.org/CodeSystem/consentscope"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "category",
              "variable" : "category"
            },
            {
              "context" : "category",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "59284-0"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://loinc.org"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "policyRule",
              "variable" : "policyRule"
            },
            {
              "context" : "policyRule",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "385432009"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://snomed.info/sct"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "consent",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extcode"
            },
            {
              "context" : "extcode",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode"
                }
              ]
            },
            {
              "context" : "extcode",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "cc",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "CodeableConcept"
                }
              ]
            },
            {
              "context" : "cc",
              "contextType" : "variable",
              "element" : "coding",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "item.answer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "consent.statement.note",
                  "source" : [
                    {
                      "context" : "answer",
                      "element" : "item",
                      "variable" : "item",
                      "condition" : "((linkId.value = 'consent.statement.note') and answer.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "consent",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "extnote"
                    },
                    {
                      "context" : "extnote",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote"
                        }
                      ]
                    },
                    {
                      "context" : "extnote",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "item.answer.value"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverInit",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "receiver",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitionerRole",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "PractitionerRole"
                }
              ]
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverItems",
              "variable" : [
                "src",
                "bundle",
                "practitionerRole"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "initiator.personalrelation",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.personalrelation') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "ch-orf-personalrelation"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.legalrelation",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.legalrelation') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "ch-orf-legalrelation"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "InitiatorPractitionerRoleItems",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = 'initiator.practitionerRole')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitionerrole",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "PractitionerRole"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "practitionerrole",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "ch-orf-personorganization"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "data",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "InitiatorPractitionerRoleItems",
                  "variable" : [
                    "item",
                    "bundle",
                    "practitionerrole"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.relatedPerson",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = 'initiator.relatedPerson')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "relatedPerson",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "RelatedPerson"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "ch-orf-personorganization"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            },
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference"
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "data",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "InitiatorRelatedPersonItems",
                  "variable" : [
                    "item",
                    "relatedPerson"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorRelatedPersonItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "relatedPerson",
          "type" : "RelatedPerson",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.phone') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "initiator.relatedPerson.phone",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "relatedPerson",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "phone"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.relatedPerson.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "initiator.relatedPerson.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.relatedPerson.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.relatedPerson.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.relatedPerson.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.relatedPerson.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorPractitionerRoleItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'initiator.practitionerRole.practitioner')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitioner",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Practitioner"
                }
              ]
            },
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "practitioner",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "InitiatorPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'initiator.practitionerRole.organization')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "organization",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Organization"
                }
              ]
            },
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "organization",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "InitiatorOrganizationItems",
              "variable" : [
                "item",
                "organization"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiver.practitioner.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.organization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.organization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "initiator.practitionerRole.organization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.organization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.organization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "initiator.practitionerRole.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'initiator.practitionerRole.organization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "FamilyDoctorInit",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "FamilyDoctorInit",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitionerRole",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "PractitionerRole"
                }
              ]
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "patient",
              "contextType" : "variable",
              "element" : "generalPractitioner",
              "variable" : "gp",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "gp",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "item",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'familydoctor.practitioner')"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e2"
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "practitioner",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Practitioner"
                    }
                  ]
                },
                {
                  "context" : "practitioner",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid2",
                  "transform" : "uuid"
                },
                {
                  "context" : "practitionerRole",
                  "contextType" : "variable",
                  "element" : "practitioner",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                },
                {
                  "context" : "e2",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid2"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "FamilyDoctorPractitionerItems",
                  "variable" : [
                    "item",
                    "practitioner"
                  ]
                }
              ]
            },
            {
              "name" : "item",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'familydoctor.organization')"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e3"
                },
                {
                  "context" : "e3",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid3",
                  "transform" : "uuid"
                },
                {
                  "context" : "practitionerRole",
                  "contextType" : "variable",
                  "element" : "organization",
                  "variable" : "reference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "reference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid3"
                    }
                  ]
                },
                {
                  "context" : "e3",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "uuid3"
                    }
                  ]
                }
              ],
              "dependent" : [
                {
                  "name" : "FamilyDoctorOrganizationItems",
                  "variable" : [
                    "item",
                    "organization"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "FamilyDoctorPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.practitioner.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.practitioner.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "FamilyDoctorOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "familydoctor.organization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctor.organization.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "familydoctorr.organization.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'familydoctor.organization.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "AntecedentEpisodeOfCareInit",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "AntecedentEpisodeOfCareItems",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "episodeofcare",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "EpisodeOfCare"
                }
              ]
            },
            {
              "context" : "episodeofcare",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "episodeofcare",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "finished"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "ref",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "ref",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %episodeofcare.id"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "AntecedentEpisodeOfCareItems",
              "variable" : [
                "src",
                "bundle",
                "patient",
                "episodeofcare"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "AntecedentEpisodeOfCareItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "episodeofcare",
          "type" : "EpisodeOfCare",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "antecedentEpisodeOfCare.requestedPeriod.start",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.start') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "episodeofcare",
              "contextType" : "variable",
              "element" : "statusHistory",
              "variable" : "statusHistory"
            },
            {
              "context" : "statusHistory",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "finished"
                }
              ]
            },
            {
              "context" : "statusHistory",
              "contextType" : "variable",
              "element" : "period",
              "variable" : "period"
            },
            {
              "context" : "period",
              "contextType" : "variable",
              "element" : "start",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "period",
              "contextType" : "variable",
              "element" : "end",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "antecedentEpisodeOfCareEndNotSameAsStart",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "iteme",
                  "condition" : "((linkId.value = 'antecedentEpisodeOfCare.end') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "period",
                  "contextType" : "variable",
                  "element" : "end",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "iteme.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "antecedentEpisodeOfCare.managingOrganization",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'antecedentEpisodeOfCare.managingOrganization')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "organization",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Organization"
                }
              ]
            },
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "episodeofcare",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %tgt.id"
                }
              ]
            },
            {
              "context" : "episodeofcare",
              "contextType" : "variable",
              "element" : "managingOrganization",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "AntecedentEpisodeOfCareOrganizationItems",
              "variable" : [
                "item",
                "organization"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "AntecedentEpisodeOfCareOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "antecedentEpisodeOfCareorganization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "InitiatorInit",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "receiver",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "InitiatorItems",
              "variable" : [
                "src",
                "bundle",
                "patient",
                "ext"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PatientItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "grpfamily",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "grp",
              "condition" : "linkId = 'familydoctor'"
            }
          ],
          "dependent" : [
            {
              "name" : "FamilyDoctorInit",
              "variable" : [
                "grp",
                "bundle",
                "tgt",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item"
            }
          ],
          "dependent" : [
            {
              "name" : "PatientItems",
              "variable" : [
                "item",
                "bundle",
                "tgt",
                "composition",
                "serviceRequest"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "patientName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.maidenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "use",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "maiden"
                }
              ]
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "patientName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.localPid",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.localPid') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "localpid"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "MR"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.localPidDomain",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.localPidDomain') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "localpid"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.valueString"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.birthDate') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "birthDate",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.gender') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "gender",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value.code"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.maritalStatus",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.maritalStatus') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "maritalStatus",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "element" : "value",
                      "variable" : "coding"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "maritalStatus",
                      "variable" : "maritalStatus"
                    },
                    {
                      "context" : "maritalStatus",
                      "contextType" : "variable",
                      "element" : "coding",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "coding"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.phone') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "patient.phone",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "phone"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "patient.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient.languageOfCorrespondence",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'patient.languageOfCorrespondence') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "languageOfCorrespondence",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "element" : "value",
                      "variable" : "coding"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "communication",
                      "variable" : "communication"
                    },
                    {
                      "context" : "communication",
                      "contextType" : "variable",
                      "element" : "preferred",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueBoolean" : true
                        }
                      ]
                    },
                    {
                      "context" : "communication",
                      "contextType" : "variable",
                      "element" : "language",
                      "variable" : "language"
                    },
                    {
                      "context" : "language",
                      "contextType" : "variable",
                      "element" : "coding",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "coding"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "contact",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'patient.contactperson')"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "contact",
              "variable" : "contact"
            }
          ],
          "rule" : [
            {
              "name" : "item",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'patient.contactperson.familyName') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "contact",
                  "contextType" : "variable",
                  "element" : "name",
                  "variable" : "name",
                  "listMode" : [
                    "share"
                  ],
                  "listRuleId" : "contactName"
                },
                {
                  "context" : "name",
                  "contextType" : "variable",
                  "element" : "family",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "item",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'patient.contactperson.givenName') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "contact",
                  "contextType" : "variable",
                  "element" : "name",
                  "variable" : "name",
                  "listMode" : [
                    "share"
                  ],
                  "listRuleId" : "contactName"
                },
                {
                  "context" : "name",
                  "contextType" : "variable",
                  "element" : "given",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "patient.contactperson.phone",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'patient.contactperson.phone') and answer.exists())"
                }
              ],
              "rule" : [
                {
                  "name" : "patient.phone",
                  "source" : [
                    {
                      "context" : "item",
                      "element" : "answer",
                      "variable" : "answer"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "telecom",
                      "variable" : "value"
                    },
                    {
                      "context" : "value",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "phone"
                        }
                      ]
                    },
                    {
                      "context" : "value",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "answer.value"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "patient.email",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'patient.contactperson.email') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "contact",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "email"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "patient.contactperson.relationship",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'patient.contactperson.relationship') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "contact",
                  "contextType" : "variable",
                  "element" : "relationship",
                  "variable" : "relationship"
                },
                {
                  "context" : "relationship",
                  "contextType" : "variable",
                  "element" : "text",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "RequestedEncounterItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "RequestedEncounterItems",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "encounter",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Encounter"
                }
              ]
            },
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "planned"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "encounter",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "requestedEncounter.class",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'requestedEncounter.class') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "encounter",
                  "contextType" : "variable",
                  "element" : "class",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "requestedEncounter.desiredAccommodation",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'requestedEncounter.desiredAccommodation') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "encounter",
                  "contextType" : "variable",
                  "element" : "extension",
                  "variable" : "extension"
                },
                {
                  "context" : "extension",
                  "contextType" : "variable",
                  "element" : "url",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation"
                    }
                  ]
                },
                {
                  "context" : "extension",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Coverage",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "coverage.beneficiary",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.beneficiary')"
            }
          ],
          "rule" : [
            {
              "name" : "coverage.beneficiary.ahvn13",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.beneficiary.ahvn13') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "patient",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "urn:oid:2.16.756.5.32"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coveragekvg",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.kvg')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "KVG"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.kvg.name",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.kvg.name') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "coverage.kvg.insuranceCardNumber",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.kvg.insuranceCardNumber') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "typeid"
                },
                {
                  "context" : "typeid",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "VeKa"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coverageuvg",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.uvg')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "UVG"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.uvg.name",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.uvg.name') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "coverage.uvg.claimNumber",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.uvg.claimNumber') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "typeid"
                },
                {
                  "context" : "typeid",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Claim"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coveragevvg",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.vvg')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "VVG"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.vvg.name",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.vvg.name') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "coverage.vvg.insuranceCardNumber",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.vvg.insuranceCardNumber') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "typeid"
                },
                {
                  "context" : "typeid",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "VeKa"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coverageiv",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.iv')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "IVG"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.iv.verfuegungsnummer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.iv.verfuegungsnummer') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "typeid"
                },
                {
                  "context" : "typeid",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "IV"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "IV"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coveragemv",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.mv')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "MVG"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.mv.versichertennummer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.mv.versichertennummer') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "typeid"
                },
                {
                  "context" : "typeid",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "MV"
                    }
                  ]
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "MV"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "self",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.self')"
            }
          ],
          "rule" : [
            {
              "name" : "payor",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.self.patient') and answer.exists() and answer.value)"
                }
              ],
              "target" : [
                {
                  "context" : "bundle",
                  "contextType" : "variable",
                  "element" : "entry",
                  "variable" : "e4"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "resource",
                  "variable" : "coverage",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Coverage"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid4",
                  "transform" : "uuid"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %uuid4"
                    }
                  ]
                },
                {
                  "context" : "serviceRequest",
                  "contextType" : "variable",
                  "element" : "insurance",
                  "variable" : "insurance"
                },
                {
                  "context" : "insurance",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %uuid4"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "active"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "beneficiary",
                  "variable" : "subject",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                },
                {
                  "context" : "subject",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %patient.id"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "type"
                },
                {
                  "context" : "type",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "Self"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "subject"
                },
                {
                  "context" : "subject",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "'urn:uuid:' + %patient.id"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "coverage.self.patientrelated.",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item2",
                  "condition" : "((linkId.value = 'coverage.self.patientRelatedPerson') and answer.exists() and answer.value)"
                }
              ],
              "rule" : [
                {
                  "name" : "coverage.self.relatedPerson",
                  "source" : [
                    {
                      "context" : "item",
                      "element" : "item",
                      "variable" : "item",
                      "condition" : "(linkId.value = 'coverage.self.relatedPerson')"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e5"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "coverage",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coverage"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid4",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %uuid4"
                        }
                      ]
                    },
                    {
                      "context" : "serviceRequest",
                      "contextType" : "variable",
                      "element" : "insurance",
                      "variable" : "insurance"
                    },
                    {
                      "context" : "insurance",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %uuid4"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "active"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "beneficiary",
                      "variable" : "subject",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "subject",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patient.id"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "type",
                      "variable" : "type"
                    },
                    {
                      "context" : "type",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Self"
                        }
                      ]
                    },
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e6"
                    },
                    {
                      "context" : "e6",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "relatedPerson",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "RelatedPerson"
                        }
                      ]
                    },
                    {
                      "context" : "relatedPerson",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid6",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e6",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid6"
                        }
                      ]
                    },
                    {
                      "context" : "coverage",
                      "contextType" : "variable",
                      "element" : "payor",
                      "variable" : "subject"
                    },
                    {
                      "context" : "subject",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %relatedPerson.id"
                        }
                      ]
                    },
                    {
                      "context" : "relatedPerson",
                      "contextType" : "variable",
                      "element" : "patient",
                      "variable" : "reference"
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patient.id"
                        }
                      ]
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "CoverageRelatedPersonItems",
                      "variable" : [
                        "item",
                        "relatedPerson"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coveragevvg",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "where(linkId.value = 'coverage.other')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "coverage",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Coverage"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "insurance",
              "variable" : "insurance"
            },
            {
              "context" : "insurance",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "beneficiary",
              "variable" : "subject",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "subject",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "coverage",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Other"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "coverage.other.name",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.other.name') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "payor",
                  "variable" : "payor"
                },
                {
                  "context" : "payor",
                  "contextType" : "variable",
                  "element" : "reference",
                  "variable" : "refcontained"
                },
                {
                  "context" : "refcontained",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "#org"
                    }
                  ]
                },
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "contained",
                  "variable" : "organization",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Organization"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "id",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "org"
                    }
                  ]
                },
                {
                  "context" : "organization",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "coverage.other.id",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'coverage.other.id') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "coverage",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "identifier"
                },
                {
                  "context" : "identifier",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "CoverageRelatedPersonItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "relatedPerson",
          "type" : "RelatedPerson",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.phone') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "coverage.self.relatedPerson.phone",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "relatedPerson",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "phone"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coverage.self.relatedPerson.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "coverage.self.relatedPerson.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "coverage.self.relatedPerson.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "coverage.self.relatedPerson.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "coverage.self.relatedPerson.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'coverage.self.relatedPerson.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderAuthorPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "recsender.author.practitioner.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderAuthorOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.gln",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.gln') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.51.1.3"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.zsr",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.zsr') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "identifier",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "sender.author.organization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.author.organization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderAuthorItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'sender.author.practitioner')"
            }
          ],
          "dependent" : [
            {
              "name" : "SenderAuthorPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'sender.author.organization')"
            }
          ],
          "dependent" : [
            {
              "name" : "SenderAuthorOrganizationItems",
              "variable" : [
                "item",
                "organization"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderDataEntererPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.dataenterer.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.dataenterer.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.dataenterer.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "sender.author.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'sender.dataenterer.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderDataEntererItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'sender.dataenterer.practitioner')"
            }
          ],
          "dependent" : [
            {
              "name" : "SenderDataEntererPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ChExtEprDataEnterer",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitionerRole",
          "type" : "PractitionerRole",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "url",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer"
                }
              ]
            }
          ]
        },
        {
          "name" : "practitionerRole",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "enterer"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %practitionerRole.id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "SenderAuthorInit",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "sender",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitionerRole",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "PractitionerRole"
                }
              ]
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid",
              "transform" : "uuid"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitioner",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Practitioner"
                }
              ]
            },
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "organization",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Organization"
                }
              ]
            },
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "author",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "requester",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid"
                }
              ]
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "practitioner",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "organization",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "sender.author",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'sender.author')"
                }
              ],
              "dependent" : [
                {
                  "name" : "SenderAuthorItems",
                  "variable" : [
                    "item",
                    "practitionerRole",
                    "practitioner",
                    "organization"
                  ]
                }
              ]
            },
            {
              "name" : "sender.dataenterer",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'sender.dataenterer')"
                }
              ],
              "rule" : [
                {
                  "name" : "sender.dataenterer.items",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e4"
                    },
                    {
                      "context" : "e4",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "practitionerRoleDataEnterer",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "PractitionerRole"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerRoleDataEnterer",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid4",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e4",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid4"
                        }
                      ]
                    },
                    {
                      "context" : "composition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "extension"
                    },
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e5"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "practitionerDataEnterer",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Practitioner"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerDataEnterer",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid5",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid5"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerRoleDataEnterer",
                      "contextType" : "variable",
                      "element" : "practitioner",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid5"
                        }
                      ]
                    },
                    {
                      "context" : "practitionerRoleDataEnterer",
                      "contextType" : "variable",
                      "element" : "organization",
                      "variable" : "reference",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "reference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid3"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "data",
                      "source" : [
                        {
                          "context" : "item"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "SenderDataEntererItems",
                          "variable" : [
                            "item",
                            "practitionerRoleDataEnterer",
                            "practitionerDataEnterer",
                            "organization"
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "extension",
                      "source" : [
                        {
                          "context" : "item"
                        }
                      ],
                      "dependent" : [
                        {
                          "name" : "ChExtEprDataEnterer",
                          "variable" : [
                            "item",
                            "practitionerRoleDataEnterer",
                            "extension"
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverCopyRelatedPersonItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "relatedPerson",
          "type" : "RelatedPerson",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "name"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.phone') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "receiverCopy.relatedPerson.phone",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "relatedPerson",
                  "contextType" : "variable",
                  "element" : "telecom",
                  "variable" : "value"
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "phone"
                    }
                  ]
                },
                {
                  "context" : "value",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.relatedPerson.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "receiverCopy.relatedPerson.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.relatedPerson.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.relatedPerson.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.relatedPerson.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.relatedPerson.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverCopyPractitionerItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "practitioner",
          "type" : "Practitioner",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "family",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "given",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.practitioner.title",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.title') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "name",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "practitionerName"
            },
            {
              "context" : "name",
              "contextType" : "variable",
              "element" : "prefix",
              "variable" : "prefix",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            },
            {
              "context" : "prefix",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "ext"
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
                }
              ]
            },
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "value",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "code"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "AC"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.practitioner.phone",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.phone') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "phone"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.practitioner.email",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.email') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "telecom",
              "variable" : "value"
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "email"
                }
              ]
            },
            {
              "context" : "value",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverCopyOrganizationItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "organization",
          "type" : "Organization",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.name') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "item.answer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            }
          ],
          "rule" : [
            {
              "name" : "receiverCopy.practitionerRole.organization.streetAddressLine",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "address",
                  "contextType" : "variable",
                  "element" : "line",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.organization.postalCode",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.postalCode') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "postalCode",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.organization.city",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.city') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopy.practitionerRole.organization.country",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.country') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "address",
              "variable" : "address",
              "listMode" : [
                "share"
              ],
              "listRuleId" : "orgAddress"
            },
            {
              "context" : "address",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverCopyPractitionerRoleItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "practitionerRole",
          "type" : "practitionerRole",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'receiverCopy.practitionerRole.practitioner')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitioner",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Practitioner"
                }
              ]
            },
            {
              "context" : "practitioner",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid2",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "practitioner",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            },
            {
              "context" : "e2",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid2"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverCopyPractitionerItems",
              "variable" : [
                "item",
                "practitioner"
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'receiverCopy.practitionerRole.organization')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e3"
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "organization",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Organization"
                }
              ]
            },
            {
              "context" : "organization",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid3",
              "transform" : "uuid"
            },
            {
              "context" : "practitionerRole",
              "contextType" : "variable",
              "element" : "organization",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            },
            {
              "context" : "e3",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid3"
                }
              ]
            }
          ],
          "dependent" : [
            {
              "name" : "ReceiverCopyOrganizationItems",
              "variable" : [
                "item",
                "organization"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtOrfCopyReceiverPatient",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "url",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver"
                }
              ]
            }
          ]
        },
        {
          "name" : "patient",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ExtOrfCopyReceiver",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "res",
          "mode" : "target"
        },
        {
          "name" : "ext",
          "type" : "Extension",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "url",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver"
                }
              ]
            }
          ]
        },
        {
          "name" : "organization",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "ext",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %res.id"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ReceiverCopy",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "grp",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "receiverCopyPractitionerRole1",
          "source" : [
            {
              "context" : "grp",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = 'receiverCopy.practitionerRole')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "practitionerrole",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "PractitionerRole"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "practitionerrole",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "data",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "ReceiverCopyPractitionerRoleItems",
                  "variable" : [
                    "item",
                    "bundle",
                    "practitionerrole"
                  ]
                }
              ]
            },
            {
              "name" : "extension",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtOrfCopyReceiver",
                  "variable" : [
                    "item",
                    "practitionerrole",
                    "extension"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopyPractitionerRole2",
          "source" : [
            {
              "context" : "grp",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = 'receiverCopy.patient')"
            }
          ],
          "target" : [
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            }
          ],
          "rule" : [
            {
              "name" : "extension",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtOrfCopyReceiver",
                  "variable" : [
                    "item",
                    "patient",
                    "extension"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "receiverCopyPractitionerRole3",
          "source" : [
            {
              "context" : "grp",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = 'receiverCopy.relatedPerson')"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "relatedPerson",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "RelatedPerson"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "relatedPerson",
              "contextType" : "variable",
              "element" : "patient",
              "variable" : "reference"
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "data",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "ReceiverCopyRelatedPersonItems",
                  "variable" : [
                    "item",
                    "relatedPerson"
                  ]
                }
              ]
            },
            {
              "name" : "extension",
              "source" : [
                {
                  "context" : "item"
                }
              ],
              "dependent" : [
                {
                  "name" : "ExtOrfCopyReceiver",
                  "variable" : [
                    "item",
                    "relatedPerson",
                    "extension"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Appointment",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "grp",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "Appointment",
          "source" : [
            {
              "context" : "grp",
              "element" : "item"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e4"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "appointment",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Appointment"
                }
              ]
            },
            {
              "context" : "appointment",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid4",
              "transform" : "uuid"
            },
            {
              "context" : "e4",
              "contextType" : "variable",
              "element" : "fullUrl",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "extension",
              "variable" : "extension"
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "url",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime"
                }
              ]
            },
            {
              "context" : "extension",
              "contextType" : "variable",
              "element" : "value",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid4"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "proposed",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'appointment.status') and (answer.value.code = 'proposed'))"
                }
              ],
              "target" : [
                {
                  "context" : "appointment",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value.code"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "appointment.requestedPeriod",
                  "source" : [
                    {
                      "context" : "grp",
                      "element" : "item",
                      "variable" : "itemp",
                      "condition" : "(linkId.value = 'appointment.requestedPeriod')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "appointment.requestedPeriod.start",
                      "source" : [
                        {
                          "context" : "itemp",
                          "element" : "item",
                          "variable" : "item2",
                          "condition" : "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "appointment",
                          "contextType" : "variable",
                          "element" : "requestedPeriod",
                          "variable" : "requestedPeriod"
                        },
                        {
                          "context" : "requestedPeriod",
                          "contextType" : "variable",
                          "element" : "start",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item2.answer.value"
                            }
                          ]
                        },
                        {
                          "context" : "requestedPeriod",
                          "contextType" : "variable",
                          "element" : "end",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item2.answer.value"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "appointment.requestedPeriod.end.if.not.same.as.start",
                          "source" : [
                            {
                              "context" : "itemp",
                              "element" : "item",
                              "variable" : "item3",
                              "condition" : "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "requestedPeriod",
                              "contextType" : "variable",
                              "element" : "end",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "item3.answer.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "pendingorbooked",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'appointment.status') and ((answer.value.code = 'pending') or (answer.value.code = 'booked')))"
                }
              ],
              "target" : [
                {
                  "context" : "appointment",
                  "contextType" : "variable",
                  "element" : "status",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value.code"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "appointment.startend",
                  "source" : [
                    {
                      "context" : "grp",
                      "element" : "item",
                      "variable" : "itemp",
                      "condition" : "(linkId.value = 'appointment.requestedPeriod')"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "appointment.start",
                      "source" : [
                        {
                          "context" : "itemp",
                          "element" : "item",
                          "variable" : "item2",
                          "condition" : "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "appointment",
                          "contextType" : "variable",
                          "element" : "start",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item2.answer.value"
                            }
                          ]
                        },
                        {
                          "context" : "appointment",
                          "contextType" : "variable",
                          "element" : "end",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item2.answer.value"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "appointment.end.if.not.same.as.start",
                          "source" : [
                            {
                              "context" : "itemp",
                              "element" : "item",
                              "variable" : "item3",
                              "condition" : "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "appointment",
                              "contextType" : "variable",
                              "element" : "end",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "item3.answer.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "appointment.patientInstruction",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "((linkId.value = 'appointment.patientInstruction') and answer.exists())"
                }
              ],
              "target" : [
                {
                  "context" : "appointment",
                  "contextType" : "variable",
                  "element" : "patientInstruction",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "appointment.location",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'appointment.location')"
                }
              ],
              "rule" : [
                {
                  "name" : "location",
                  "source" : [
                    {
                      "context" : "item"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e5"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "location",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Location"
                        }
                      ]
                    },
                    {
                      "context" : "location",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid5",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "e5",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %uuid5"
                        }
                      ]
                    },
                    {
                      "context" : "appointment",
                      "contextType" : "variable",
                      "element" : "participant",
                      "variable" : "participant"
                    },
                    {
                      "context" : "participant",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "tentative"
                        }
                      ]
                    },
                    {
                      "context" : "participant",
                      "contextType" : "variable",
                      "element" : "actor",
                      "variable" : "actor",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Reference"
                        }
                      ]
                    },
                    {
                      "context" : "actor",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %location.id"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "item",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.name') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "name",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.phone",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.phone') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "telecom",
                          "variable" : "value"
                        },
                        {
                          "context" : "value",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "phone"
                            }
                          ]
                        },
                        {
                          "context" : "value",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.email",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.email') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "telecom",
                          "variable" : "value"
                        },
                        {
                          "context" : "value",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "email"
                            }
                          ]
                        },
                        {
                          "context" : "value",
                          "contextType" : "variable",
                          "element" : "value",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.streetAddressLine",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.streetAddressLine') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "listMode" : [
                            "share"
                          ],
                          "listRuleId" : "orgAddress"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "line",
                          "source" : [
                            {
                              "context" : "item",
                              "element" : "answer",
                              "variable" : "answer"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "address",
                              "contextType" : "variable",
                              "element" : "line",
                              "transform" : "evaluate",
                              "parameter" : [
                                {
                                  "valueString" : "answer.value"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.postalCode",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.postalCode') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "listMode" : [
                            "share"
                          ],
                          "listRuleId" : "orgAddress"
                        },
                        {
                          "context" : "address",
                          "contextType" : "variable",
                          "element" : "postalCode",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.city",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.city') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "listMode" : [
                            "share"
                          ],
                          "listRuleId" : "orgAddress"
                        },
                        {
                          "context" : "address",
                          "contextType" : "variable",
                          "element" : "city",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "appointment.location.country",
                      "source" : [
                        {
                          "context" : "item",
                          "element" : "item",
                          "variable" : "item3",
                          "condition" : "((linkId.value = 'appointment.location.country') and answer.exists())"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "location",
                          "contextType" : "variable",
                          "element" : "address",
                          "variable" : "address",
                          "listMode" : [
                            "share"
                          ],
                          "listRuleId" : "orgAddress"
                        },
                        {
                          "context" : "address",
                          "contextType" : "variable",
                          "element" : "country",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "item3.answer.value"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PreviousResults",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "grp",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "item",
          "source" : [
            {
              "context" : "grp",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId = 'previousResults.attachment') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "media",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Attachment",
                      "element" : "value",
                      "variable" : "attachment"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "bundle",
                      "contextType" : "variable",
                      "element" : "entry",
                      "variable" : "e"
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "resource",
                      "variable" : "media",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Media"
                        }
                      ]
                    },
                    {
                      "context" : "media",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "media",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "completed"
                        }
                      ]
                    },
                    {
                      "context" : "e",
                      "contextType" : "variable",
                      "element" : "fullUrl",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "urn:uuid:"
                        },
                        {
                          "valueId" : "uuid"
                        }
                      ]
                    },
                    {
                      "context" : "media",
                      "contextType" : "variable",
                      "element" : "content",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "attachment"
                        }
                      ]
                    },
                    {
                      "context" : "serviceRequest",
                      "contextType" : "variable",
                      "element" : "supportingInfo",
                      "variable" : "supportingInfo"
                    },
                    {
                      "context" : "supportingInfo",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + uuid"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "Note",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "grp",
          "type" : "BackboneElement",
          "mode" : "source"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "note.text",
          "source" : [
            {
              "context" : "grp",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId = 'note.text') and answer.exists())"
            }
          ],
          "target" : [
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "note",
              "variable" : "note"
            },
            {
              "context" : "note",
              "contextType" : "variable",
              "element" : "text",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "item.answer.value"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "QrToBundle",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "qr",
          "type" : "QuestionnaireResponse",
          "mode" : "source"
        },
        {
          "name" : "q",
          "type" : "Questionnaire",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "questionnaireresp",
          "type" : "QuestionnaireResponseTarget",
          "mode" : "target"
        },
        {
          "name" : "servicerequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        },
        {
          "name" : "composition",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "id",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "id",
              "transform" : "uuid"
            }
          ]
        },
        {
          "name" : "type",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "type",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "document"
                }
              ]
            }
          ]
        },
        {
          "name" : "composition",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "dependent" : [
            {
              "name" : "OrfComposition",
              "variable" : [
                "qr",
                "q",
                "composition",
                "patient",
                "questionnaireresp",
                "servicerequest",
                "bundle"
              ]
            }
          ]
        },
        {
          "name" : "qrgroups",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "dependent" : [
            {
              "name" : "QrToGroups",
              "variable" : [
                "qr",
                "patient",
                "bundle",
                "composition",
                "servicerequest"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "OrfComposition",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "qr",
          "type" : "QuestionnaireResponse",
          "mode" : "source"
        },
        {
          "name" : "q",
          "type" : "Questionnaire",
          "mode" : "target"
        },
        {
          "name" : "tgt",
          "type" : "Composition",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "questionnaireresp",
          "type" : "QuestionnaireResponseTarget",
          "mode" : "target"
        },
        {
          "name" : "servicerequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "status",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "subject",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "sections",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "section",
              "variable" : "tgtSection"
            },
            {
              "context" : "tgtSection",
              "contextType" : "variable",
              "element" : "title",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Order-Referral"
                }
              ]
            },
            {
              "context" : "tgtSection",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "code"
            },
            {
              "context" : "code",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://loinc.org"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "93037-0"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "display",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Portable medical order form"
                }
              ]
            },
            {
              "context" : "tgtSection",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %questionnaireresp.id"
                }
              ]
            },
            {
              "context" : "tgtSection",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %servicerequest.id"
                }
              ]
            },
            {
              "context" : "tgtSection",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %q.id"
                }
              ]
            }
          ]
        },
        {
          "name" : "servicerequest",
          "source" : [
            {
              "context" : "qr"
            }
          ],
          "target" : [
            {
              "context" : "servicerequest",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "active"
                }
              ]
            },
            {
              "context" : "servicerequest",
              "contextType" : "variable",
              "element" : "intent",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "order"
                }
              ]
            },
            {
              "context" : "servicerequest",
              "contextType" : "variable",
              "element" : "subject",
              "variable" : "reference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            },
            {
              "context" : "reference",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %patient.id"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}