CH ALIS (R4)
0.3.0 - CI build Switzerland flag

CH ALIS (R4), published by ALIS-Connect. This guide is not an authorized publication; it is the continuous build for version 0.3.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/ahdis/ch-alis/ and changes regularly. See the Directory of published versions

: Alis43ToBundle - TTL Representation

Draft as of 2024-12-20

Raw ttl | Download

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

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

 a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "Alis43ToBundle"] ; # 
  fhir:meta [
fhir:lastUpdated [ fhir:v "2024-05-01T13:40:44.080+00:00"^^xsd:dateTime ]
  ] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n         <pre>/// url = &quot;http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle&quot;\n/// name = &quot;Alis43ToBundle&quot;\n/// title = &quot;null&quot;\n/// status = &quot;draft&quot;\n\n// Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide,\n// 2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License,\n// FHIR: http://hl7.org/fhir/r4/.\n// ISSUE7: what are the URL's oid's we have to define.\n\nconceptmap &quot;serviceMap&quot; {\n  prefix s = &quot;http://fhir.ch/ig/ch-alis&quot;\n  prefix t = &quot;http://hl7.org/fhir&quot;\n\n  s:TARMED == t:&quot;urn:oid:2.16.756.5.30.1.129.1.4&quot;\n  s:ICD10 == t:&quot;urn:oid:2.16.756.5.30.1.126.3.2&quot;\n}\n\nconceptmap &quot;gender&quot; {\n  prefix s = &quot;http://fhir.ch/ig/ch-alis&quot;\n  prefix t = &quot;http://hl7.org/fhir/ValueSet/administrative-gender&quot;\n\n  s:M == t:male\n  s:F == t:female\n}\n\nconceptmap &quot;laterality&quot; {\n  prefix s = &quot;http://fhir.ch/ig/ch-alis&quot;\n  prefix t = &quot;http://snomed.info/sct&quot;\n\n  s:l == t:&quot;7771000&quot;\n  s:r == t:&quot;24028007&quot;\n  s:b == t:&quot;51440002&quot;\n}\n\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/Header&quot; alias Header as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/Visit&quot; alias Visit as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/Service&quot; alias Service as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40&quot; alias PersonV40 as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40&quot; alias ParameterV40 as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup&quot; alias DiagGroup as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure&quot; alias Proc as source\nuses &quot;http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis&quot; alias Diagnosis as source\nuses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/ChargeItem&quot; alias ChargeItem as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Extension&quot; alias Extension as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/MessageHeader&quot; alias MessageHeader as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/BackboneElement&quot; alias BackboneElement as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/HumanName&quot; alias HumanName as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Condition&quot; alias Condition as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Encounter&quot; alias Encounter as target\nuses &quot;http://hl7.org/fhir/StructureDefinition/Procedure&quot; alias Procedure as target\n\ngroup Alis43ToBundle(source header : Header, target bundle : Bundle) {\n  header -&gt;  bundle.meta as meta,  meta.profile as profile,  profile.value = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-message',  bundle.entry as e,  e.resource = create('MessageHeader') as messageHeader,  messageHeader.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  bundle.entry as e2,  e2.resource = create('Bundle') as transactionBundle,  transactionBundle.id = uuid() as uuid2,  e2.fullUrl = append('urn:uuid:', uuid2),  messageHeader.focus = create('Reference') as reference,  reference.type = 'Bundle',  reference.reference = append('urn:uuid:', uuid2) then {\n    header then Alis43ToMessageHeader(header, messageHeader) &quot;messageHeader&quot;;\n    header then Alis43ToBundleTransaction(header, transactionBundle) &quot;bundleTransaction&quot;;\n  } &quot;bundle&quot;;\n  header -&gt; bundle.type = 'message' &quot;type&quot;;\n  header.FileCreationDate as fileCreationDate then {\n    fileCreationDate.data as date -&gt; bundle.timestamp = date &quot;date&quot;;\n  };\n}\n\ngroup Alis43ToMessageHeader(source header : Header, target messageHeader : MessageHeader) {\n  // ISSUE1: should be link to a MessageDefinition or a code?\n  header -&gt;  messageHeader.event = create('uri') as value,  value.value = 'http://fhir.ch/ig/ch-alis-43' &quot;eventUri&quot;;\n  // ISSUE2: MessageControlID cannot be id of entry, needs to be either fullUrl oder uuid, need to map this to an identifier\n  header -&gt; messageHeader.source as source then {\n    header.SoftwareReleaseNumber as version -&gt; source.version = (%version.data) &quot;version&quot;;\n    // ISSUE3: &quot; : &quot;urn:SendingApplication:SendingFacility:SendingServiceCode&quot; -&gt; add urn: in example/docu\n    header -&gt; source.endpoint = ('urn:' + %header.SendingApplication.data + ':' + %header.SendingFacility.data + ':' + %header.SendingServiceCode.data) &quot;endpoint&quot;;\n  } &quot;source&quot;;\n  header -&gt; messageHeader.destination as destination then {\n    // ISSUE4: &quot; : &quot;urn:ReceivingApplication, ReceivingFacility, ReceivingServiceCode&quot; -&gt; add urn: in example/docu\n    header -&gt; destination.endpoint = ('urn:' + %header.ReceivingApplication.data + ':' + %header.ReceivingFacility.data + ':' + %header.ReceivingServiceCode.data) &quot;endpoint&quot;;\n  } &quot;destination&quot;;\n}\n\ngroup Alis43ToBundleTransaction(source header : Header, target transactionBundle : Bundle) {\n  header -&gt; transactionBundle.type = 'transaction' &quot;transaction&quot;;\n  header.Visit as visit then {\n    visit.Service as service -&gt;  transactionBundle.entry as e,  e.resource = create('ChargeItem') as chargeItem then ServiceToChargeItem(service, visit, chargeItem, e) &quot;ServiceToChargeItem&quot;;\n  };\n}\n\ngroup ServiceToChargeItem(source service : Service, source visit : Visit, target chargeItem : ChargeItem, target entry) {\n  service.ItemNumber as itemNumber -&gt;  chargeItem.id = (%itemNumber.data.lower()) as uuid,  entry.fullUrl = append('urn:uuid:', uuid) &quot;R311LaufnummerItemNumber&quot;;\n  service -&gt;  chargeItem.contained = create('Patient') as patient,  patient.id = 'pat' as containedid,  chargeItem.subject = create('Reference') as ref,  ref.reference = ('#' + %containedid) then ServiceToPatient(service, visit, patient) &quot;patient&quot;;\n  visit -&gt;  chargeItem.contained = create('Encounter') as encounter,  encounter.id = 'enc' as containedid,  chargeItem.context = create('Reference') as ref,  ref.reference = ('#' + %containedid) then {\n    visit then VisitToEncounter(visit, encounter) &quot;VisitToEncounter&quot;;\n    service.Diagnosis as diag -&gt;  chargeItem.contained = create('Condition') as condition,  condition.id = uuid() as containedid,  encounter.diagnosis as diag,  diag.condition = create('Reference') as ref,  ref.reference = ('#' + %containedid) then DiagnosisToCondition(diag, condition) &quot;DiagnosisToCondition&quot;;\n  } &quot;encounter&quot;;\n  visit.DiagGroup as diaggroup -&gt;  chargeItem.contained = create('Condition') as cond,  cond.id = 'cond' as containedid then DiagGroupToCondition(diaggroup, cond) &quot;DiagGroupToCondition&quot;;\n  service where (service.Transaction.exists() = false) -&gt;  entry.request as request,  request.method = 'POST',  request.url = 'ChargeItem' &quot;POSTDEFAULT&quot;;\n  service.Transaction where (service.Transaction = 'insert') -&gt;  entry.request as request,  request.method = 'POST',  request.url = 'ChargeItem' &quot;POST&quot;;\n  service.Transaction where (service.Transaction = 'update') -&gt;  entry.request as request,  request.method = 'PUT',  request.url = 'ChargeItem' &quot;UPDATE&quot;;\n  service.Transaction where (service.Transaction = 'delete') -&gt;  entry.request as request,  request.method = 'DELETE',  request.url = 'ChargeItem' &quot;DELETE&quot;;\n  service.SessionID as sessionID -&gt;  chargeItem.extension as extension,  extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-sessionid',  extension.value = create('string') as value,  value.value = (%sessionID.data) &quot;R32SitzungSessionID&quot;;\n  service.OrderID as orderID -&gt;  chargeItem.extension as extension,  extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderid',  extension.value = create('string') as value,  value.value = (%orderID.data) &quot;R33AuftragsnummerOrderID&quot;;\n  service.OrderDate as orderDate -&gt;  chargeItem.extension as extension,  extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderdate',  extension.value = create('dateTime') as value,  value.value = (%orderDate.data) &quot;R33AuftragsnummerOrderID&quot;;\n  service.Form as form -&gt;  chargeItem.extension as extension,  extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-form',  extension.value = create('string') as value,  value.value = (%form.data) &quot;R37FormularbezeichnungForm&quot;;\n  service.ParameterV40 as parameterV40 -&gt;  chargeItem.extension as extension,  extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-parameterv40' then ParameterV40ToExtension(parameterV40, extension) &quot;R4ParamterV40ParameterV40&quot;;\n  service -&gt; chargeItem.status = 'billable' &quot;billable&quot;;\n  service.RefItemNumber as refItemNumber then {\n    refItemNumber.data as data -&gt;  chargeItem.partOf = create('Reference') as ref,  ref.reference = ('urn:uuid:' + %data.lower()),  ref.type = 'ChargeItem' &quot;R312ReferenzzuHauptleistungRefItemNumber&quot;;\n  };\n  service.ServiceItem as serviceItem then {\n    serviceItem.data as data -&gt;  chargeItem.code = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = data then {\n      service.ServiceType as serviceType then {\n        serviceType.data as data -&gt; coding.system = translate(data, '#serviceMap', 'code') &quot;R35KatalogServiceType&quot;;\n      } &quot;servicType&quot;;\n    } &quot;R36TarifpositionServiceItem&quot;;\n  } &quot;R36Tarifposition&quot;;\n  service.ServiceDate as serviceData -&gt;  chargeItem.occurrence = create('dateTime') as occurrence,  occurrence.value = (%serviceData.data) &quot;R31LeistungsdatumServiceDate&quot;;\n  service.PersonV40 as personV40 -&gt; chargeItem.performer = create('BackboneElement') as performer then PersonV40ToPerformer(personV40, performer) &quot;R315PersonV40PersonV40&quot;;\n  service.ProviderID as providerID -&gt;  chargeItem.performingOrganization = create('Reference') as reference,  reference.display = (%providerID.data) &quot;R39ErbringendeOrganizationProviderID&quot;;\n  service.ReferrerID as referrerID -&gt;  chargeItem.costCenter = create('Reference') as reference,  reference.display = (%referrerID.data) &quot;R34AuftraggebendeKostenstelleReferrerID&quot;;\n  service.Quantity as quantity -&gt;  chargeItem.quantity = create('Quantity') as q,  q.value as value,  value.value = (%quantity.data) &quot;R313AnzahlQuantity&quot;;\n  service.EnteredBy as enteredBy -&gt;  chargeItem.enterer = create('Reference') as reference,  reference.display = (%enteredBy.data) &quot;R310ErfasserEnteredBy&quot;;\n  service.EnteredDateTime as enteredDateTime -&gt;  chargeItem.enteredDate = create('dateTime') as enteredDate,  enteredDate.value = (%enteredDateTime.data) &quot;R38ErfassungsdatumEnteredDateTime&quot;;\n  service.PatientContactID as patientContactID then {\n    patientContactID.data as data -&gt;  chargeItem.identifier = create('Identifier') as identifier,  identifier.value = data &quot;PatientContactID&quot;;\n  } &quot;patientContactID&quot;;\n  service.Costweight as costweight then {\n    costweight.data as data -&gt; chargeItem.factorOverride = data &quot;Costweight&quot;;\n  } &quot;costweight&quot;;\n  service.Procedure as proc -&gt;  chargeItem.contained = create('Procedure') as procedure,  procedure.id = uuid() as containedid,  chargeItem.service = create('Reference') as service,  service.reference = ('#' + %containedid) then ServiceProcedureToFhirProcedure(proc, procedure) &quot;ServiceProcedureToFhirProcedure&quot;;\n}\n\ngroup ServiceProcedureToFhirProcedure(source proc : Proc, target procedure : Procedure) {\n  proc.Identifier as identifier -&gt;  procedure.identifier = create('Identifier') as identifier,  identifier.value = (%identifier.data) &quot;R314ProzedurIDIdentifier&quot;;\n  proc.Code as chopcode where (%proc.Category.data = 'CHOP_2023') -&gt;  procedure.code = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = (%chopcode.data),  coding.system = 'https://www.bfs.admin.ch/bfs/statistiche/catalog/chop2023',  coding.display = (%proc.Display.data) &quot;R316ProzedurcodeCode&quot;;\n  proc.PerformedDateTime as performedDateTime -&gt; procedure.performed = (%performedDateTime.data) &quot;R317DatumZeitPerformedDateTime&quot;;\n  proc.Laterality as laterality then {\n    laterality.data as v -&gt;  procedure.bodySite = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = translate(v, '#laterality', 'code'),  coding.system = 'http://snomed.info/sct',  coding.display = (%proc.LateralityDisplay.data) &quot;R318SeiteLaterality&quot;;\n  } &quot;laterality&quot;;\n  proc.Performer as performer then {\n    // TODO Perfomer.function\n    performer.Identifier as identifier then {\n      identifier.data as data -&gt;  procedure.performer as performer,  performer.actor as actor,  actor.identifier as identifier,  identifier.value = data &quot;identifier&quot;;\n    };\n  } &quot;performer&quot;;\n  proc -&gt;  procedure.subject = create('Reference') as ref,  ref.reference = '#pat' &quot;containedpatient&quot;;\n  proc -&gt; procedure.status = 'completed' &quot;status&quot;;\n}\n\ngroup PersonV40ToPerformer(source personV40 : PersonV40, target performer) {\n  personV40.PersonTyp as personTyp -&gt;  performer.function as cc,  cc.coding as coding,  coding.system as system,  system.value = 'http://fhir.ch/ig/ch-alis/CodeSystem/ch-alis-persontyp',  coding.code as code,  code.value = personTyp &quot;R3152PersonIDPersonID&quot;;\n  personV40.PersonID as personId -&gt;  performer.actor = create('Reference') as reference,  reference.display = (%personId.data) &quot;R3152PersonIDPersonID&quot;;\n}\n\ngroup ParameterV40ToExtension(source parameterV40 : ParameterV40, target extension : Extension) {\n  parameterV40.ParamTyp as paramTyp -&gt; extension.extension as extInner then InnerExtensionParamTyp(paramTyp, extInner);\n  parameterV40.ParamValue as paramValue then {\n    paramValue.data as data -&gt; extension.extension as extInner then InnerExtensionParamValue(data, extInner);\n  };\n}\n\ngroup InnerExtensionParamTyp(source src, target ext : Extension) {\n  src -&gt; ext.url = 'ParamTyp' &quot;url&quot;;\n  src -&gt;  ext.value = create('CodeableConcept') as cc,  cc.text as text,  text.value = src &quot;string&quot;;\n}\n\ngroup InnerExtensionParamValue(source src, target ext : Extension) {\n  src -&gt; ext.url = 'ParamValue' &quot;url&quot;;\n  src -&gt;  ext.value = create('string') as string,  string.value = src &quot;string&quot;;\n}\n\ngroup ServiceToPatientName(source visit : Visit, target name : HumanName) {\n  visit.PatientName as patientName then {\n    patientName.data as data -&gt; name.family = data &quot;R23PatientNamePatientName&quot;;\n  } &quot;patientName&quot;;\n  visit.PatientGivenName as patientGivenName then {\n    patientGivenName.data as data -&gt; name.given = data &quot;R24PatientVornamePatientGivenName&quot;;\n  } &quot;patientGivenName&quot;;\n}\n\ngroup ServiceToPatient(source service : Service, source visit : Visit, target patient : Patient) {\n  visit.PatientID as patientID then {\n    patientID.data as patId -&gt;  patient.identifier as identifier,  identifier.value as value,  value.value = patId,  identifier.system as idsystem,  idsystem.value = 'http://www.example.ch/patienteniddomain',  identifier.type as type,  type.coding as coding,  coding.system as system,  system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203',  coding.code as code,  code.value = 'MR' &quot;R22PatientPIDPatientID&quot;;\n  } &quot;patientID&quot;;\n  // &lt;!-- 2.2 Patient.PID (PatientID) --&gt;\n  // &lt;identifier&gt;\n  // &lt;type&gt;\n  // &lt;coding&gt;\n  // &lt;system value=&quot;http://terminology.hl7.org/CodeSystem/v2-0203&quot; /&gt;\n  // &lt;code value=&quot;MR&quot; /&gt;\n  // &lt;display value=&quot;Medical record number&quot;/&gt;\n  // &lt;/coding&gt;\n  // &lt;/type&gt;\n  // ISSUE8: what do with system value\n  // &lt;system value=&quot;http://www.example.ch/patienteniddomain&quot;/&gt;\n  // &lt;value value=&quot;Patienten-ID&quot;/&gt;\n  // &lt;/identifier&gt;//\n  visit where (visit.PatientName or visit.PatientGivenName) -&gt; patient.name as name then ServiceToPatientName(visit, name) &quot;ServiceToPatient&quot;;\n  visit.PatientGender as gender then {\n    gender.data as v -&gt; patient.gender = translate(v, '#gender', 'code') &quot;gender&quot;;\n  } &quot;R26PatientGeschlechtPatientGender&quot;;\n  visit.PatientBirthDate as birthDate then {\n    birthDate.data as v -&gt; patient.birthDate = v &quot;birthDate&quot;;\n  } &quot;R25PatientGebDatumPatientBirthDate&quot;;\n}\n\ngroup DiagnosisToCondition(source diagnosis : Diagnosis, target cond : Condition) {\n  diagnosis -&gt;  cond.subject = create('Reference') as ref,  ref.reference = '#pat' &quot;containedpatient&quot;;\n  // * Identifier 0..1 http://fhir.ch/ig/ch-alis/StructureDefinition/Text &quot;TODO&quot;\n  diagnosis.Identifier as identifier then {\n    identifier.data as data -&gt;  cond.identifier as identifier,  identifier.value = data &quot;identifier&quot;;\n  };\n  diagnosis.Code as code -&gt;  cond.code = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = (%code.data),  coding.display = (%diagnosis.Display.data) then {\n    diagnosis.Category as category then {\n      category.data as data where (startsWith('ICD')) -&gt; coding.system = 'http://hl7.org/fhir/sid/icd-10';\n    } &quot;serviceType&quot;;\n  } &quot;R316ProzedurcodeCode&quot;;\n  // TODO system is not yet correct\n  diagnosis.OnsetDateTime as onsetDateTime -&gt; cond.onset = (%onsetDateTime.data) &quot;onsetDateTime&quot;;\n  diagnosis.Laterality as laterality then {\n    laterality.data as v -&gt;  cond.bodySite = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = translate(v, '#laterality', 'code'),  coding.system = 'http://snomed.info/sct',  coding.display = (%diagnosis.LateralityDisplay.data) &quot;R318SeiteLaterality&quot;;\n  } &quot;laterality&quot;;\n}\n\ngroup DiagGroupToCondition(source diagGroup : DiagGroup, target cond : Condition) {\n  diagGroup -&gt;  cond.subject = create('Reference') as ref,  ref.reference = '#pat' &quot;containedpatient&quot;;\n  diagGroup.DiagCode as data -&gt;  cond.code = create('CodeableConcept') as cc,  cc.coding = create('Coding') as coding,  coding.code = data then {\n    diagGroup.DiagCatType as diagCatType then {\n      diagCatType.data as data -&gt; coding.system = translate(data, '#serviceMap', 'code') &quot;R293KatalogtypDiagCatType&quot;;\n    } &quot;serviceType&quot;;\n  } &quot;R291DiagnosecodeDiagCode&quot;;\n}\n\ngroup TerminationToExtension(source visit : Visit, target ext : Extension) {\n  visit.TerminationVisit as visit then {\n    visit.data as data -&gt;  ext.extension as ext1,  ext1.url = 'TerminationVisit',  ext1.value = create('date') as date,  date.value = data &quot;R27FallAbschlussTerminationVisit&quot;;\n  };\n  visit.TerminationReason as visit then {\n    visit.data as data -&gt;  ext.extension as ext1,  ext1.url = 'TerminationReason',  ext1.value = create('string') as string,  string.value = data &quot;R28FallAbschlussgrundTerminationReason&quot;;\n  } &quot;TerminationVisit&quot;;\n}\n\ngroup VisitToEncounter(source visit : Visit, target encounter : Encounter) {\n  visit where (visit.TerminationVisit or visit.TerminationReason) -&gt;  encounter.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-termination' then TerminationToExtension(visit, ext) &quot;TerminationToExtension&quot;;\n  visit.VisitNumber as visitNumber then {\n    // ISSUE8: what to do with falldomain? &lt;system value=&quot;http://www.example.ch/fallnummerdomain&quot;/&gt;\n    visitNumber.data as data -&gt;  encounter.identifier = create('Identifier') as identifier,  identifier.value as value,  value.value = data,  identifier.system as idsystem,  idsystem.value = 'http://www.example.ch/fallnummerdomain',  identifier.type as type,  type.coding as coding,  coding.system as system,  system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203',  coding.code as code,  code.value = 'VN' &quot;R21FallVisitNumber&quot;;\n  } &quot;encounterID&quot;;\n  visit -&gt; encounter.status = 'finished' &quot;Finished&quot;;\n  visit -&gt;  encounter.class as coding,  coding.system as system,  system.value = 'http://terminology.hl7.org/CodeSystem/v3-ActCode',  coding.code as code,  code.value = 'IMP',  coding.display as display,  display.value = 'inpatient encounter' &quot;R21FallVisitNumber&quot;;\n  visit -&gt;  encounter.subject = create('Reference') as ref,  ref.reference = '#pat' &quot;subject&quot;;\n  visit.DiagGroup as diaggroup -&gt;  encounter.diagnosis as diag,  diag.condition = create('Reference') as ref,  ref.reference = '#cond' then {\n    diaggroup.DiagType as diagType -&gt;  diag.use as use,  use.text = (%diagType.data) &quot;R292DiagnosetypDiagType&quot;;\n  } &quot;R29DiagnoseGruppeDiagGroup&quot;;\n}\n\n</pre>\n      </div>"
  ] ; # 
  fhir:contained ( [
a fhir:ConceptMap ;
fhir:id [ fhir:v "serviceMap" ] ;
fhir:status [ fhir:v "draft" ] ;
    ( fhir:group [
fhir:source [ fhir:v "http://fhir.ch/ig/ch-alis"^^xsd:anyURI ] ;
fhir:target [ fhir:v "http://hl7.org/fhir"^^xsd:anyURI ] ;
      ( fhir:element [
fhir:code [ fhir:v "TARMED" ] ;
        ( fhir:target [
fhir:code [ fhir:v "urn:oid:2.16.756.5.30.1.129.1.4" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] [
fhir:code [ fhir:v "ICD10" ] ;
        ( fhir:target [
fhir:code [ fhir:v "urn:oid:2.16.756.5.30.1.126.3.2" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] )     ] )
  ] [
a fhir:ConceptMap ;
fhir:id [ fhir:v "gender" ] ;
fhir:status [ fhir:v "draft" ] ;
    ( fhir:group [
fhir:source [ fhir:v "http://fhir.ch/ig/ch-alis"^^xsd:anyURI ] ;
fhir:target [ fhir:v "http://hl7.org/fhir/ValueSet/administrative-gender"^^xsd:anyURI ] ;
      ( fhir:element [
fhir:code [ fhir:v "M" ] ;
        ( fhir:target [
fhir:code [ fhir:v "male" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] [
fhir:code [ fhir:v "F" ] ;
        ( fhir:target [
fhir:code [ fhir:v "female" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] )     ] )
  ] [
a fhir:ConceptMap ;
fhir:id [ fhir:v "laterality" ] ;
fhir:status [ fhir:v "draft" ] ;
    ( fhir:group [
fhir:source [ fhir:v "http://fhir.ch/ig/ch-alis"^^xsd:anyURI ] ;
fhir:target [ fhir:v "http://snomed.info/sct"^^xsd:anyURI ] ;
      ( fhir:element [
fhir:code [ fhir:v "l" ] ;
        ( fhir:target [
fhir:code [ fhir:v "7771000" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] [
fhir:code [ fhir:v "r" ] ;
        ( fhir:target [
fhir:code [ fhir:v "24028007" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] [
fhir:code [ fhir:v "b" ] ;
        ( fhir:target [
fhir:code [ fhir:v "51440002" ] ;
fhir:equivalence [ fhir:v "equivalent" ]         ] )       ] )     ] )
  ] ) ; # 
  fhir:url [ fhir:v "http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "0.3.0"] ; # 
  fhir:name [ fhir:v "Alis43ToBundle"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2024-12-20T12:42:46+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "ALIS-Connect"] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "ALIS-Connect" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "https://www.alis-connect.ch/" ]     ] )
  ] ) ; # 
  fhir:description [ fhir:v "Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide,\r\n2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License,\r\nFHIR: http://hl7.org/fhir/r4/.\r\nISSUE7: what are the URL's oid's we have to define."] ; # 
  fhir:jurisdiction ( [
    ( fhir:coding [
fhir:system [ fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ] ;
fhir:code [ fhir:v "CH" ]     ] )
  ] ) ; # 
  fhir:copyright [ fhir:v "not-open-source"] ; # 
  fhir:structure ( [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/Header"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/Header>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "Header" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/Visit"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/Visit>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "Visit" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/Service"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/Service>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "Service" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "PersonV40" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "ParameterV40" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "DiagGroup" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "Proc" ]
  ] [
fhir:url [
fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis"^^xsd:anyURI ;
fhir:link <http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis>     ] ;
fhir:mode [ fhir:v "source" ] ;
fhir:alias [ fhir:v "Diagnosis" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Bundle" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/ChargeItem"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/ChargeItem>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "ChargeItem" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Extension"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Extension>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Extension" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/MessageHeader"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/MessageHeader>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "MessageHeader" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/BackboneElement"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/BackboneElement>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "BackboneElement" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/HumanName"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/HumanName>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "HumanName" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Condition"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Condition>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Condition" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Encounter"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Encounter>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Encounter" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Procedure"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Procedure>     ] ;
fhir:mode [ fhir:v "target" ] ;
fhir:alias [ fhir:v "Procedure" ]
  ] ) ; # 
  fhir:group ( [
fhir:name [ fhir:v "Alis43ToBundle" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "header" ] ;
fhir:type [ fhir:v "Header" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "bundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "bundle" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "meta" ] ;
fhir:variable [ fhir:v "meta" ]       ] [
fhir:context [ fhir:v "meta" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "profile" ] ;
fhir:variable [ fhir:v "profile" ]       ] [
fhir:context [ fhir:v "profile" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-message" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "messageHeader" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "MessageHeader" ]         ] )       ] [
fhir:context [ fhir:v "messageHeader" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e2" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "transactionBundle" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Bundle" ]         ] )       ] [
fhir:context [ fhir:v "transactionBundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid2" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "e2" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] [
fhir:context [ fhir:v "messageHeader" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "focus" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Bundle" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid2" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "messageHeader" ] ;
        ( fhir:source [
fhir:context [ fhir:v "header" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "Alis43ToMessageHeader" ] ;
          ( fhir:variable [ fhir:v "header" ] [ fhir:v "messageHeader" ] )         ] )       ] [
fhir:name [ fhir:v "bundleTransaction" ] ;
        ( fhir:source [
fhir:context [ fhir:v "header" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "Alis43ToBundleTransaction" ] ;
          ( fhir:variable [ fhir:v "header" ] [ fhir:v "transactionBundle" ] )         ] )       ] )     ] [
fhir:name [ fhir:v "type" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "message" ]         ] )       ] )     ] [
fhir:name [ fhir:v "FileCreationDate" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ] ;
fhir:element [ fhir:v "FileCreationDate" ] ;
fhir:variable [ fhir:v "fileCreationDate" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "date" ] ;
        ( fhir:source [
fhir:context [ fhir:v "fileCreationDate" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "date" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "bundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "timestamp" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "date" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Alis43ToMessageHeader" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "header" ] ;
fhir:type [ fhir:v "Header" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "messageHeader" ] ;
fhir:type [ fhir:v "MessageHeader" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "eventUri" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "messageHeader" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "event" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "uri" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis-43" ]         ] )       ] )     ] [
fhir:name [ fhir:v "source" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "messageHeader" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "source" ] ;
fhir:variable [ fhir:v "source" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "version" ] ;
        ( fhir:source [
fhir:context [ fhir:v "header" ] ;
fhir:element [ fhir:v "SoftwareReleaseNumber" ] ;
fhir:variable [ fhir:v "version" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "source" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "version" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%version.data" ]           ] )         ] )       ] [
fhir:name [ fhir:v "endpoint" ] ;
        ( fhir:source [
fhir:context [ fhir:v "header" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "source" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "endpoint" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:' + %header.SendingApplication.data + ':' + %header.SendingFacility.data + ':' + %header.SendingServiceCode.data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "destination" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "messageHeader" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "destination" ] ;
fhir:variable [ fhir:v "destination" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "endpoint" ] ;
        ( fhir:source [
fhir:context [ fhir:v "header" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "destination" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "endpoint" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:' + %header.ReceivingApplication.data + ':' + %header.ReceivingFacility.data + ':' + %header.ReceivingServiceCode.data" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "Alis43ToBundleTransaction" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "header" ] ;
fhir:type [ fhir:v "Header" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "transactionBundle" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "transaction" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "transactionBundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "transaction" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Visit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "header" ] ;
fhir:element [ fhir:v "Visit" ] ;
fhir:variable [ fhir:v "visit" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "ServiceToChargeItem" ] ;
        ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "Service" ] ;
fhir:variable [ fhir:v "service" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "transactionBundle" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "e" ]         ] [
fhir:context [ fhir:v "e" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "chargeItem" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]           ] )         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "ServiceToChargeItem" ] ;
          ( fhir:variable [ fhir:v "service" ] [ fhir:v "visit" ] [ fhir:v "chargeItem" ] [ fhir:v "e" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ServiceToChargeItem" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "service" ] ;
fhir:type [ fhir:v "Service" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "visit" ] ;
fhir:type [ fhir:v "Visit" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "chargeItem" ] ;
fhir:type [ fhir:v "ChargeItem" ] ;
fhir:mode [ fhir:v "target" ]     ] [
fhir:name [ fhir:v "entry" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "R311LaufnummerItemNumber" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ItemNumber" ] ;
fhir:variable [ fhir:v "itemNumber" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "uuid" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%itemNumber.data.lower()" ]         ] )       ] [
fhir:context [ fhir:v "entry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "fullUrl" ] ;
fhir:transform [ fhir:v "append" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "urn:uuid:" ]         ] [
fhir:value [ fhir:v "uuid" ]         ] )       ] )     ] [
fhir:name [ fhir:v "patient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "patient" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Patient" ]         ] )       ] [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "containedid" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "pat" ]         ] )       ] [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'#' + %containedid" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ServiceToPatient" ] ;
        ( fhir:variable [ fhir:v "service" ] [ fhir:v "visit" ] [ fhir:v "patient" ] )       ] )     ] [
fhir:name [ fhir:v "encounter" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "encounter" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Encounter" ]         ] )       ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "containedid" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "enc" ]         ] )       ] [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "context" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'#' + %containedid" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "VisitToEncounter" ] ;
        ( fhir:source [
fhir:context [ fhir:v "visit" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "VisitToEncounter" ] ;
          ( fhir:variable [ fhir:v "visit" ] [ fhir:v "encounter" ] )         ] )       ] [
fhir:name [ fhir:v "DiagnosisToCondition" ] ;
        ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Diagnosis" ] ;
fhir:variable [ fhir:v "diag" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "condition" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Condition" ]           ] )         ] [
fhir:context [ fhir:v "condition" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "containedid" ] ;
fhir:transform [ fhir:v "uuid" ]         ] [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "diagnosis" ] ;
fhir:variable [ fhir:v "diag" ]         ] [
fhir:context [ fhir:v "diag" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "condition" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'#' + %containedid" ]           ] )         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "DiagnosisToCondition" ] ;
          ( fhir:variable [ fhir:v "diag" ] [ fhir:v "condition" ] )         ] )       ] )     ] [
fhir:name [ fhir:v "DiagGroupToCondition" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "DiagGroup" ] ;
fhir:variable [ fhir:v "diaggroup" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "cond" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Condition" ]         ] )       ] [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "containedid" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "cond" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "DiagGroupToCondition" ] ;
        ( fhir:variable [ fhir:v "diaggroup" ] [ fhir:v "cond" ] )       ] )     ] [
fhir:name [ fhir:v "POSTDEFAULT" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:condition [ fhir:v "(service.Transaction.exists() = false)" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "entry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ]       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]         ] )       ] )     ] [
fhir:name [ fhir:v "POST" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Transaction" ] ;
fhir:condition [ fhir:v "(service.Transaction = 'insert')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "entry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ]       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "POST" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]         ] )       ] )     ] [
fhir:name [ fhir:v "UPDATE" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Transaction" ] ;
fhir:condition [ fhir:v "(service.Transaction = 'update')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "entry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ]       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "PUT" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]         ] )       ] )     ] [
fhir:name [ fhir:v "DELETE" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Transaction" ] ;
fhir:condition [ fhir:v "(service.Transaction = 'delete')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "entry" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "request" ] ;
fhir:variable [ fhir:v "request" ]       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "method" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "DELETE" ]         ] )       ] [
fhir:context [ fhir:v "request" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R32SitzungSessionID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "SessionID" ] ;
fhir:variable [ fhir:v "sessionID" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-sessionid" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "string" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%sessionID.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R33AuftragsnummerOrderID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "OrderID" ] ;
fhir:variable [ fhir:v "orderID" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderid" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "string" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%orderID.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R33AuftragsnummerOrderID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "OrderDate" ] ;
fhir:variable [ fhir:v "orderDate" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderdate" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "dateTime" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%orderDate.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R37FormularbezeichnungForm" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Form" ] ;
fhir:variable [ fhir:v "form" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-form" ]         ] )       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "string" ]         ] )       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%form.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R4ParamterV40ParameterV40" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ParameterV40" ] ;
fhir:variable [ fhir:v "parameterV40" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extension" ]       ] [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-parameterv40" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ParameterV40ToExtension" ] ;
        ( fhir:variable [ fhir:v "parameterV40" ] [ fhir:v "extension" ] )       ] )     ] [
fhir:name [ fhir:v "billable" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "billable" ]         ] )       ] )     ] [
fhir:name [ fhir:v "RefItemNumber" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "RefItemNumber" ] ;
fhir:variable [ fhir:v "refItemNumber" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R312ReferenzzuHauptleistungRefItemNumber" ] ;
        ( fhir:source [
fhir:context [ fhir:v "refItemNumber" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "partOf" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]           ] )         ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "'urn:uuid:' + %data.lower()" ]           ] )         ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "ChargeItem" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "R36Tarifposition" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ServiceItem" ] ;
fhir:variable [ fhir:v "serviceItem" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R36TarifpositionServiceItem" ] ;
        ( fhir:source [
fhir:context [ fhir:v "serviceItem" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]           ] )         ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "servicType" ] ;
          ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ServiceType" ] ;
