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: WHOQOL-BREF Q score to O score

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

WHOQOL-BREF Q score to O score

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

// WHOQOL-BREF 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 WHOQOLBrefQuestionnaireResponseToObservation(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-whoqol-bref-score-observation' "SetProfile";
  src -> tgt.code = cc('http://snomed.info/sct', '405152002', 'Quality of life assessment') "SetCode";
  src.item as generalGroup where linkId = 'general' then {
    generalGroup.item as scoreItem where linkId = 'general-score' then MapGeneralScore(scoreItem, tgt) "MapGeneralScore";
  } "ProcessGeneral";
  src.item as domain1Group where linkId = 'domain1' then {
    domain1Group.item as scoreItem where linkId = 'domain1-score' then MapPhysicalScore(scoreItem, tgt) "MapDomain1Score";
  } "ProcessDomain1";
  src.item as domain2Group where linkId = 'domain2' then {
    domain2Group.item as scoreItem where linkId = 'domain2-score' then MapPsychologicalScore(scoreItem, tgt) "MapDomain2Score";
  } "ProcessDomain2";
  src.item as domain3Group where linkId = 'domain3' then {
    domain3Group.item as scoreItem where linkId = 'domain3-score' then MapRelationshipsScore(scoreItem, tgt) "MapDomain3Score";
  } "ProcessDomain3";
  src.item as domain4Group where linkId = 'domain4' then {
    domain4Group.item as scoreItem where linkId = 'domain4-score' then MapEnvironmentScore(scoreItem, tgt) "MapDomain4Score";
  } "ProcessDomain4";
// TODO: Comment/Note mapping disabled due to MaLaC-HD limitation
// See: https://gitlab.com/cdehealth/malac-hd/-/issues/128
}

group MapGeneralScore(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('http://snomed.info/sct', '60132005', 'Generalized'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
    } "ExtractValue";
  } "ProcessAnswer";
}

group MapPhysicalScore(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('http://snomed.info/sct', '19388002', 'Physical'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
    } "ExtractValue";
  } "ProcessAnswer";
}

group MapPsychologicalScore(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('http://snomed.info/sct', '60224009', 'Psychologic'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
    } "ExtractValue";
  } "ProcessAnswer";
}

group MapRelationshipsScore(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('http://snomed.info/sct', '272151006', 'Relationships'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
    } "ExtractValue";
  } "ProcessAnswer";
}

group MapEnvironmentScore(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('http://snomed.info/sct', '276339004', 'Environment'),  comp.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'score',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{score}' "SetComponent";
    } "ExtractValue";
  } "ProcessAnswer";
}