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: Shared base for Q to O

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

Shared base for Q to O

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

    // Shared base for 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

    group SetObservationBase(source src : QR, target tgt : Obs) {
      // Fixed values
      src -> tgt.status = 'final' "SetStatus";
      src -> tgt.method = cc('http://snomed.info/sct', '87982008', 'Manual') "SetMethod";
      // Copy identifier from QuestionnaireResponse to Observation
      src.identifier as srcId -> tgt.identifier = create('Identifier') as tgtId then {
        srcId.system as s -> tgtId.system = s "CopyIdSystem";
        srcId.value as v -> tgtId.value = v "CopyIdValue";
        srcId.use as u -> tgtId.use = u "CopyIdUse";
      } "CopyIdentifier";
      // Set derivedFrom reference back to the QuestionnaireResponse
      src.id as srcRefId ->  tgt.derivedFrom = create('Reference') as ref,  ref.reference = append('QuestionnaireResponse/', srcRefId) "SetDerivedFrom";
      // Subject reference
      src.subject as subject -> tgt.subject = create('Reference') as ref then {
        subject.reference as r -> ref.reference = r "CopySubjectRef";
      } "SetSubject";
      // Instance creation datetime
      src.authored as authored -> tgt.issued = authored "SetEffective";
    }