eHealth Infrastructure (v2019.5.2)


<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="-s-create-episode-of-care"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><h2>create-episode-of-care</h2><p>OPERATION: create-episode-of-care</p><p>The official URL for this operation definition is: </p><pre>http://ehealth.sundhed.dk/fhir/OperationDefinition/-s-create-episode-of-care</pre><div><p>This operation persists an EpisodeOfCare based on the transient value of an EpisodeOfCare provided in the input.</p>
<h2>Input</h2>
<p>The input is a Bundle which must contain exactly one EpisodeOfCare and at least one Provenance resource. All Provenances in the input must have the EpisodeOfCare as target. At least one Provenance must interprete into a 'Privacy-provenance' (see below).</p>
<h3>The EpisodeOfCare resource</h3>
<p>The 'id' property of the EpisodeOfCare will be reassigned by the server, but can be referenced by other resources in the same bundle.
The 'managingOrganization' property of the EpisodeOfCare references the GDPR Data Controller (Danish: 'Dataansvarlig').</p>
<h3>The privacy-Provenance resource</h3>
<p>A privacy-Provenance is a Provenance resource characterized by having at least two entries in Provenance.policy of which the first indicates the category of registered persons, for which data are transported, stored, or processed as a result of this transaction. Possible values are:</p>
<ul>
<li>'http://ehealth.sundhed.dk/policy/ehealth/patient-data'  (Danish: Person- og patientdata)</li>
<li>'http://ehealth.sundhed.dk/policy/ehealth/supplier-data'  (Danish: Leverandørdata)</li>
<li>'http://ehealth.sundhed.dk/policy/ehealth/practitioner-data' (Danish: Medarbejderdata)</li>
</ul>
<p>At least one other policy must be stated in Provenance.policy to indicate the legal basis on which data are transported, stored, or processed in the system. Possible values are:</p>
<ul>
<li>'http://ehealth.sundhed.dk/policy/dk/sundhedsloven-0.6.0'</li>
<li>'http://ehealth.sundhed.dk/policy/dk/persondataloven-0.6.0'</li>
<li>'http://ehealth.sundhed.dk/policy/dk/sikkerhedsbekendtgørelsen-0.6.0'</li>
<li>'http://ehealth.sundhed.dk/policy/dk/databeskyttelsesloven-0.6.0'</li>
<li>'http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation-0.6.0'</li>
</ul>
<h3>Diagnosis referenced Condition resource</h3>
<p>For any diagnosis listed, the referenced Condition must be concerning the same Patient as the EpisodeOfCare.</p>
<h2>Output</h2>
<p>For valid inputs, the server will create, persist and return a new EpisodeOfCare carrying a server-assigned id.</p>
<h3>The origin-Provenance resource</h3>
<p>Whenever an EpisodeOfCare is created, the server automatically creates an 'origin' Provenance resource point to it (in addition to the client-supplied Privacy-Provenance). This Origin-Provenance resource is filled with data from the JWT access token in order to record the origin of the EpisodeOfCare resource. For instance agent.whoReference may point to a resource which is created as a shadow identity from the JWT token, if a matching resource is not already found in the system.</p>
<h2>Examples</h2>
<h3>Input</h3>
<pre><code>{
  'resourceType': 'Bundle',
  'type': 'transaction',
  'entry': [
    {
      'resource': {
        'resourceType': 'Provenance',
        'id': '1',
        'target': [
          {
            'reference': '#2'
          }
        ],
        'recorded': '2019-04-11T12:50:24+02:00',
        'policy': [
          'http://ehealth.sundhed.dk/policy/ehealth/patient-data',
          'http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation'
        ],
        'agent': [
          {
            'role': [
              {
                'coding': [
                  {
                    'system': 'http://hl7.org/fhir/v3/ParticipationType',
                    'code': 'RESP'
                  }
                ]
              }
            ],
            'whoReference': {
              'reference': 'http://ehealth.sundhed.dk/organization/fhir/Practitioner/321421'
            }
          }
        ]
      },
      'request': {
        'method': 'POST',
        'url': 'Provenance'
      }
    },
    {
      'resource': {
        'resourceType': 'EpisodeOfCare',
        'id': 2,
        'status': 'planned',
        'diagnosis': [
          {
            'condition': {
              'reference': 'http://ehealth.sundhed.dk/careplan/fhir/Condition/1678072'
            }
          }
        ],
        'patient': {
          'reference': 'Patient/4072'
        },
        'managingOrganization': {
          'reference': 'http://ehealth.sundhed.dk/organization/fhir/Organization/71'
        },
        'period': {
          'start': '1970-01-01T01:00:01+01:00',
          'end': '2099-01-01T01:01:40+01:00'
        }
      },
      'request': {
        'method': 'POST',
        'url': 'EpisodeOfCare'
      }
    }
  ]
}
</code></pre>
<h3>Output</h3>
<pre><code>{
  'resourceType': 'Bundle',
  'type': 'transaction',
  'entry': [
    {
      'resource': {
        'resourceType': 'Provenance',
        'id': '849028939',
        'target': [
          {
            'reference': ''
          }
        ],
        'recorded': '2019-04-11T12:50:24+02:00',
        'policy': [
          'http://ehealth.sundhed.dk/policy/ehealth/patient-data',
          'http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation'
        ],
        'agent': [
          {
            'role': [
              {
                'coding': [
                  {
                    'system': 'http://hl7.org/fhir/v3/ParticipationType',
                    'code': 'RESP'
                  }
                ]
              }
            ],
            'whoReference': {
              'reference': 'http://ehealth.sundhed.dk/organization/fhir/Practitioner/321421'
            }
          }
        ]
      },
      'response': {
        'status': '200 OK',
        'location': 'http://ehealth.sundhed.dk/provenance/fhir/Provenance/849028939'
      }
    },
    {
      'resource': {
        'resourceType': 'Provenance',
        'id': '849028940',
        'target': [
          {
            'reference': 'EpisodeOfCare/298359'
          }
        ],
        'recorded': '2019-04-11T17:50:24+02:00',
        'reason': [
          {
            'system': 'http://hl7.org/fhir/v3/ActReason',
            'code': 'PATADMIN'
          }
        ],
        'activity': {
          'system': 'http://hl7.org/fhir/v3/DataOperation',
          'code': 'CREATE'
        },
        'agent': [
          {
            'role': [
              {
                'coding': [
                  {
                    'system': 'http://hl7.org/fhir/v3/ParticipationType',
                    'code': 'ENT'
                  }
                ]
              }
            ],
            'whoReference': {
              'reference': 'http://ehealth.sundhed.dk/organization/fhir/Practitioner/4241545'
            }
          }
        ]
      },
      'response': {
        'status': '200 OK',
        'location': 'http://ehealth.sundhed.dk/provenance/fhir/Provenance/849028940'
      }
    },
    {
      'resource': {
        'resourceType': 'EpisodeOfCare',
        'id': '298359',
        'status': 'planned',
        'diagnosis': [
          {
            'condition': {
              'reference': 'http://ehealth.sundhed.dk/careplan/fhir/Condition/1678072'
            }
          }
        ],
        'patient': {
          'reference': 'Patient/4072'
        },
        'managingOrganization': {
          'reference': 'http://ehealth.sundhed.dk/organization/fhir/Organization/71'
        },
        'period': {
          'start': '1970-01-01T01:00:01+01:00',
          'end': '2099-01-01T01:01:40+01:00'
        }
      },
      'response': {
        'status': '200 OK',
        'location': 'http://ehealth.sundhed.dk/episodeofcare/fhir/EpisodeOfCare/78954'
      }
    }
  ]
}
</code></pre>
</div><p>URL: [base]/$create-episode-of-care</p><p>Parameters</p><table class="grid"><tr><td><b>Use</b></td><td><b>Name</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>episodeOfCareAndProvenances</td><td>1..1</td><td><a href="http://hl7.org/fhir/STU3/bundle.html">Bundle</a></td><td/><td/></tr><tr><td>OUT</td><td>return</td><td>0..1</td><td><a href="http://hl7.org/fhir/STU3/bundle.html">Bundle</a></td><td/><td/></tr></table></div>
  </text>
  <url
       value="http://ehealth.sundhed.dk/fhir/OperationDefinition/-s-create-episode-of-care"/>
  <version value="2019.5.2"/>
  <name value="create-episode-of-care"/>
  <status value="active"/>
  <kind value="operation"/>
  <date value="2019-05-29T18:05:58+00:00"/>
  <description
               value="This operation persists an EpisodeOfCare based on the transient value of an EpisodeOfCare provided in the input.
