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: Nutrition Vegetable Portions Q to O

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

Nutrition Vegetable Portions Q to O

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

// Nutrition Vegetable Portions 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

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

group NutritionVegetablePortionsQuestionnaireResponseToObservation(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-nutrition-vegetableportions-observation' "SetProfile";
  src -> tgt.code = cc('http://loinc.org', '89764-8', 'Servings of vegetables per day [PhenX]') "SetCode";
  src.item as item where linkId = 'DH4' then MapVegetablePortions(item, tgt) "ProcessDH4";
}

group MapVegetablePortions(source src : QR, target tgt : Obs) {
  src.answer as answer then {
    answer.valueInteger as intObj then {
      intObj.value as numVal ->  tgt.value = create('Quantity') as qty,  qty.value = numVal,  qty.unit = 'Portionen',  qty.system = 'http://unitsofmeasure.org',  qty.code = '{serving}' "SetQuantity";
    } "ExtractValue";
  } "ProcessAnswer";
}