<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="Observation-flat-export"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: OperationDefinition Observation-flat-export</b></p><a name="Observation-flat-export"> </a><a name="hcObservation-flat-export"> </a><p>URL: [base]/Observation/$flat-export</p><h3>Parameters</h3><table class="grid"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>observationProfile</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a></td><td/><td><div><p>The Observation FHIR profile to query.</p>
</div></td></tr><tr><td>IN</td><td>subject</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a></td><td/><td><div><p>The Patient NHI that is the target of the query.</p>
</div></td></tr><tr><td>IN</td><td>period</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#Period">Period</a></td><td/><td><div><p>The period for the query, where start and end are mandatory</p>
</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/binary.html">Binary</a></td><td/><td><div><p>A FHIR Binary resource containing the flat file as base64 encoded data. When decoded, it will contain the patient data in a flat format with the following structure.
<a href="./Binary-ObservationFlatExportResponse.html">See response example</a>.</p>
<pre><code class="language-json">[
  {
    &quot;id&quot;: &quot;1234&quot;,
    &quot;effectiveDateTime&quot;: &quot;2025-04-22&quot;,
    &quot;values&quot;: [
      {
        &quot;valueQuantity&quot;: {
          &quot;value&quot;: 6.3,
          &quot;unit&quot;: &quot;mmol/l&quot;,
          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,
          &quot;code&quot;: &quot;mmol/L&quot;
        }
      }
    ]
  },
  {
    &quot;id&quot;: &quot;5678&quot;,
    &quot;effectiveDateTime&quot;: &quot;2025-04-23&quot;,
    &quot;values&quot;: [
      {
        &quot;valueQuantity&quot;: {
          &quot;value&quot;: 2.3,
          &quot;unit&quot;: &quot;mmol/l&quot;,
          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,
          &quot;code&quot;: &quot;mmol/L&quot;
        }
      },
      {
        &quot;valueString&quot;: &quot;Normal&quot;
      }
    ]
  }
]
</code></pre>
<p>The response structure will contain an array of Observation resources, each represented in a flat format with the FHIR resource id, effective date, and value information.
Note that the values array can contain multiple entries, including any value[x] elements, which can be possible for Observations using components for multiple Observations</p>
</div></td></tr></table></div>
  </text>
  <url value="https://fhir-ig.digital.health.nz/shared-care/OperationDefinition/Observation-flat-export"/>
  <version value="0.4.4"/>
  <name value="flat-export"/>
  <status value="draft"/>
  <kind value="operation"/>
  <date value="2025-12-11T23:52:07+00:00"/>
  <publisher value="Te Whatu Ora"/>
  <contact>
    <name value="Te Whatu Ora"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.tewhatuora.govt.nz/"/>
    </telecom>
  </contact>
  <contact>
    <name value="Te Whatu Ora Integration Team"/>
    <telecom>
      <system value="email"/>
      <value value="integration@tewhatuora.govt.nz"/>
      <use value="work"/>
    </telecom>
  </contact>
  <description value="The Observation $flat-export operation exports Observation resources in a flat format.&#xA;See [request example](./Parameters-ObservationFlatExportRequest.html)."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="NZ"/>
      <display value="New Zealand"/>
    </coding>
  </jurisdiction>
  <code value="flat-export"/>
  <resource value="Observation"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="false"/>
  <parameter>
    <name value="observationProfile"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The Observation FHIR profile to query."/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="subject"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The Patient NHI that is the target of the query."/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="period"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The period for the query, where start and end are mandatory"/>
    <type value="Period"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="A FHIR Binary resource containing the flat file as base64 encoded data. When decoded, it will contain the patient data in a flat format with the following structure.&#xA;[See response example](./Binary-ObservationFlatExportResponse.html).&#xA;&#xA;```json&#xA;[&#xA;  {&#xA;    &quot;id&quot;: &quot;1234&quot;,&#xA;    &quot;effectiveDateTime&quot;: &quot;2025-04-22&quot;,&#xA;    &quot;values&quot;: [&#xA;      {&#xA;        &quot;valueQuantity&quot;: {&#xA;          &quot;value&quot;: 6.3,&#xA;          &quot;unit&quot;: &quot;mmol/l&quot;,&#xA;          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,&#xA;          &quot;code&quot;: &quot;mmol/L&quot;&#xA;        }&#xA;      }&#xA;    ]&#xA;  },&#xA;  {&#xA;    &quot;id&quot;: &quot;5678&quot;,&#xA;    &quot;effectiveDateTime&quot;: &quot;2025-04-23&quot;,&#xA;    &quot;values&quot;: [&#xA;      {&#xA;        &quot;valueQuantity&quot;: {&#xA;          &quot;value&quot;: 2.3,&#xA;          &quot;unit&quot;: &quot;mmol/l&quot;,&#xA;          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,&#xA;          &quot;code&quot;: &quot;mmol/L&quot;&#xA;        }&#xA;      },&#xA;      {&#xA;        &quot;valueString&quot;: &quot;Normal&quot;&#xA;      }&#xA;    ]&#xA;  }&#xA;]&#xA;```&#xA;&#xA;The response structure will contain an array of Observation resources, each represented in a flat format with the FHIR resource id, effective date, and value information.&#xA;Note that the values array can contain multiple entries, including any value[x] elements, which can be possible for Observations using components for multiple Observations"/>
    <type value="Binary"/>
  </parameter>
</OperationDefinition>