## Input
The input is a Bundle which must contain exactly one EpisodeOfCare and at least one Provenance resource. All Provenances in the input must have the EpisodeOfCare as target. At least one Provenance must interprete into a &#39;Privacy-provenance&#39; (see below).
### The EpisodeOfCare resource
The &#39;id&#39; property of the EpisodeOfCare will be reassigned by the server, but can be referenced by other resources in the same bundle. 
The &#39;managingOrganization&#39; property of the EpisodeOfCare references the GDPR Data Controller (Danish: &#39;Dataansvarlig&#39;).
### The privacy-Provenance resource
A privacy-Provenance is a Provenance resource characterized by having at least two entries in Provenance.policy of which the first indicates the category of registered persons, for which data are transported, stored, or processed as a result of this transaction. Possible values are:
- &#39;http://ehealth.sundhed.dk/policy/ehealth/patient-data&#39;  (Danish: Person- og patientdata)
- &#39;http://ehealth.sundhed.dk/policy/ehealth/supplier-data&#39;  (Danish: Leverandørdata)
- &#39;http://ehealth.sundhed.dk/policy/ehealth/practitioner-data&#39; (Danish: Medarbejderdata)

At least one other policy must be stated in Provenance.policy to indicate the legal basis on which data are transported, stored, or processed in the system. Possible values are:
- &#39;http://ehealth.sundhed.dk/policy/dk/sundhedsloven-0.6.0&#39;
- &#39;http://ehealth.sundhed.dk/policy/dk/persondataloven-0.6.0&#39;
- &#39;http://ehealth.sundhed.dk/policy/dk/sikkerhedsbekendtgørelsen-0.6.0&#39;
- &#39;http://ehealth.sundhed.dk/policy/dk/databeskyttelsesloven-0.6.0&#39;
- &#39;http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation-0.6.0&#39;
### Diagnosis referenced Condition resource
For any diagnosis listed, the referenced Condition must be concerning the same Patient as the EpisodeOfCare.
## Output
For valid inputs, the server will create, persist and return a new EpisodeOfCare carrying a server-assigned id.
### The origin-Provenance resource
Whenever an EpisodeOfCare is created, the server automatically creates an &#39;origin&#39; Provenance resource point to it (in addition to the client-supplied Privacy-Provenance). This Origin-Provenance resource is filled with data from the JWT access token in order to record the origin of the EpisodeOfCare resource. For instance agent.whoReference may point to a resource which is created as a shadow identity from the JWT token, if a matching resource is not already found in the system.
## Examples
### Input
```
{
  &#39;resourceType&#39;: &#39;Bundle&#39;,
  &#39;type&#39;: &#39;transaction&#39;,
  &#39;entry&#39;: [
    {
      &#39;resource&#39;: {
        &#39;resourceType&#39;: &#39;Provenance&#39;,
        &#39;id&#39;: &#39;1&#39;,
        &#39;target&#39;: [
          {
            &#39;reference&#39;: &#39;#2&#39;
          }
        ],
        &#39;recorded&#39;: &#39;2019-04-11T12:50:24+02:00&#39;,
        &#39;policy&#39;: [
          &#39;http://ehealth.sundhed.dk/policy/ehealth/patient-data&#39;,
          &#39;http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation&#39;
        ],
        &#39;agent&#39;: [
          {
            &#39;role&#39;: [
              {
                &#39;coding&#39;: [
                  {
                    &#39;system&#39;: &#39;http://hl7.org/fhir/v3/ParticipationType&#39;,
                    &#39;code&#39;: &#39;RESP&#39;
                  }
                ]
              }
            ],
            &#39;whoReference&#39;: {
              &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/organization/fhir/Practitioner/321421&#39;
            }
          }
        ]
      },
      &#39;request&#39;: {
        &#39;method&#39;: &#39;POST&#39;,
        &#39;url&#39;: &#39;Provenance&#39;
      }
    },
    {
      &#39;resource&#39;: {
        &#39;resourceType&#39;: &#39;EpisodeOfCare&#39;,
        &#39;id&#39;: 2,
        &#39;status&#39;: &#39;planned&#39;,
        &#39;diagnosis&#39;: [
          {
            &#39;condition&#39;: {
              &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/careplan/fhir/Condition/1678072&#39;
            }
          }
        ],
        &#39;patient&#39;: {
          &#39;reference&#39;: &#39;Patient/4072&#39;
        },
        &#39;managingOrganization&#39;: {
          &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/organization/fhir/Organization/71&#39;
        },
        &#39;period&#39;: {
          &#39;start&#39;: &#39;1970-01-01T01:00:01+01:00&#39;,
          &#39;end&#39;: &#39;2099-01-01T01:01:40+01:00&#39;
        }
      },
      &#39;request&#39;: {
        &#39;method&#39;: &#39;POST&#39;,
        &#39;url&#39;: &#39;EpisodeOfCare&#39;
      }
    }
  ]
}
```
### Output
```
{
  &#39;resourceType&#39;: &#39;Bundle&#39;,
  &#39;type&#39;: &#39;transaction&#39;,
  &#39;entry&#39;: [
    {
      &#39;resource&#39;: {
        &#39;resourceType&#39;: &#39;Provenance&#39;,
        &#39;id&#39;: &#39;849028939&#39;,
        &#39;target&#39;: [
          {
            &#39;reference&#39;: &#39;&#39;
          }
        ],
        &#39;recorded&#39;: &#39;2019-04-11T12:50:24+02:00&#39;,
        &#39;policy&#39;: [
          &#39;http://ehealth.sundhed.dk/policy/ehealth/patient-data&#39;,
          &#39;http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation&#39;
        ],
        &#39;agent&#39;: [
          {
            &#39;role&#39;: [
              {
                &#39;coding&#39;: [
                  {
                    &#39;system&#39;: &#39;http://hl7.org/fhir/v3/ParticipationType&#39;,
                    &#39;code&#39;: &#39;RESP&#39;
                  }
                ]
              }
            ],
            &#39;whoReference&#39;: {
              &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/organization/fhir/Practitioner/321421&#39;
            }
          }
        ]
      },
      &#39;response&#39;: {
        &#39;status&#39;: &#39;200 OK&#39;,
        &#39;location&#39;: &#39;http://ehealth.sundhed.dk/provenance/fhir/Provenance/849028939&#39;
      }
    },
    {
      &#39;resource&#39;: {
        &#39;resourceType&#39;: &#39;Provenance&#39;,
        &#39;id&#39;: &#39;849028940&#39;,
        &#39;target&#39;: [
          {
            &#39;reference&#39;: &#39;EpisodeOfCare/298359&#39;
          }
        ],
        &#39;recorded&#39;: &#39;2019-04-11T17:50:24+02:00&#39;,
        &#39;reason&#39;: [
          {
            &#39;system&#39;: &#39;http://hl7.org/fhir/v3/ActReason&#39;,
            &#39;code&#39;: &#39;PATADMIN&#39;
          }
        ],
        &#39;activity&#39;: {
          &#39;system&#39;: &#39;http://hl7.org/fhir/v3/DataOperation&#39;,
          &#39;code&#39;: &#39;CREATE&#39;
        },
        &#39;agent&#39;: [
          {
            &#39;role&#39;: [
              {
                &#39;coding&#39;: [
                  {
                    &#39;system&#39;: &#39;http://hl7.org/fhir/v3/ParticipationType&#39;,
                    &#39;code&#39;: &#39;ENT&#39;
                  }
                ]
              }
            ],
            &#39;whoReference&#39;: {
              &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/organization/fhir/Practitioner/4241545&#39;
            }
          }
        ]
      },
      &#39;response&#39;: {
        &#39;status&#39;: &#39;200 OK&#39;,
        &#39;location&#39;: &#39;http://ehealth.sundhed.dk/provenance/fhir/Provenance/849028940&#39;
      }
    },
    {
      &#39;resource&#39;: {
        &#39;resourceType&#39;: &#39;EpisodeOfCare&#39;,
        &#39;id&#39;: &#39;298359&#39;,
        &#39;status&#39;: &#39;planned&#39;,
        &#39;diagnosis&#39;: [
          {
            &#39;condition&#39;: {
              &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/careplan/fhir/Condition/1678072&#39;
            }
          }
        ],
        &#39;patient&#39;: {
          &#39;reference&#39;: &#39;Patient/4072&#39;
        },
        &#39;managingOrganization&#39;: {
          &#39;reference&#39;: &#39;http://ehealth.sundhed.dk/organization/fhir/Organization/71&#39;
        },
        &#39;period&#39;: {
          &#39;start&#39;: &#39;1970-01-01T01:00:01+01:00&#39;,
          &#39;end&#39;: &#39;2099-01-01T01:01:40+01:00&#39;
        }
      },
      &#39;response&#39;: {
        &#39;status&#39;: &#39;200 OK&#39;,
        &#39;location&#39;: &#39;http://ehealth.sundhed.dk/episodeofcare/fhir/EpisodeOfCare/78954&#39;
      }
    }
  ]
}
```
"/>
  <idempotent value="false"/>
  <code value="create-episode-of-care"/>
  <system value="true"/>
  <type value="false"/>
  <instance value="false"/>
  <parameter>
    <name value="episodeOfCareAndProvenances"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <type value="Bundle"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Bundle"/>
  </parameter>
</OperationDefinition>