fhir:variable [ fhir:v "serviceType" ]           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "R35KatalogServiceType" ] ;
            ( fhir:source [
fhir:context [ fhir:v "serviceType" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "translate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "data" ]               ] [
fhir:value [ fhir:v "#serviceMap" ]               ] [
fhir:value [ fhir:v "code" ]               ] )             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "R31LeistungsdatumServiceDate" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ServiceDate" ] ;
fhir:variable [ fhir:v "serviceData" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "occurrence" ] ;
fhir:variable [ fhir:v "occurrence" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "dateTime" ]         ] )       ] [
fhir:context [ fhir:v "occurrence" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%serviceData.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R315PersonV40PersonV40" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "PersonV40" ] ;
fhir:variable [ fhir:v "personV40" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "performer" ] ;
fhir:variable [ fhir:v "performer" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "BackboneElement" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "PersonV40ToPerformer" ] ;
        ( fhir:variable [ fhir:v "personV40" ] [ fhir:v "performer" ] )       ] )     ] [
fhir:name [ fhir:v "R39ErbringendeOrganizationProviderID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ProviderID" ] ;
fhir:variable [ fhir:v "providerID" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "performingOrganization" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%providerID.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R34AuftraggebendeKostenstelleReferrerID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "ReferrerID" ] ;
fhir:variable [ fhir:v "referrerID" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "costCenter" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%referrerID.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R313AnzahlQuantity" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Quantity" ] ;
fhir:variable [ fhir:v "quantity" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "quantity" ] ;
fhir:variable [ fhir:v "q" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Quantity" ]         ] )       ] [
fhir:context [ fhir:v "q" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ]       ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%quantity.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R310ErfasserEnteredBy" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "EnteredBy" ] ;
fhir:variable [ fhir:v "enteredBy" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "enterer" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%enteredBy.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R38ErfassungsdatumEnteredDateTime" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "EnteredDateTime" ] ;
fhir:variable [ fhir:v "enteredDateTime" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "enteredDate" ] ;
fhir:variable [ fhir:v "enteredDate" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "dateTime" ]         ] )       ] [
fhir:context [ fhir:v "enteredDate" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%enteredDateTime.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "patientContactID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "PatientContactID" ] ;
fhir:variable [ fhir:v "patientContactID" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "PatientContactID" ] ;
        ( fhir:source [
fhir:context [ fhir:v "patientContactID" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Identifier" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "costweight" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Costweight" ] ;
fhir:variable [ fhir:v "costweight" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "Costweight" ] ;
        ( fhir:source [
fhir:context [ fhir:v "costweight" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "factorOverride" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "ServiceProcedureToFhirProcedure" ] ;
      ( fhir:source [
fhir:context [ fhir:v "service" ] ;
fhir:element [ fhir:v "Procedure" ] ;
fhir:variable [ fhir:v "proc" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "contained" ] ;
fhir:variable [ fhir:v "procedure" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Procedure" ]         ] )       ] [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "id" ] ;
fhir:variable [ fhir:v "containedid" ] ;
fhir:transform [ fhir:v "uuid" ]       ] [
fhir:context [ fhir:v "chargeItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "service" ] ;
fhir:variable [ fhir:v "service" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "service" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "'#' + %containedid" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ServiceProcedureToFhirProcedure" ] ;
        ( fhir:variable [ fhir:v "proc" ] [ fhir:v "procedure" ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ServiceProcedureToFhirProcedure" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "proc" ] ;
fhir:type [ fhir:v "Proc" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "procedure" ] ;
fhir:type [ fhir:v "Procedure" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "R314ProzedurIDIdentifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ] ;
fhir:element [ fhir:v "Identifier" ] ;
fhir:variable [ fhir:v "identifier" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Identifier" ]         ] )       ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%identifier.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R316ProzedurcodeCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ] ;
fhir:element [ fhir:v "Code" ] ;
fhir:variable [ fhir:v "chopcode" ] ;
fhir:condition [ fhir:v "(%proc.Category.data = 'CHOP_2023')" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]         ] )       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%chopcode.data" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "https://www.bfs.admin.ch/bfs/statistiche/catalog/chop2023" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%proc.Display.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R317DatumZeitPerformedDateTime" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ] ;
fhir:element [ fhir:v "PerformedDateTime" ] ;
fhir:variable [ fhir:v "performedDateTime" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "performed" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%performedDateTime.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "laterality" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ] ;
fhir:element [ fhir:v "Laterality" ] ;
fhir:variable [ fhir:v "laterality" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R318SeiteLaterality" ] ;
        ( fhir:source [
fhir:context [ fhir:v "laterality" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "v" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "bodySite" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]           ] )         ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "translate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "v" ]           ] [
fhir:value [ fhir:v "#laterality" ]           ] [
fhir:value [ fhir:v "code" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://snomed.info/sct" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%proc.LateralityDisplay.data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "performer" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ] ;
fhir:element [ fhir:v "Performer" ] ;
fhir:variable [ fhir:v "performer" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "Identifier" ] ;
        ( fhir:source [
fhir:context [ fhir:v "performer" ] ;
fhir:element [ fhir:v "Identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "identifier" ] ;
          ( fhir:source [
fhir:context [ fhir:v "identifier" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "performer" ] ;
fhir:variable [ fhir:v "performer" ]           ] [
fhir:context [ fhir:v "performer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "actor" ] ;
fhir:variable [ fhir:v "actor" ]           ] [
fhir:context [ fhir:v "actor" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]           ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "data" ]             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "containedpatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "#pat" ]         ] )       ] )     ] [
fhir:name [ fhir:v "status" ] ;
      ( fhir:source [
fhir:context [ fhir:v "proc" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "procedure" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "completed" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "PersonV40ToPerformer" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "personV40" ] ;
fhir:type [ fhir:v "PersonV40" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "performer" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "R3152PersonIDPersonID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "personV40" ] ;
fhir:element [ fhir:v "PersonTyp" ] ;
fhir:variable [ fhir:v "personTyp" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "performer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "function" ] ;
fhir:variable [ fhir:v "cc" ]       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "system" ]       ] [
fhir:context [ fhir:v "system" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/CodeSystem/ch-alis-persontyp" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]       ] [
fhir:context [ fhir:v "code" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "personTyp" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R3152PersonIDPersonID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "personV40" ] ;
fhir:element [ fhir:v "PersonID" ] ;
fhir:variable [ fhir:v "personId" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "performer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "actor" ] ;
fhir:variable [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "reference" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%personId.data" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ParameterV40ToExtension" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "parameterV40" ] ;
fhir:type [ fhir:v "ParameterV40" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "extension" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "ParamTyp" ] ;
      ( fhir:source [
fhir:context [ fhir:v "parameterV40" ] ;
fhir:element [ fhir:v "ParamTyp" ] ;
fhir:variable [ fhir:v "paramTyp" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extInner" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "InnerExtensionParamTyp" ] ;
        ( fhir:variable [ fhir:v "paramTyp" ] [ fhir:v "extInner" ] )       ] )     ] [
fhir:name [ fhir:v "ParamValue" ] ;
      ( fhir:source [
fhir:context [ fhir:v "parameterV40" ] ;
fhir:element [ fhir:v "ParamValue" ] ;
fhir:variable [ fhir:v "paramValue" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
        ( fhir:source [
fhir:context [ fhir:v "paramValue" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "extension" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "extInner" ]         ] ) ;
        ( fhir:dependent [
fhir:name [ fhir:v "InnerExtensionParamValue" ] ;
          ( fhir:variable [ fhir:v "data" ] [ fhir:v "extInner" ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InnerExtensionParamTyp" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ParamTyp" ]         ] )       ] )     ] [
fhir:name [ fhir:v "string" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]         ] )       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:variable [ fhir:v "text" ]       ] [
fhir:context [ fhir:v "text" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "src" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "InnerExtensionParamValue" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "url" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "ParamValue" ]         ] )       ] )     ] [
fhir:name [ fhir:v "string" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "string" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "string" ]         ] )       ] [
fhir:context [ fhir:v "string" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "src" ]         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ServiceToPatientName" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "visit" ] ;
fhir:type [ fhir:v "Visit" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "name" ] ;
fhir:type [ fhir:v "HumanName" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "patientName" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "PatientName" ] ;
fhir:variable [ fhir:v "patientName" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R23PatientNamePatientName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "patientName" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "family" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "patientGivenName" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "PatientGivenName" ] ;
fhir:variable [ fhir:v "patientGivenName" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R24PatientVornamePatientGivenName" ] ;
        ( fhir:source [
fhir:context [ fhir:v "patientGivenName" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "name" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "given" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "ServiceToPatient" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "service" ] ;
fhir:type [ fhir:v "Service" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "visit" ] ;
fhir:type [ fhir:v "Visit" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "patient" ] ;
fhir:type [ fhir:v "Patient" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "patientID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "PatientID" ] ;
fhir:variable [ fhir:v "patientID" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R22PatientPIDPatientID" ] ;
        ( fhir:source [
fhir:context [ fhir:v "patientID" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "patId" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "patId" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "idsystem" ]         ] [
fhir:context [ fhir:v "idsystem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://www.example.ch/patienteniddomain" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]         ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "system" ]         ] [
fhir:context [ fhir:v "system" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v2-0203" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]         ] [
fhir:context [ fhir:v "code" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "MR" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "ServiceToPatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:condition [ fhir:v "(visit.PatientName or visit.PatientGivenName)" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "name" ] ;
fhir:variable [ fhir:v "name" ]       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "ServiceToPatientName" ] ;
        ( fhir:variable [ fhir:v "visit" ] [ fhir:v "name" ] )       ] )     ] [
fhir:name [ fhir:v "R26PatientGeschlechtPatientGender" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "PatientGender" ] ;
fhir:variable [ fhir:v "gender" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "gender" ] ;
        ( fhir:source [
fhir:context [ fhir:v "gender" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "v" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "gender" ] ;
fhir:transform [ fhir:v "translate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "v" ]           ] [
fhir:value [ fhir:v "#gender" ]           ] [
fhir:value [ fhir:v "code" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "R25PatientGebDatumPatientBirthDate" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "PatientBirthDate" ] ;
fhir:variable [ fhir:v "birthDate" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "birthDate" ] ;
        ( fhir:source [
fhir:context [ fhir:v "birthDate" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "v" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "patient" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "birthDate" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "v" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "DiagnosisToCondition" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "diagnosis" ] ;
fhir:type [ fhir:v "Diagnosis" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "cond" ] ;
fhir:type [ fhir:v "Condition" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "containedpatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagnosis" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "#pat" ]         ] )       ] )     ] [
fhir:name [ fhir:v "Identifier" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagnosis" ] ;
fhir:element [ fhir:v "Identifier" ] ;
fhir:variable [ fhir:v "identifier" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "identifier" ] ;
        ( fhir:source [
fhir:context [ fhir:v "identifier" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ]         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "R316ProzedurcodeCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagnosis" ] ;
fhir:element [ fhir:v "Code" ] ;
fhir:variable [ fhir:v "code" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]         ] )       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%code.data" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%diagnosis.Display.data" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "serviceType" ] ;
        ( fhir:source [
fhir:context [ fhir:v "diagnosis" ] ;
fhir:element [ fhir:v "Category" ] ;
fhir:variable [ fhir:v "category" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "data" ] ;
          ( fhir:source [
fhir:context [ fhir:v "category" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ] ;
fhir:condition [ fhir:v "(startsWith('ICD'))" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/sid/icd-10" ]             ] )           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "onsetDateTime" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagnosis" ] ;
fhir:element [ fhir:v "OnsetDateTime" ] ;
fhir:variable [ fhir:v "onsetDateTime" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "onset" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "%onsetDateTime.data" ]         ] )       ] )     ] [
fhir:name [ fhir:v "laterality" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagnosis" ] ;
fhir:element [ fhir:v "Laterality" ] ;
fhir:variable [ fhir:v "laterality" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R318SeiteLaterality" ] ;
        ( fhir:source [
fhir:context [ fhir:v "laterality" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "v" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "bodySite" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]           ] )         ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "translate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "v" ]           ] [
fhir:value [ fhir:v "#laterality" ]           ] [
fhir:value [ fhir:v "code" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://snomed.info/sct" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%diagnosis.LateralityDisplay.data" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "DiagGroupToCondition" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "diagGroup" ] ;
fhir:type [ fhir:v "DiagGroup" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "cond" ] ;
fhir:type [ fhir:v "Condition" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "containedpatient" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagGroup" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "#pat" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R291DiagnosecodeDiagCode" ] ;
      ( fhir:source [
fhir:context [ fhir:v "diagGroup" ] ;
fhir:element [ fhir:v "DiagCode" ] ;
fhir:variable [ fhir:v "data" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "cond" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "cc" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "CodeableConcept" ]         ] )       ] [
fhir:context [ fhir:v "cc" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Coding" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "data" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "serviceType" ] ;
        ( fhir:source [
fhir:context [ fhir:v "diagGroup" ] ;
fhir:element [ fhir:v "DiagCatType" ] ;
fhir:variable [ fhir:v "diagCatType" ]         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "R293KatalogtypDiagCatType" ] ;
          ( fhir:source [
fhir:context [ fhir:v "diagCatType" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:transform [ fhir:v "translate" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "data" ]             ] [
fhir:value [ fhir:v "#serviceMap" ]             ] [
fhir:value [ fhir:v "code" ]             ] )           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "TerminationToExtension" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "visit" ] ;
fhir:type [ fhir:v "Visit" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "ext" ] ;
fhir:type [ fhir:v "Extension" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "TerminationVisit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "TerminationVisit" ] ;
fhir:variable [ fhir:v "visit" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R27FallAbschlussTerminationVisit" ] ;
        ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext1" ]         ] [
fhir:context [ fhir:v "ext1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "TerminationVisit" ]           ] )         ] [
fhir:context [ fhir:v "ext1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "date" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "date" ]           ] )         ] [
fhir:context [ fhir:v "date" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "TerminationVisit" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "TerminationReason" ] ;
fhir:variable [ fhir:v "visit" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R28FallAbschlussgrundTerminationReason" ] ;
        ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext1" ]         ] [
fhir:context [ fhir:v "ext1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "TerminationReason" ]           ] )         ] [
fhir:context [ fhir:v "ext1" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "string" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "string" ]           ] )         ] [
fhir:context [ fhir:v "string" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] )       ] )     ] )
  ] [
fhir:name [ fhir:v "VisitToEncounter" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "visit" ] ;
fhir:type [ fhir:v "Visit" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "encounter" ] ;
fhir:type [ fhir:v "Encounter" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "TerminationToExtension" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:condition [ fhir:v "(visit.TerminationVisit or visit.TerminationReason)" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "extension" ] ;
fhir:variable [ fhir:v "ext" ]       ] [
fhir:context [ fhir:v "ext" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "url" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-termination" ]         ] )       ] ) ;
      ( fhir:dependent [
fhir:name [ fhir:v "TerminationToExtension" ] ;
        ( fhir:variable [ fhir:v "visit" ] [ fhir:v "ext" ] )       ] )     ] [
fhir:name [ fhir:v "encounterID" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "VisitNumber" ] ;
fhir:variable [ fhir:v "visitNumber" ]       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R21FallVisitNumber" ] ;
        ( fhir:source [
fhir:context [ fhir:v "visitNumber" ] ;
fhir:element [ fhir:v "data" ] ;
fhir:variable [ fhir:v "data" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "identifier" ] ;
fhir:variable [ fhir:v "identifier" ] ;
fhir:transform [ fhir:v "create" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "Identifier" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:variable [ fhir:v "value" ]         ] [
fhir:context [ fhir:v "value" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "data" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "idsystem" ]         ] [
fhir:context [ fhir:v "idsystem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://www.example.ch/fallnummerdomain" ]           ] )         ] [
fhir:context [ fhir:v "identifier" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "type" ] ;
fhir:variable [ fhir:v "type" ]         ] [
fhir:context [ fhir:v "type" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "coding" ] ;
fhir:variable [ fhir:v "coding" ]         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "system" ]         ] [
fhir:context [ fhir:v "system" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v2-0203" ]           ] )         ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]         ] [
fhir:context [ fhir:v "code" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "VN" ]           ] )         ] )       ] )     ] [
fhir:name [ fhir:v "Finished" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "finished" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R21FallVisitNumber" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "class" ] ;
fhir:variable [ fhir:v "coding" ]       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "system" ] ;
fhir:variable [ fhir:v "system" ]       ] [
fhir:context [ fhir:v "system" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://terminology.hl7.org/CodeSystem/v3-ActCode" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "code" ] ;
fhir:variable [ fhir:v "code" ]       ] [
fhir:context [ fhir:v "code" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "IMP" ]         ] )       ] [
fhir:context [ fhir:v "coding" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "display" ] ;
fhir:variable [ fhir:v "display" ]       ] [
fhir:context [ fhir:v "display" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "inpatient encounter" ]         ] )       ] )     ] [
fhir:name [ fhir:v "subject" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "#pat" ]         ] )       ] )     ] [
fhir:name [ fhir:v "R29DiagnoseGruppeDiagGroup" ] ;
      ( fhir:source [
fhir:context [ fhir:v "visit" ] ;
fhir:element [ fhir:v "DiagGroup" ] ;
fhir:variable [ fhir:v "diaggroup" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "encounter" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "diagnosis" ] ;
fhir:variable [ fhir:v "diag" ]       ] [
fhir:context [ fhir:v "diag" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "condition" ] ;
fhir:variable [ fhir:v "ref" ] ;
fhir:transform [ fhir:v "create" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "Reference" ]         ] )       ] [
fhir:context [ fhir:v "ref" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "#cond" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "R292DiagnosetypDiagType" ] ;
        ( fhir:source [
fhir:context [ fhir:v "diaggroup" ] ;
fhir:element [ fhir:v "DiagType" ] ;
fhir:variable [ fhir:v "diagType" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "diag" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "use" ] ;
fhir:variable [ fhir:v "use" ]         ] [
fhir:context [ fhir:v "use" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "text" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "%diagType.data" ]           ] )         ] )       ] )     ] )
  ] ) . #