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

## : Physical Activity Minutes Q to O - XML Representation

Draft as of 2026-06-25

Raw xml | Download

    <StructureMap xmlns="http://hl7.org/fhir">
      <id value="PhysicalActivityMinutesQtoO"/>
      <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap PhysicalActivityMinutesQtoO</b></p><a name="PhysicalActivityMinutesQtoO"> </a><a name="hcPhysicalActivityMinutesQtoO"> </a><pre class="fml">
    <b>map</b><span style="color: navy"> &quot;</span>https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/PhysicalActivityMinutesQtoO<span style="color: navy">&quot; = &quot;</span>Physical Activity Minutes Q to O<span style="color: navy">&quot;

    </span><span style="color: navy">// </span><span style="color: green">Physical Activity EHIS-PAQ Q7 / ATHIS PE7 to O (aggregate-only variant)</span>

    <b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/questionnaireresponse.html" title="QuestionnaireResponse">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style="color: navy">&quot; </span><b>alias </b>QR <b>as </b><b>source</b>
    <b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/observation.html" title="Observation">http://hl7.org/fhir/StructureDefinition/Observation</a><span style="color: navy">&quot; </span><b>alias </b>Obs <b>as </b><b>target</b>

    <b>imports</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/StructureMap/*<span style="color: navy">&quot;
    </span><b>imports</b><span style="color: navy"> &quot;</span><a href="StructureMap-QuestionnaireResponseToObservationBase.html" title="Shared base for Q to O">https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/QuestionnaireResponseToObservationBase</a><span style="color: navy">&quot;
    </span>
    <span style="color: navy">// </span><span style="color: green">---------------------------------------------------------------------------</span>
    <span style="color: navy">// </span><span style="color: green">Main entry group</span>
    <span style="color: navy">// </span><span style="color: green">---------------------------------------------------------------------------</span>
    <b>group </b>PhysicalActivityQuestionnaireResponseToObservation<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Obs<span style="color: navy">)</span><span style="color: navy"> {
    </span>  <span style="color: navy">// </span><span style="color: green">Shared base: identifier copy, derivedFrom, subject, issued.</span>
      <span style="color: navy">// </span><span style="color: green">SetObservationBase also sets method = SCT 87982008 (Manual) — correct for</span>
      <span style="color: navy">// </span><span style="color: green">all questionnaire-derived observations in this IG.</span>
      src<b> then </b>SetObservationBase<span style="color: navy">(</span><span style="color: maroon">src</span><span style="color: navy">, </span><span style="color: maroon">tgt</span><span style="color: navy">)</span> <i>&quot;Base&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">// </span><span style="color: green">Explicitly confirm method = Manual (base already does this; listed for clarity).</span>
      src<span style="color: navy"><b> -&gt; </b></span>tgt.method = <b>cc</b><span style="color: navy">(</span><span style="color: blue">'http://snomed.info/sct'</span><span style="color: navy">, </span><span style="color: blue">'87982008'</span><span style="color: navy">, </span><span style="color: blue">'Manual'</span><span style="color: navy">)</span> <i>&quot;SetMethodManual&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">// </span><span style="color: green">Target profile</span>
      src<span style="color: navy"><b> -&gt; </b></span> tgt.meta = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Meta'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">meta</span><span style="color: navy">, </span> meta.profile = <span style="color: blue">'https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-physical-activity-minutes-observation'</span> <i>&quot;SetProfile&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">// </span><span style="color: green">Panel code</span>
      src<span style="color: navy"><b> -&gt; </b></span>tgt.code = <b>cc</b><span style="color: navy">(</span><span style="color: blue">'http://loinc.org'</span><span style="color: navy">, </span><span style="color: blue">'101691-4'</span><span style="color: navy">, </span><span style="color: blue">'Duration of physical activity'</span><span style="color: navy">)</span> <i>&quot;SetCode&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">// </span><span style="color: green">effectiveDateTime from authored (EHIS-PAQ Q7 has no embedded date item)</span>
      src.authored<b> as </b><span style="color: maroon">authored</span><span style="color: navy"><b> -&gt; </b></span>tgt.effectiveDateTime = <span style="color: maroon">authored</span> <i>&quot;SetEffectiveDateTime&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">// </span><span style="color: green">Map Q7 group to component[aggregateActivity]</span>
      src.item<b> as </b><span style="color: maroon">q7</span><b> where </b>linkId = 'Q7'<b> then </b>MapQ7ToAggregate<span style="color: navy">(</span><span style="color: maroon">q7</span><span style="color: navy">, </span><span style="color: maroon">tgt</span><span style="color: navy">)</span> <i>&quot;ProcessQ7&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">// </span><span style="color: green">component[moderateActivity] : NOT mapped</span>
    <span style="color: navy">// </span><span style="color: green">Q7 asks for total leisure activity time without separating intensity levels.</span>
    <span style="color: navy">// </span><span style="color: green">There is no questionnaire source for a moderate-only figure.</span>
    <span style="color: navy">// </span><span style="color: green">component[vigorousActivity] : NOT mapped</span>
    <span style="color: navy">// </span><span style="color: green">Total leisure time maps directly to aggregateActivity (see MapQ7ToAggregate).</span>
    <span style="color: navy">// </span><span style="color: green">component[classificationMethod] : NOT mapped</span>
    <span style="color: navy">// </span><span style="color: green">method = Manual → component must be absent or self-rp (pa-manual-comp-01).</span>
    <span style="color: navy">// </span><span style="color: green">The map does not set it; a consuming system may add self-rp post-transform</span>
    <span style="color: navy">// </span><span style="color: green">if explicit documentation of the classification basis is required.</span>
    <span style="color: navy">}

    </span><span style="color: navy">// </span><span style="color: green">---------------------------------------------------------------------------</span>
    <span style="color: navy">// </span><span style="color: green">Q7 → component[aggregateActivity]  (LOINC 101691-4)</span>
    <span style="color: navy">// </span><span style="color: green">Formula: aggregateMinutes = (Q7-hours × 60) + Q7-minutes</span>
    <span style="color: navy">// </span><span style="color: green">This is a direct transcription of the patient-reported total time.</span>
    <span style="color: navy">// </span><span style="color: green">No intensity weighting is applied because Q7 does not capture intensity.</span>
    <span style="color: navy">// </span><span style="color: green">The ×2 vigorous weighting (WHO/IPAQ) is ONLY applied when a wearable</span>
    <span style="color: navy">// </span><span style="color: green">separately measures moderate and vigorous minutes (wearable variant).</span>
    <span style="color: navy">// </span><span style="color: green">Note on FML arithmetic / MaLaC-HD compatibility:</span>
    <span style="color: navy">// </span><span style="color: green">This map uses evaluate() with integer arithmetic (* 60, +) which is NOT</span>
    <span style="color: navy">// </span><span style="color: green">supported by MaLaC-HD 1.6.0. MaLaC-HD fails at parse time with</span>
    <span style="color: navy">// </span><span style="color: green">&quot;Param type 14 not implemented&quot; (integer literal in FHIRPath expression).</span>
    <span style="color: navy">// </span><span style="color: green">The questionnaire captures hours and minutes as separate integer items,</span>
    <span style="color: navy">// </span><span style="color: green">so no MaLaC-HD compatible rewrite exists without redesigning the questionnaire</span>
    <span style="color: navy">// </span><span style="color: green">or changing the output unit. Use matchbox or another evaluate()-capable engine.</span>
    <span style="color: navy">// </span><span style="color: green">---------------------------------------------------------------------------</span>
    <b>group </b>MapQ7ToAggregate<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Obs<span style="color: navy">)</span><span style="color: navy"> {
    </span>  src<span style="color: navy"><b> -&gt; </b></span>tgt.component<b> as </b><span style="color: maroon">aggComp</span><b> then</b><span style="color: navy"> {
    </span>    <span style="color: navy">// </span><span style="color: green">Component discriminator code: LOINC 101691-4</span>
        <span style="color: navy">// </span><span style="color: green">Note: same code as panel Observation.code — collision documented in profile.</span>
        <span style="color: navy">// </span><span style="color: green">obs-7 is not violated because Observation.value[x] is absent.</span>
        src<span style="color: navy"><b> -&gt; </b></span>aggComp.code = <b>cc</b><span style="color: navy">(</span><span style="color: blue">'http://loinc.org'</span><span style="color: navy">, </span><span style="color: blue">'101691-4'</span><span style="color: navy">, </span><span style="color: blue">'Duration of physical activity'</span><span style="color: navy">)</span> <i>&quot;SetAggregateCode&quot;</i><span style="color: navy">;</span>
        src<span style="color: navy"><b> -&gt; </b></span>aggComp.value = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Quantity'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">qty</span><b> then</b><span style="color: navy"> {
    </span>      <span style="color: navy">// </span><span style="color: green">aggregateMinutes = (Q7-hours × 60) + Q7-minutes</span>
          src<span style="color: navy"><b> -&gt; </b></span>qty.value = evaluate<span style="color: navy">(</span>src<span style="color: navy">, </span>(item.where(linkId = 'Q7-hours').answer.valueInteger * 60) + item.where(linkId = 'Q7-minutes').answer.valueInteger<span style="color: navy">)</span> <i>&quot;ComputeAggregateMinutes&quot;</i><span style="color: navy">;</span>
          src<span style="color: navy"><b> -&gt; </b></span>qty.unit = <span style="color: blue">'min/wk'</span> <i>&quot;SetUnit&quot;</i><span style="color: navy">;</span>
          src<span style="color: navy"><b> -&gt; </b></span>qty.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;SetSystem&quot;</i><span style="color: navy">;</span>
          src<span style="color: navy"><b> -&gt; </b></span>qty.code = <span style="color: blue">'min/wk'</span> <i>&quot;SetUCUM&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;SetAggregateQuantity&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;MapAggregateComponent&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}

    </span></pre></div>
      </text>
      <url
           value="https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/PhysicalActivityMinutesQtoO"/>
      <version value="0.1.0"/>
      <name value="Physical Activity Minutes Q to O"/>
      <status value="draft"/>
      <date value="2026-06-25T12:51:02+00:00"/>
      <publisher value="The PreNUDGE Consortium"/>
      <contact>
        <name value="The PreNUDGE Consortium"/>
        <telecom>
          <system value="url"/>
          <value value="https://prenudge.at"/>
        </telecom>
      </contact>
      <contact>
        <name value="The PreNUDGE Consortium"/>
        <telecom>
          <system value="url"/>
          <value value="https://prenudge.at"/>
          <use value="work"/>
        </telecom>
      </contact>
      <description
                   value="Physical Activity EHIS-PAQ Q7 / ATHIS PE7 to O (aggregate-only variant)"/>
      <structure>
        <url
             value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
        <mode value="source"/>
        <alias value="QR"/>
      </structure>
      <structure>
        <url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
        <mode value="target"/>
        <alias value="Obs"/>
      </structure>
      <import value="http://hl7.org/fhir/StructureMap/*"/>
      <import
              value="https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/QuestionnaireResponseToObservationBase"/>
      <group>
        <name value="PhysicalActivityQuestionnaireResponseToObservation"/>
        <typeMode value="none"/>
        <documentation
                       value="---------------------------------------------------------------------------
    Main entry group
    ---------------------------------------------------------------------------"/>
        <input>
          <name value="src"/>
          <type value="QR"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="tgt"/>
          <type value="Obs"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="Base"/>
          <source>
            <context value="src"/>
          </source>
          <dependent>
            <name value="SetObservationBase"/>
            <variable value="src"/>
            <variable value="tgt"/>
          </dependent>
        </rule>
        <rule>
          <name value="SetMethodManual"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="method"/>
            <transform value="cc"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
            <parameter>
              <valueString value="87982008"/>
            </parameter>
            <parameter>
              <valueString value="Manual"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="SetProfile"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="meta"/>
            <variable value="meta"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Meta"/>
            </parameter>
          </target>
          <target>
            <context value="meta"/>
            <contextType value="variable"/>
            <element value="profile"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-physical-activity-minutes-observation"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="SetCode"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="cc"/>
            <parameter>
              <valueString value="http://loinc.org"/>
            </parameter>
            <parameter>
              <valueString value="101691-4"/>
            </parameter>
            <parameter>
              <valueString value="Duration of physical activity"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="SetEffectiveDateTime"/>
          <source>
            <context value="src"/>
            <element value="authored"/>
            <variable value="authored"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="effectiveDateTime"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="authored"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="ProcessQ7"/>
          <source>
            <context value="src"/>
            <element value="item"/>
            <variable value="q7"/>
            <condition value="linkId = 'Q7'"/>
          </source>
          <dependent>
            <name value="MapQ7ToAggregate"/>
            <variable value="q7"/>
            <variable value="tgt"/>
          </dependent>
        </rule>
      </group>
      <group>
        <name value="MapQ7ToAggregate"/>
        <typeMode value="none"/>
        <documentation
                       value="---------------------------------------------------------------------------
    Q7 → component[aggregateActivity]  (LOINC 101691-4)
    Formula: aggregateMinutes = (Q7-hours × 60) + Q7-minutes
    This is a direct transcription of the patient-reported total time.
    No intensity weighting is applied because Q7 does not capture intensity.
    The ×2 vigorous weighting (WHO/IPAQ) is ONLY applied when a wearable
    separately measures moderate and vigorous minutes (wearable variant).
    Note on FML arithmetic / MaLaC-HD compatibility:
    This map uses evaluate() with integer arithmetic (* 60, +) which is NOT
    supported by MaLaC-HD 1.6.0. MaLaC-HD fails at parse time with
    &quot;Param type 14 not implemented&quot; (integer literal in FHIRPath expression).
    The questionnaire captures hours and minutes as separate integer items,
    so no MaLaC-HD compatible rewrite exists without redesigning the questionnaire
    or changing the output unit. Use matchbox or another evaluate()-capable engine.
    ---------------------------------------------------------------------------"/>
        <input>
          <name value="src"/>
          <type value="QR"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="tgt"/>
          <type value="Obs"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="MapAggregateComponent"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="component"/>
            <variable value="aggComp"/>
          </target>
          <rule>
            <name value="SetAggregateCode"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="aggComp"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="cc"/>
              <parameter>
                <valueString value="http://loinc.org"/>
              </parameter>
              <parameter>
                <valueString value="101691-4"/>
              </parameter>
              <parameter>
                <valueString value="Duration of physical activity"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="SetAggregateQuantity"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="aggComp"/>
              <contextType value="variable"/>
              <element value="value"/>
              <variable value="qty"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Quantity"/>
              </parameter>
            </target>
            <rule>
              <name value="ComputeAggregateMinutes"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="qty"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="evaluate"/>
                <parameter>
                  <valueId value="src"/>
                </parameter>
                <parameter>
                  <valueString
                               value="(item.where(linkId = 'Q7-hours').answer.valueInteger * 60) + item.where(linkId = 'Q7-minutes').answer.valueInteger"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="SetUnit"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="qty"/>
                <contextType value="variable"/>
                <element value="unit"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="min/wk"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="SetSystem"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="qty"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="http://unitsofmeasure.org"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="SetUCUM"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="qty"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="copy"/>
                <parameter>
                  <valueString value="min/wk"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </group>
    </StructureMap>