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: Work-SoC Q score to O score

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

Work-SoC Q score to O score

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

    // Work-SoC Q score to O score

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

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

    group WorkSocQuestionnaireResponseToObservation(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-work-soc-score-observation' "SetProfile";
      src -> tgt.code = cc('https://fhir.hl7.at/prenudge/appdata/r4/CodeSystem/prenudge-workability', 'work-soc-category-score', 'Work-SoC category score') "SetCode";
      src.item as workSocGroup where linkId = 'work-soc' then {
        workSocGroup.item as scoreItem where linkId = 'work-soc-comprehensibility-score' then MapComprehensibilityScore(scoreItem, tgt) "MapComprehensibilityScore";
        workSocGroup.item as scoreItem where linkId = 'work-soc-manageability-score' then MapManageabilityScore(scoreItem, tgt) "MapManageabilityScore";
        workSocGroup.item as scoreItem where linkId = 'work-soc-meaningfulness-score' then MapMeaningfulnessScore(scoreItem, tgt) "MapMeaningfulnessScore";
      } "ProcessWorkSoc";
    // TODO: Comment/Note mapping disabled due to MaLaC-HD limitation
    // See: https://gitlab.com/cdehealth/malac-hd/-/issues/128
    }

    group MapComprehensibilityScore(source src : QR, target tgt : Obs) {
      src.answer as answer then {
        answer.valueDecimal as val then {
          val.value as numVal ->  tgt.component as comp,  comp.code = cc('https://fhir.hl7.at/prenudge/appdata/r4/CodeSystem/prenudge-workability', 'work-soc-comprehensibility', 'Work-SoC comprehensibility score'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
        } "ExtractValue";
      } "ProcessAnswer";
    }

    group MapManageabilityScore(source src : QR, target tgt : Obs) {
      src.answer as answer then {
        answer.valueDecimal as val then {
          val.value as numVal ->  tgt.component as comp,  comp.code = cc('https://fhir.hl7.at/prenudge/appdata/r4/CodeSystem/prenudge-workability', 'work-soc-manageability', 'Work-SoC manageability score'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
        } "ExtractValue";
      } "ProcessAnswer";
    }

    group MapMeaningfulnessScore(source src : QR, target tgt : Obs) {
      src.answer as answer then {
        answer.valueDecimal as val then {
          val.value as numVal ->  tgt.component as comp,  comp.code = cc('https://fhir.hl7.at/prenudge/appdata/r4/CodeSystem/prenudge-workability', 'work-soc-meaningfulness', 'Work-SoC meaningfulness score'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
        } "ExtractValue";
      } "ProcessAnswer";
    }