eHealth Infrastructure (v2019.5.3)

create-episode-of-care

OPERATION: create-episode-of-care

The official URL for this operation definition is:

http://ehealth.sundhed.dk/fhir/OperationDefinition/-s-create-episode-of-care

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 'Privacy-provenance' (see below).

The EpisodeOfCare resource

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').

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:

  • 'http://ehealth.sundhed.dk/policy/ehealth/patient-data' (Danish: Person- og patientdata)
  • 'http://ehealth.sundhed.dk/policy/ehealth/supplier-data' (Danish: Leverandørdata)
  • 'http://ehealth.sundhed.dk/policy/ehealth/practitioner-data' (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:

  • 'http://ehealth.sundhed.dk/policy/dk/sundhedsloven-0.6.0'
  • 'http://ehealth.sundhed.dk/policy/dk/persondataloven-0.6.0'
  • 'http://ehealth.sundhed.dk/policy/dk/sikkerhedsbekendtgørelsen-0.6.0'
  • 'http://ehealth.sundhed.dk/policy/dk/databeskyttelsesloven-0.6.0'
  • 'http://ehealth.sundhed.dk/policy/eu/general-data-protection-regulation-0.6.0'

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 '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.

Examples

Input

{
  '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'
      }
    }
  ]
}

Output

{
  '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'
      }
    }
  ]
}

URL: [base]/$create-episode-of-care

Parameters

UseNameCardinalityTypeBindingDocumentation
INepisodeOfCareAndProvenances1..1Bundle
OUTreturn0..1Bundle