German Practice Management FHIR Profiles (R4)
0.90.0 - STU1 Germany

German Practice Management FHIR Profiles (R4) - Local Development build (v0.90.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: Upper-arm injection Job StructureMap (example) (Experimental)

Official URL: https://fhir.cognovis.de/praxis/StructureMap/map-upper-arm-injection Version: 0.90.0
Active as of 2026-07-29 Computable Name: MapUpperArmInjection
Other Identifiers: OID:2.16.840.1.113883.3.7985.43.1

EXAMPLE-ONLY worked StructureMap for the upper-arm injection Job (GOÄ 252). Not a curated production binding discovery artifact. Executed by the bounded R4 StructureMap rule-tree interpreter. Composition/Condition/Observation/Procedure/ChargeItem candidates. QR.subject/.encounter/.author/.authored supply Composition context (never fabricated). ChargeItem.code is Job-fixed GOÄ 252 (http://fhir.de/CodeSystem/bäk/goä#252); definitionCanonical from cid.primary answer.valueUri only. Procedure carries instantiatesCanonical to the Job; basedOn only when a real ServiceRequest exists (separate fixture, not this map). Binding identity: (job-upper-arm-injection 0.90.0, q-upper-arm-injection 0.90.0, map-upper-arm-injection 0.90.0).

map "https://fhir.cognovis.de/praxis/StructureMap/map-upper-arm-injection" = "MapUpperArmInjection"

// EXAMPLE-ONLY worked StructureMap for the upper-arm injection Job (GOÄ 252). Not a curated production binding discovery artifact. Executed by the bounded R4 StructureMap rule-tree interpreter. Composition/Condition/Observation/Procedure/ChargeItem candidates. QR.subject/.encounter/.author/.authored supply Composition context (never fabricated). ChargeItem.code is Job-fixed GOÄ 252 (http://fhir.de/CodeSystem/bäk/goä#252); definitionCanonical from cid.primary answer.valueUri only. Procedure carries instantiatesCanonical to the Job; basedOn only when a real ServiceRequest exists (separate fixture, not this map). Binding identity: (job-upper-arm-injection|0.90.0, q-upper-arm-injection|0.90.0, map-upper-arm-injection|0.90.0).

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias qr as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias bundle as target

// Bind QuestionnaireResponse.subject/.encounter/.author/.authored (standard QR fields; not duplicated Questionnaire items), then invoke fillCondition / fillDocumentation / fillProcedure / fillChargeItems / fillComposition.
group main(source qr : QuestionnaireResponse, target bundle : Bundle) {
  qr -> bundle.type = 'collection' "bundleType";
  qr.subject as subjectRef then {
    qr.encounter as encRef then {
      qr.author as authorRef then {
        qr.authored as authoredDt then {
          qr.item as diagCodingItem where (linkId = 'diag.icd') then fillCondition(diagCodingItem, bundle, subjectRef) "invokeFillCondition";
          qr.item as noteItem where (linkId = 'doc.note') then fillDocumentation(noteItem, bundle, subjectRef) "invokeFillDocumentation";
          qr.item as perfItem where (linkId = 'svc.performed' and answer.valueBoolean = true) then fillProcedure(qr, bundle, subjectRef) "invokeFillProcedure";
          qr as qrForCharges then fillChargeItems(qrForCharges, bundle, subjectRef, encRef) "invokeFillChargeItems";
          qr as qrForComp then fillComposition(qrForComp, bundle, subjectRef, encRef, authorRef, authoredDt) "invokeFillComposition";
        } "bindAuthoredFromQr";
      } "bindAuthorFromQr";
    } "bindEncounterFromQr";
  } "bindSubjectFromQr";
}

// diag.icd answer.valueCoding -> Condition; verificationStatus=unconfirmed; subject from QR.subject.
group fillCondition(source diagItem, target bundle : Bundle, source subjectRef) {
  diagItem.answer as ans then {
    ans.value : Coding as coding ->  bundle.entry = create() as condEntry,  condEntry.fullUrl = 'urn:uuid:00000000-0000-4000-8000-000000000001',  condEntry.resource = create('Condition') as cond,  cond.code = create('CodeableConcept') as condCode,  condCode.coding = coding,  cond.verificationStatus = create('CodeableConcept') as ver,  ver.coding = create('Coding') as verCoding,  verCoding.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status',  verCoding.code = 'unconfirmed',  cond.clinicalStatus = create('CodeableConcept') as clin,  clin.coding = create('Coding') as clinCoding,  clinCoding.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical',  clinCoding.code = 'active',  cond.subject = subjectRef "codingValue";
  } "conditionFromValueCoding";
}

// doc.note answer.valueString -> Observation.value (serialized as valueString) status=preliminary.
group fillDocumentation(source noteItem, target bundle : Bundle, source subjectRef) {
  noteItem.answer as ans then {
    ans.value : string as text ->  bundle.entry = create() as obsEntry,  obsEntry.fullUrl = 'urn:uuid:00000000-0000-4000-8000-000000000002',  obsEntry.resource = create('Observation') as obs,  obs.status = 'preliminary',  obs.code = create('CodeableConcept') as obsCode,  obsCode.coding = create('Coding') as obsCoding,  obsCoding.system = 'http://snomed.info/sct',  obsCoding.code = '371524004',  obs.value = text,  obs.subject = subjectRef "stringValue";
  } "obsFromValueString";
}

// bodySiteFromValueCoding + SNOMED laterality; status=preparation; reasonReference from diag.condition.
group fillProcedure(source qr : QuestionnaireResponse, target bundle : Bundle, source subjectRef) {
  qr.item as siteItem where (linkId = 'site.bodySite'), qr.item as latItem where (linkId = 'site.laterality') then {
    siteItem.answer as siteAns then {
      siteAns.value : Coding as siteCoding then {
        latItem.answer as latAns then {
          latAns.value : Coding as latCoding ->  bundle.entry = create() as procEntry,  procEntry.fullUrl = 'urn:uuid:00000000-0000-4000-8000-000000000003',  procEntry.resource = create('Procedure') as proc,  proc.status = 'preparation',  proc.code = create('CodeableConcept') as procCode,  procCode.coding = create('Coding') as procCoding,  procCoding.system = 'http://snomed.info/sct',  procCoding.code = '59108006',  proc.subject = subjectRef,  proc.instantiatesCanonical = 'https://fhir.cognovis.de/praxis/PlanDefinition/job-upper-arm-injection|0.90.0',  proc.bodySite = create('CodeableConcept') as bs,  bs.coding = siteCoding,  bs.coding = latCoding then {
            qr.item as diagRefItem where (linkId = 'diag.condition') then {
              diagRefItem.answer as drAns then {
                drAns.value : Reference as reasonRef -> proc.reasonReference = reasonRef "diagRefValue";
              } "diagRefAnswer";
            } "reasonFromConditionRef";
          } "latValue";
        } "latAnswer";
      } "siteValue";
    } "siteAnswer";
  } "bodySiteFromValueCoding";
}

// One ChargeItem per runtime contract (cid.primary answer.valueUri). ChargeItem.code is the Job-fixed GOÄ 252 Coding (http://fhir.de/CodeSystem/bäk/goä), never derived from CID identity or service codes. context from QR.encounter; subject from QR.subject; 1:n service lineage when performed; supportingInformation from diag.condition.
group fillChargeItems(source qr : QuestionnaireResponse, target bundle : Bundle, source subjectRef, source encRef) {
  qr.item as cidItem where (linkId = 'cid.primary') then {
    cidItem.answer as cidAns then {
      cidAns.value : uri as primaryCid ->  bundle.entry = create() as chg1Entry,  chg1Entry.fullUrl = 'urn:uuid:00000000-0000-4000-8000-000000000004',  chg1Entry.resource = create('ChargeItem') as chg1,  chg1.status = 'planned',  chg1.subject = subjectRef,  chg1.context = encRef,  chg1.code = create('CodeableConcept') as chgCode,  chgCode.coding = create('Coding') as fixedCoding,  fixedCoding.system = 'http://fhir.de/CodeSystem/bäk/goä',  fixedCoding.code = '252',  fixedCoding.display = 'Injektion, s.c./s.m./i.c./i.m.',  chg1.definitionCanonical = primaryCid,  chg1.quantity = create('Quantity') as qty,  qty.value = 1 then {
        qr.item as amtItem where (linkId = 'fee.amount'), qr.item as curItem where (linkId = 'fee.currency') then {
          amtItem.answer as amtAns then {
            amtAns.value : decimal as amount then {
              curItem.answer as curAns then {
                curAns.value : Coding as curCoding then {
                  curCoding.code as currencyCode ->  chg1.priceOverride = create('Money') as money,  money.value = amount,  money.currency = currencyCode "currencyCode";
                } "currencyValue";
              } "currencyAnswer";
            } "amountValue";
          } "amountAnswer";
        } "moneyFromParts";
        qr.item as perfItem where (linkId = 'svc.performed' and answer.valueBoolean = true) ->  chg1.service = create('Reference') as svcProc,  svcProc.reference = 'urn:uuid:00000000-0000-4000-8000-000000000003',  chg1.service = create('Reference') as svcObs,  svcObs.reference = 'urn:uuid:00000000-0000-4000-8000-000000000002' "serviceWhenPerformedPrimary";
        qr.item as diagRefItem2 where (linkId = 'diag.condition') then {
          diagRefItem2.answer as dr2Ans then {
            dr2Ans.value : Reference as reasonRef2 -> chg1.supportingInformation = reasonRef2 "dr2Value";
          } "dr2Answer";
        } "supportingInfoFromConditionRef";
      } "cidValue";
    } "cidAnswer";
  } "primaryFromValueUri";
}

// Composition proposal (status=preliminary). subject/encounter/author/date from QR.subject/.encounter/.author/.authored only — never fabricated. Sections Reference generated Observation/ChargeItem UUIDs; optional Procedure/Condition sections when those outputs are produced.
group fillComposition(source qr : QuestionnaireResponse, target bundle : Bundle, source subjectRef, source encRef, source authorRef, source authoredDt) {
  qr ->  bundle.entry = create() as compEntry,  compEntry.fullUrl = 'urn:uuid:00000000-0000-4000-8000-000000000006',  compEntry.resource = create('Composition') as comp,  comp.status = 'preliminary',  comp.type = create('CodeableConcept') as compType,  compType.coding = create('Coding') as compTypeCoding,  compTypeCoding.system = 'http://loinc.org',  compTypeCoding.code = '11506-3',  compTypeCoding.display = 'Progress note',  comp.title = 'Upper-arm injection visit - pre-approval proposal',  comp.subject = subjectRef,  comp.encounter = encRef,  comp.author = authorRef,  comp.date = authoredDt,  comp.section = create() as secDoc,  secDoc.title = 'Documentation',  secDoc.entry = create('Reference') as docEntry,  docEntry.reference = 'urn:uuid:00000000-0000-4000-8000-000000000002',  comp.section = create() as secBill,  secBill.title = 'Billing proposal',  secBill.entry = create('Reference') as billEntry,  billEntry.reference = 'urn:uuid:00000000-0000-4000-8000-000000000004' then {
    qr.item as perfItem where (linkId = 'svc.performed' and answer.valueBoolean = true) ->  comp.section = create() as secProc,  secProc.title = 'Procedure proposal',  secProc.entry = create('Reference') as procEntryRef,  procEntryRef.reference = 'urn:uuid:00000000-0000-4000-8000-000000000003' "sectionProcedureWhenPerformed";
    qr.item as diagCodingItem where (linkId = 'diag.icd') ->  comp.section = create() as secDx,  secDx.title = 'Diagnosis proposal',  secDx.entry = create('Reference') as dxEntry,  dxEntry.reference = 'urn:uuid:00000000-0000-4000-8000-000000000001' "sectionDiagnosisWhenCoding";
  } "compositionShell";
}