{
  "resourceType" : "OperationDefinition",
  "id" : "Observation-flat-export",
  "text" : {
    "status" : "generated",
    "div" : "<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>\n</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>\n</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>\n</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.\n<a href=\"./Binary-ObservationFlatExportResponse.html\">See response example</a>.</p>\n<pre><code class=\"language-json\">[\n  {\n    &quot;id&quot;: &quot;1234&quot;,\n    &quot;effectiveDateTime&quot;: &quot;2025-04-22&quot;,\n    &quot;values&quot;: [\n      {\n        &quot;valueQuantity&quot;: {\n          &quot;value&quot;: 6.3,\n          &quot;unit&quot;: &quot;mmol/l&quot;,\n          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,\n          &quot;code&quot;: &quot;mmol/L&quot;\n        }\n      }\n    ]\n  },\n  {\n    &quot;id&quot;: &quot;5678&quot;,\n    &quot;effectiveDateTime&quot;: &quot;2025-04-23&quot;,\n    &quot;values&quot;: [\n      {\n        &quot;valueQuantity&quot;: {\n          &quot;value&quot;: 2.3,\n          &quot;unit&quot;: &quot;mmol/l&quot;,\n          &quot;system&quot;: &quot;http://unitsofmeasure.org&quot;,\n          &quot;code&quot;: &quot;mmol/L&quot;\n        }\n      },\n      {\n        &quot;valueString&quot;: &quot;Normal&quot;\n      }\n    ]\n  }\n]\n</code></pre>\n<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.\nNote 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>\n</div></td></tr></table></div>"
  },
  "url" : "https://fhir-ig.digital.health.nz/shared-care/OperationDefinition/Observation-flat-export",
  "version" : "0.4.7",
  "name" : "flat-export",
  "status" : "draft",
  "kind" : "operation",
  "date" : "2026-10-13T01:26:02+00:00",
  "publisher" : "Te Whatu Ora",
  "contact" : [{
    "name" : "Te Whatu Ora",
    "telecom" : [{
      "system" : "url",
      "value" : "https://www.tewhatuora.govt.nz/"
    }]
  },
  {
    "name" : "Te Whatu Ora Integration Team",
    "telecom" : [{
      "system" : "email",
      "value" : "integration@tewhatuora.govt.nz",
      "use" : "work"
    }]
  }],
  "description" : "The Observation $flat-export operation exports Observation resources in a flat format.\nSee [request example](./Parameters-ObservationFlatExportRequest.html).",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "urn:iso:std:iso:3166",
      "code" : "NZ",
      "display" : "New Zealand"
    }]
  }],
  "code" : "flat-export",
  "resource" : ["Observation"],
  "system" : false,
  "type" : true,
  "instance" : false,
  "parameter" : [{
    "name" : "observationProfile",
    "use" : "in",
    "min" : 1,
    "max" : "1",
    "documentation" : "The Observation FHIR profile to query.",
    "type" : "string"
  },
  {
    "name" : "subject",
    "use" : "in",
    "min" : 1,
    "max" : "1",
    "documentation" : "The Patient NHI that is the target of the query.",
    "type" : "string"
  },
  {
    "name" : "period",
    "use" : "in",
    "min" : 1,
    "max" : "1",
    "documentation" : "The period for the query, where start and end are mandatory",
    "type" : "Period"
  },
  {
    "name" : "return",
    "use" : "out",
    "min" : 1,
    "max" : "1",
    "documentation" : "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.\n[See response example](./Binary-ObservationFlatExportResponse.html).\n\n```json\n[\n  {\n    \"id\": \"1234\",\n    \"effectiveDateTime\": \"2025-04-22\",\n    \"values\": [\n      {\n        \"valueQuantity\": {\n          \"value\": 6.3,\n          \"unit\": \"mmol/l\",\n          \"system\": \"http://unitsofmeasure.org\",\n          \"code\": \"mmol/L\"\n        }\n      }\n    ]\n  },\n  {\n    \"id\": \"5678\",\n    \"effectiveDateTime\": \"2025-04-23\",\n    \"values\": [\n      {\n        \"valueQuantity\": {\n          \"value\": 2.3,\n          \"unit\": \"mmol/l\",\n          \"system\": \"http://unitsofmeasure.org\",\n          \"code\": \"mmol/L\"\n        }\n      },\n      {\n        \"valueString\": \"Normal\"\n      }\n    ]\n  }\n]\n```\n\nThe 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.\nNote 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" : "Binary"
  }]
}