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: Muscle Strengthening EHIS-PAQ Q8 / ATHIS PE8 to O

Official URL: https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/MuscleStrengtheningEhisPaqQuestionnaireResponseToObservation Version: 0.1.0
Active as of 2026-06-25 Responsible: The PreNUDGE Consortium Computable Name: MuscleStrengtheningEhisPaqQuestionnaireResponseToObservation

Muscle Strengthening EHIS-PAQ Q8 / ATHIS PE8 to O

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

// Muscle Strengthening EHIS-PAQ Q8 / ATHIS PE8 to O

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 MuscleStrengtheningEhisPaqQuestionnaireResponseToObservation(source src : QR, target tgt : Obs) {
  src then SetObservationBase(src, tgt) "Base";
  src ->  tgt.meta = create('Meta') as meta,  meta.profile = 'https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-muscle-strengthening-observation' "SetProfile";
  src -> tgt.code = cc('http://loinc.org', '82291-6', 'Frequency of muscle-strengthening physical activity') "SetCode";
  src.authored as authored -> tgt.effectiveDateTime = authored "SetEffectiveDateTime";
  src.item as item where linkId = 'Q8' then MapQ8(item, tgt) "ProcessQ8";
}

group MapQ8(source src : QR, target tgt : Obs) {
  src.answer as answer then {
    answer.valueCoding as coding then MapQ8CodingToQuantity(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 MapQ8CodingToQuantity(source coding : Coding, target tgt : Obs) {
  coding.code as c where $this = 'activity-1-day' ->  tgt.value = create('Quantity') as qty,  qty.value = '1',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map1Day";
  coding.code as c where $this = 'activity-2-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '2',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map2Days";
  coding.code as c where $this = 'activity-3-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '3',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map3Days";
  coding.code as c where $this = 'activity-4-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '4',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map4Days";
  coding.code as c where $this = 'activity-5-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '5',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map5Days";
  coding.code as c where $this = 'activity-6-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '6',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map6Days";
  coding.code as c where $this = 'activity-7-days' ->  tgt.value = create('Quantity') as qty,  qty.value = '7',  qty.unit = '{sessions}/wk',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{sessions}/wk' "Map7Days";
}