{
  "resourceType" : "OperationDefinition",
  "id" : "patient-export",
  "language" : "en",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition patient-export</b></p><a name=\"patient-export\"> </a><a name=\"hcpatient-export\"> </a><p>URL: [base]/Patient/$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>_outputFormat</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>Support is required for a Data Provider, optional for a Data Consumer.</p>\n<p>The format of the bulk data files generated through the <a href=\"async.html\">FHIR Asynchronous Bulk Interaction Pattern</a>. Defaults to <code>application/fhir+ndjson</code>. The Data Provider SHALL support <a href=\"https://github.com/ndjson/ndjson-spec\">Newline Delimited JSON</a>, but MAY choose to support additional output formats. The Data Provider SHALL accept the full content type of <code>application/fhir+ndjson</code> as well as the abbreviated representations <code>application/ndjson</code> and <code>ndjson</code>.</p>\n</div></td></tr><tr><td>IN</td><td>_since</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#instant\">instant</a></td><td/><td><div><p>Support is required for a Data Provider, optional for a Data Consumer.</p>\n<p>Resources will be included in the response if their state has changed after the supplied time (e.g., if <code>Resource.meta.lastUpdated</code> is later than the supplied <code>_since</code> time). The Data Provider MAY return resources that are referenced by the resources being returned regardless of when the referenced resources were last updated. For resources where the Data Provider does not maintain a last updated time, the Data Provider MAY include these resources in a response irrespective of the <code>_since</code> value supplied by a Data Consumer.</p>\n</div></td></tr><tr><td>IN</td><td>_until</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#instant\">instant</a></td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>Resources will be included in the response if their state has changed before the supplied time (e.g., if <code>Resource.meta.lastUpdated</code> is earlier than the supplied <code>_until</code> time). The Data Provider MAY return resources that are referenced by the resources being returned regardless of when the referenced resources were last updated. For resources where the Data Provider does not maintain a last updated time, the Data Provider MAY include these resources in a response irrespective of the <code>_until</code> value supplied by a Data Consumer.</p>\n</div></td></tr><tr><td>IN</td><td>_type</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>The response SHALL be filtered to only include resources of the specified resource type(s).</p>\n<p>If this parameter is omitted, the Data Provider SHALL return all supported resources within the scope of the Data Consumer's authorization, though implementations MAY limit the resources returned to specific subsets of FHIR, such as those defined in the <a href=\"http://www.hl7.org/fhir/us/core/\">US Core Implementation Guide</a>. For Patient- and Group-level requests, the <a href=\"https://www.hl7.org/fhir/compartmentdefinition-patient.html\">Patient Compartment</a> SHOULD be used as a point of reference for recommended resources to be returned. However, other resources outside of the Patient Compartment that are referenced by the resources being returned and would be helpful in interpreting the patient data MAY also be returned (such as Organization and Practitioner). When this behavior is supported, a Data Provider SHOULD document this support (for example, as narrative text, or by including a <a href=\"https://www.hl7.org/fhir/graphdefinition.html\">GraphDefinition Resource</a>).</p>\n<p>A Data Provider that is unable to support <code>_type</code> SHOULD return an error and FHIR <code>OperationOutcome</code> resource so the Data Consumer can re-submit a request omitting the <code>_type</code> parameter. If the Data Consumer explicitly asks for export of resources that the Data Provider does not support, or asks for only resource types that are outside the Patient Compartment, the Data Provider SHOULD return details via a FHIR <code>OperationOutcome</code> resource in an error response to the request. When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n<p>For example <code>_type=Observation</code> could be used to filter a given export response to return only FHIR <code>Observation</code> resources.</p>\n</div></td></tr><tr><td>IN</td><td>_elements</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>Experimental support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>When provided, the Data Provider SHOULD omit unlisted, non-mandatory elements from the resources returned. Elements SHOULD be of the form <code>[resource type].[element name]</code> (e.g., <code>Patient.id</code>) or <code>[element name]</code> (e.g., <code>id</code>) and only root elements in a resource are permitted. If the resource type is omitted, the element SHOULD be returned for all resources in the response where it is applicable.</p>\n<p>A Data Provider is not obliged to return just the requested elements. A Data Provider SHOULD always return mandatory elements whether they are requested or not. A Data Provider SHOULD mark the resources with the tag <code>SUBSETTED</code> to ensure that the incomplete resource is not actually used to overwrite a complete resource.</p>\n<p>A Data Provider that is unable to support <code>_elements</code> SHOULD return an error and a FHIR <code>OperationOutcome</code> resource so the Data Consumer can re-submit a request omitting the <code>_elements</code> parameter. When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n</div></td></tr><tr><td>IN</td><td>patient</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/references.html#Reference\">Reference</a> (<a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"http://hl7.org/fhir/StructureDefinition/Patient\">Patient</a>)</td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>Not applicable to system level export requests. This parameter is only valid in kickoff requests initiated through an HTTP POST request. When provided, the Data Provider SHALL NOT return resources in the patient compartments belonging to patients outside of this list. If a Data Consumer requests patients who are not present on the Data Provider (or in the case of a group level export, who are not members of the group), the Data Provider SHOULD return details via a FHIR <code>OperationOutcome</code> resource in an error response to the request.</p>\n<p>A Data Provider that is unable to support the <code>patient</code> parameter SHOULD return an error and FHIR <code>OperationOutcome</code> resource so the Data Consumer can re-submit a request omitting the <code>patient</code> parameter. When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n</div></td></tr><tr><td>IN</td><td>includeAssociatedData</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#code\">code</a></td><td><a href=\"ValueSet-include-associated-data.html\">Include Associated Data Value Set</a> (Extensible)</td><td><div><p>Experimental support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>When provided, a Data Provider with support for the parameter and requested values SHALL return or omit a pre-defined set of FHIR resources associated with the request.</p>\n<p>A Data Provider that is unable to support the requested <code>includeAssociatedData</code> values SHOULD return an error and a FHIR <code>OperationOutcome</code> resource so the Data Consumer can re-submit a request that omits those values (for example, if a Data Provider does not retain provenance data). When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n<p>A Data Consumer MAY include one or more of the following values. If multiple conflicting values are included, the Data Provider SHALL apply the least restrictive value (value that will return the largest dataset).</p>\n<ul>\n<li><code>LatestProvenanceResources</code>: Export will include the most recent Provenance resources associated with each of the non-provenance resources being returned. Other Provenance resources will not be returned.</li>\n<li><code>RelevantProvenanceResources</code>: Export will include all Provenance resources associated with each of the non-provenance resources being returned.</li>\n<li><code>_[custom value]</code>: A Data Provider MAY define and support custom values that are prefixed with an underscore (e.g., <code>_myCustomPreset</code>).</li>\n</ul>\n</div></td></tr><tr><td>IN</td><td>_typeFilter</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>String of a FHIR REST search query.</p>\n<p>When provided, a Data Provider with support for the parameter and requested search queries SHALL filter the data in the response for resource types referenced in the typeFilter expression to only include resources that meet the specified criteria. FHIR search result parameters such as <code>_include</code> and <code>_sort</code> SHALL NOT be used and a query in the <code>_typeFilter</code> parameter SHALL have the search context of a single FHIR Resource Type. <a href=\"export.html#_typefilter-query-parameter\">See details</a>.</p>\n<p>A Data Provider unable to support the requested <code>_typeFilter</code> queries SHOULD return an error and FHIR <code>OperationOutcome</code> resource so the Data Consumer can re-submit a request that omits those queries. When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n</div></td></tr><tr><td>IN</td><td>organizeOutputBy</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>String of a FHIR resource type.</p>\n<p>When provided, a Data Provider with support for the parameter SHALL organize the resources in output files by instances of the specified resource type, including a header for each resource of the type specified in the parameter, followed by the resource and resources in the output that contain references to that resource. When omitted, Data Providers SHALL organize each output file with resources of only a single type. See <a href=\"export.html#bulk-data-output-file-organization\">details</a>, <a href=\"export.html#organize-output-by-manifest-example\">example manifest</a>, and <a href=\"export.html#organize-output-by-file-example\">example output file</a>.</p>\n<p>A Data Provider unable to structure output by the requested <code>organizeOutputBy</code> resource SHOULD return an error and FHIR <code>OperationOutcome</code> resource. When a <code>Prefer: handling=lenient</code> header is included in the request, the Data Provider MAY process the request instead of returning an error.</p>\n</div></td></tr><tr><td>IN</td><td>allowPartialManifests</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#boolean\">boolean</a></td><td/><td><div><p>Support is optional for a Data Provider, optional for a Data Consumer.</p>\n<p>When provided, a Data Provider with support for the parameter MAY distribute the bulk data output files among multiple manifests, providing links for Data Consumers to page through the manifests (<a href=\"export.html#manifest-link\">see details</a>). Prior to all of the files in the export being available, the Data Provider MAY return a manifest with files that are available along with a <code>202 Accepted</code> HTTP response status, and subsequently update the manifest with a paging link to a new manifest when additional files are ready for download (<a href=\"export.html#response---in-progress-status\">see details</a>).</p>\n</div></td></tr></table></div>"
  },
  "extension" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
    "valueInteger" : 5
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
    "valueCode" : "fhir"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
    "valueCode" : "trial-use",
    "_valueCode" : {
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
        "valueCanonical" : "http://hl7.org/fhir/uv/bulkdata/ImplementationGuide/hl7.fhir.uv.bulkdata"
      }]
    }
  }],
  "url" : "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export",
  "version" : "4.0.0",
  "name" : "PatientLevelExport",
  "title" : "FHIR Bulk Data Patient Level Export",
  "status" : "active",
  "kind" : "operation",
  "date" : "2021-07-29",
  "publisher" : "HL7 International / FHIR Infrastructure",
  "contact" : [{
    "name" : "HL7 International / FHIR Infrastructure",
    "telecom" : [{
      "system" : "url",
      "value" : "http://www.hl7.org/Special/committees/fiwg"
    },
    {
      "system" : "email",
      "value" : "fhir@lists.HL7.org"
    }]
  }],
  "description" : "FHIR Operation through which an authenticated and authorized Data Consumer requests a detailed set of FHIR resources of diverse resource types pertaining to all patients from a Data Provider. The Data Provider's FHIR Resource Server SHALL support invocation of this operation using the [FHIR Asynchronous Bulk Interaction Pattern](async.html)",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001"
    }]
  }],
  "code" : "export",
  "resource" : ["Patient"],
  "system" : false,
  "type" : true,
  "instance" : false,
  "parameter" : [{
    "name" : "_outputFormat",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Support is required for a Data Provider, optional for a Data Consumer.\n\nThe format of the bulk data files generated through the [FHIR Asynchronous Bulk Interaction Pattern](async.html). Defaults to `application/fhir+ndjson`. The Data Provider SHALL support [Newline Delimited JSON](https://github.com/ndjson/ndjson-spec), but MAY choose to support additional output formats. The Data Provider SHALL accept the full content type of `application/fhir+ndjson` as well as the abbreviated representations `application/ndjson` and `ndjson`.",
    "type" : "string"
  },
  {
    "name" : "_since",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Support is required for a Data Provider, optional for a Data Consumer.\n\nResources will be included in the response if their state has changed after the supplied time (e.g., if `Resource.meta.lastUpdated` is later than the supplied `_since` time). The Data Provider MAY return resources that are referenced by the resources being returned regardless of when the referenced resources were last updated. For resources where the Data Provider does not maintain a last updated time, the Data Provider MAY include these resources in a response irrespective of the `_since` value supplied by a Data Consumer.",
    "type" : "instant"
  },
  {
    "name" : "_until",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nResources will be included in the response if their state has changed before the supplied time (e.g., if `Resource.meta.lastUpdated` is earlier than the supplied `_until` time). The Data Provider MAY return resources that are referenced by the resources being returned regardless of when the referenced resources were last updated. For resources where the Data Provider does not maintain a last updated time, the Data Provider MAY include these resources in a response irrespective of the `_until` value supplied by a Data Consumer.",
    "type" : "instant"
  },
  {
    "name" : "_type",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nThe response SHALL be filtered to only include resources of the specified resource type(s).\n\nIf this parameter is omitted, the Data Provider SHALL return all supported resources within the scope of the Data Consumer's authorization, though implementations MAY limit the resources returned to specific subsets of FHIR, such as those defined in the [US Core Implementation Guide](http://www.hl7.org/fhir/us/core/). For Patient- and Group-level requests, the [Patient Compartment](https://www.hl7.org/fhir/compartmentdefinition-patient.html) SHOULD be used as a point of reference for recommended resources to be returned. However, other resources outside of the Patient Compartment that are referenced by the resources being returned and would be helpful in interpreting the patient data MAY also be returned (such as Organization and Practitioner). When this behavior is supported, a Data Provider SHOULD document this support (for example, as narrative text, or by including a [GraphDefinition Resource](https://www.hl7.org/fhir/graphdefinition.html)).\n\nA Data Provider that is unable to support `_type` SHOULD return an error and FHIR `OperationOutcome` resource so the Data Consumer can re-submit a request omitting the `_type` parameter. If the Data Consumer explicitly asks for export of resources that the Data Provider does not support, or asks for only resource types that are outside the Patient Compartment, the Data Provider SHOULD return details via a FHIR `OperationOutcome` resource in an error response to the request. When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.\n\nFor example `_type=Observation` could be used to filter a given export response to return only FHIR `Observation` resources.",
    "type" : "string"
  },
  {
    "name" : "_elements",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "Experimental support is optional for a Data Provider, optional for a Data Consumer.\n\nWhen provided, the Data Provider SHOULD omit unlisted, non-mandatory elements from the resources returned. Elements SHOULD be of the form `[resource type].[element name]` (e.g., `Patient.id`) or `[element name]` (e.g., `id`) and only root elements in a resource are permitted. If the resource type is omitted, the element SHOULD be returned for all resources in the response where it is applicable.\n\nA Data Provider is not obliged to return just the requested elements. A Data Provider SHOULD always return mandatory elements whether they are requested or not. A Data Provider SHOULD mark the resources with the tag `SUBSETTED` to ensure that the incomplete resource is not actually used to overwrite a complete resource.\n\nA Data Provider that is unable to support `_elements` SHOULD return an error and a FHIR `OperationOutcome` resource so the Data Consumer can re-submit a request omitting the `_elements` parameter. When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.",
    "type" : "string"
  },
  {
    "name" : "patient",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nNot applicable to system level export requests. This parameter is only valid in kickoff requests initiated through an HTTP POST request. When provided, the Data Provider SHALL NOT return resources in the patient compartments belonging to patients outside of this list. If a Data Consumer requests patients who are not present on the Data Provider (or in the case of a group level export, who are not members of the group), the Data Provider SHOULD return details via a FHIR `OperationOutcome` resource in an error response to the request.\n\nA Data Provider that is unable to support the `patient` parameter SHOULD return an error and FHIR `OperationOutcome` resource so the Data Consumer can re-submit a request omitting the `patient` parameter. When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.",
    "type" : "Reference",
    "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient"]
  },
  {
    "name" : "includeAssociatedData",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "Experimental support is optional for a Data Provider, optional for a Data Consumer.\n\nWhen provided, a Data Provider with support for the parameter and requested values SHALL return or omit a pre-defined set of FHIR resources associated with the request.\n\nA Data Provider that is unable to support the requested `includeAssociatedData` values SHOULD return an error and a FHIR `OperationOutcome` resource so the Data Consumer can re-submit a request that omits those values (for example, if a Data Provider does not retain provenance data). When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.\n\nA Data Consumer MAY include one or more of the following values. If multiple conflicting values are included, the Data Provider SHALL apply the least restrictive value (value that will return the largest dataset).\n\n* `LatestProvenanceResources`: Export will include the most recent Provenance resources associated with each of the non-provenance resources being returned. Other Provenance resources will not be returned.\n* `RelevantProvenanceResources`: Export will include all Provenance resources associated with each of the non-provenance resources being returned.\n* `_[custom value]`: A Data Provider MAY define and support custom values that are prefixed with an underscore (e.g., `_myCustomPreset`).",
    "type" : "code",
    "binding" : {
      "strength" : "extensible",
      "valueSet" : "http://hl7.org/fhir/uv/bulkdata/ValueSet/include-associated-data"
    }
  },
  {
    "name" : "_typeFilter",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nString of a FHIR REST search query.\n\nWhen provided, a Data Provider with support for the parameter and requested search queries SHALL filter the data in the response for resource types referenced in the typeFilter expression to only include resources that meet the specified criteria. FHIR search result parameters such as `_include` and `_sort` SHALL NOT be used and a query in the `_typeFilter` parameter SHALL have the search context of a single FHIR Resource Type. [See details](export.html#_typefilter-query-parameter).\n\nA Data Provider unable to support the requested `_typeFilter` queries SHOULD return an error and FHIR `OperationOutcome` resource so the Data Consumer can re-submit a request that omits those queries. When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.",
    "type" : "string"
  },
  {
    "name" : "organizeOutputBy",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nString of a FHIR resource type.\n\nWhen provided, a Data Provider with support for the parameter SHALL organize the resources in output files by instances of the specified resource type, including a header for each resource of the type specified in the parameter, followed by the resource and resources in the output that contain references to that resource. When omitted, Data Providers SHALL organize each output file with resources of only a single type. See [details](export.html#bulk-data-output-file-organization), [example manifest](export.html#organize-output-by-manifest-example), and [example output file](export.html#organize-output-by-file-example).\n\nA Data Provider unable to structure output by the requested `organizeOutputBy` resource SHOULD return an error and FHIR `OperationOutcome` resource. When a `Prefer: handling=lenient` header is included in the request, the Data Provider MAY process the request instead of returning an error.",
    "type" : "string"
  },
  {
    "name" : "allowPartialManifests",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "Support is optional for a Data Provider, optional for a Data Consumer.\n\nWhen provided, a Data Provider with support for the parameter MAY distribute the bulk data output files among multiple manifests, providing links for Data Consumers to page through the manifests ([see details](export.html#manifest-link)). Prior to all of the files in the export being available, the Data Provider MAY return a manifest with files that are available along with a `202 Accepted` HTTP response status, and subsequently update the manifest with a paging link to a new manifest when additional files are ready for download ([see details](export.html#response---in-progress-status)).",
    "type" : "boolean"
  }]
}