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-07-01

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">The arithmetic is performed by the questionnaire via the SDC</span>
<span style="color: navy">// </span><span style="color: green">calculatedExpression extension on item Q7-total-minutes (FHIRPath:</span>
<span style="color: navy">// </span><span style="color: green">(%resource.item.where(linkId='Q7').item.where(linkId='Q7-hours').answer.valueInteger * 60)</span>
<span style="color: navy">// </span><span style="color: green">+ %resource.item.where(linkId='Q7').item.where(linkId='Q7-minutes').answer.valueInteger</span>
<span style="color: navy">// </span><span style="color: green">). This map reads the pre-computed integer — no evaluate() needed.</span>
<span style="color: navy">// </span><span style="color: green">MaLaC-HD 1.6.0 integer extraction pattern used here:</span>
<span style="color: navy">// </span><span style="color: green">answer.valueInteger as intElem then { intElem.value as numVal → ... }</span>
<span style="color: navy">// </span><span style="color: green">The double .value unwrap gives MaLaC-HD a raw primitive it can copy</span>
<span style="color: navy">// </span><span style="color: green">into Quantity.value without a type-coercion crash (direct integer→decimal</span>
<span style="color: navy">// </span><span style="color: green">copy fails in MaLaC-HD). All Quantity fields are set in one rule so that</span>
<span style="color: navy">// </span><span style="color: green">no cross-scope variable reference occurs (also a MaLaC-HD limitation).</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>  <span style="color: navy">// </span><span style="color: green">src is the Q7 group item; Q7-total-minutes is a calculated child item.</span>
  src.item<b> as </b><span style="color: maroon">totMins</span><b> where </b>linkId = 'Q7-total-minutes'<b> then</b><span style="color: navy"> {
</span>    totMins.answer<b> as </b><span style="color: maroon">ans</span><b> then</b><span style="color: navy"> {
</span>      ans.valueInteger<b> as </b><span style="color: maroon">intElem</span><b> then</b><span style="color: navy"> {
</span>        intElem.value<b> as </b><span style="color: maroon">numVal</span><span style="color: navy"><b> -&gt; </b></span> tgt.component<b> as </b><span style="color: maroon">aggComp</span><span style="color: navy">, </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><span style="color: navy">, </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><span style="color: navy">, </span> qty.value = <span style="color: maroon">numVal</span><span style="color: navy">, </span> qty.unit = <span style="color: blue">'min/wk'</span><span style="color: navy">, </span> qty.system = <span style="color: blue">'http://unitsofmeasure.org'</span><span style="color: navy">, </span> qty.code = <span style="color: blue">'min/wk'</span> <i>&quot;SetAggregateComponent&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;UnwrapInteger&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;GetAnswer&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;GetTotalMins&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-07-01T10:20:10+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
The arithmetic is performed by the questionnaire via the SDC
calculatedExpression extension on item Q7-total-minutes (FHIRPath:
(%resource.item.where(linkId='Q7').item.where(linkId='Q7-hours').answer.valueInteger * 60)
+ %resource.item.where(linkId='Q7').item.where(linkId='Q7-minutes').answer.valueInteger
). This map reads the pre-computed integer — no evaluate() needed.
MaLaC-HD 1.6.0 integer extraction pattern used here:
answer.valueInteger as intElem then { intElem.value as numVal → ... }
The double .value unwrap gives MaLaC-HD a raw primitive it can copy
into Quantity.value without a type-coercion crash (direct integer→decimal
copy fails in MaLaC-HD). All Quantity fields are set in one rule so that
no cross-scope variable reference occurs (also a MaLaC-HD limitation).
---------------------------------------------------------------------------"/>
    <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="GetTotalMins"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="totMins"/>
        <condition value="linkId = 'Q7-total-minutes'"/>
      </source>
      <rule>
        <name value="GetAnswer"/>
        <source>
          <context value="totMins"/>
          <element value="answer"/>
          <variable value="ans"/>
        </source>
        <rule>
          <name value="UnwrapInteger"/>
          <source>
            <context value="ans"/>
            <element value="valueInteger"/>
            <variable value="intElem"/>
          </source>
          <rule>
            <name value="SetAggregateComponent"/>
            <source>
              <context value="intElem"/>
              <element value="value"/>
              <variable value="numVal"/>
            </source>
            <target>
              <context value="tgt"/>
              <contextType value="variable"/>
              <element value="component"/>
              <variable value="aggComp"/>
            </target>
            <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>
            <target>
              <context value="aggComp"/>
              <contextType value="variable"/>
              <element value="value"/>
              <variable value="qty"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Quantity"/>
              </parameter>
            </target>
            <target>
              <context value="qty"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="numVal"/>
              </parameter>
            </target>
            <target>
              <context value="qty"/>
              <contextType value="variable"/>
              <element value="unit"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="min/wk"/>
              </parameter>
            </target>
            <target>
              <context value="qty"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="http://unitsofmeasure.org"/>
              </parameter>
            </target>
            <target>
              <context value="qty"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="min/wk"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
</StructureMap>