PreNUDGE FHIR® IG for Data Provider / Data from Apps (R4)
0.1.0 - ci-build

PreNUDGE FHIR® IG for Data Provider / Data from Apps (R4) - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

## StructureMap: Alcohol Use Q mapping frequency to O drinks per day

Official URL: https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/AlcoholQuestionnaireResponseToObservation | Version: 0.1.0
Active as of 2026-04-03 | Responsible: The PreNUDGE Consortium | Computable Name: AlcoholQuestionnaireResponseToObservation

Alcohol Use Q mapping frequency to O drinks per day

    map "https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/AlcoholQuestionnaireResponseToObservation" = "AlcoholQuestionnaireResponseToObservation"

    // Alcohol Use Q mapping frequency to O drinks per day

    uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QR as source
    uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Obs as target
    uses "http://hl7.org/fhir/StructureDefinition/Coding" alias Coding as source

    imports "http://hl7.org/fhir/StructureMap/*"
    imports "https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/QuestionnaireResponseToObservationBase"

    group AlcoholQuestionnaireResponseToObservation(source src : QR, target tgt : Obs) {
      src then SetObservationBase(src, tgt) "Base";
      src ->  tgt.meta as meta,  meta.profile = 'https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-alcoholuse-observation' "SetProfile";
      src -> tgt.code = cc('http://loinc.org', '74013-4', 'Alcoholic drinks per day') "SetCode";
      // EffectiveDateTime from authored
      src.authored as authored ->  tgt.effectiveDateTime = create('dateTime') as dt,  dt.value = authored "SetEffective";
      src.item as item where linkId = 'alcohol-frequency' then MapAlcoholFrequency(item, tgt) "ProcessItem";
    }

    group MapAlcoholFrequency(source src : QR, target tgt : Obs) {
      src.answer as answer then {
        answer.valueCoding as coding then MapAlcoholCodingToQuantity(coding, tgt) "MapValueCoding";
      } "ProcessAnswer";
    // TODO: Note mapping disabled due to MaLaC-HD limitation
    // Annotation.text (markdown) target not supported with FHIR string source
    // See: https://gitlab.com/cdehealth/malac-hd/-/issues/128
    }

    group MapAlcoholCodingToQuantity(source coding : Coding, target tgt : Obs) {
      coding.code as c where $this = '69620002' ->  tgt.value = create('Quantity') as qty,  qty.value = '1',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapDaily";
      coding.code as c where $this = '307447001' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.79',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapSixTimesWeekly";
      coding.code as c where $this = '396113003' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.5',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapThreeToFourTimesWeekly";
      coding.code as c where $this = '229800002' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.21',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapTwiceWeekly";
      coding.code as c where $this = '307452006' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.08',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapThreeTimesMonthly";
      coding.code as c where $this = '307450003' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.03',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapOnceMonthly";
      coding.code as c where $this = '445547001' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.02',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapEveryTwoMonths";
      coding.code as c where $this = '105542008' ->  tgt.value = create('Quantity') as qty,  qty.value = '0.001',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapCurrentNonDrinker";
      coding.code as c where $this = '783261004' ->  tgt.value = create('Quantity') as qty,  qty.value = '0',  qty.unit = 'drinks/day',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{drinks}/d' "MapLifetimeNonDrinker";
    }