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: Step Count Q to O

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

Step Count Q to O

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

    // Step Count Q 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/Quantity" alias Quantity as source

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

    group StepCountQuestionnaireResponseToObservation(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-stepcount-observation' "SetProfile";
      src -> tgt.code = cc('http://loinc.org', '41950-7', 'Number of steps in 24 hour Measured') "SetCode";
      // Quantity step count entry
      src.item as item where linkId = 'step-count' then MapStepCount(item, tgt) "ProcessQuantityStepCount";
    // EHIS-PAQ walking survey
    // src.item as item where linkId = 'Q2-walking-days' then MapEhisPaqToStepCount(item, tgt) "ProcessEhisPaq";
    }

    // Direct step count mapping
    group MapStepCount(source src : QR, target tgt : Obs) {
      src.answer as answer then {
        // effectiveDateTime from nested item with linkId = 'date'
        answer.item as dtItem where linkId = 'date' then {
          dtItem.answer as dtAns then {
            dtAns.valueDate as dt -> tgt.effectiveDateTime = dt "SetEffectiveFromDate";
          } "ExtractDate";
        } "ProcessDate";
        answer.valueQuantity as srcQty then MapStepCountQuantity(srcQty, tgt) "MapValueQuantity";
      } "ProcessAnswer";
    }

    group MapStepCountQuantity(source srcQty : Quantity, target tgt : Obs) {
      srcQty.value as v -> tgt.value = create('Quantity') as qty then {
        v.value as numVal -> qty.value = numVal "SetValue";
        srcQty -> qty.unit = '{steps}/d' "SetUnit";
        srcQty -> qty.system = 'http://unitsofmeasure.org' "SetSystem";
        srcQty -> qty.code = '{steps}/d' "SetCode";
      } "MapQuantityValue";
    }