# text.div
careplan

# rest[].resource[].searchParam[].documentation
Only return resources which were last updated as specified by the given range

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Activity details defined in specific resource

# rest[].resource[].searchParam[].documentation
Instantiates FHIR protocol or definition

# rest[].resource[].searchParam[].documentation
A Participant with a specific function and actor

# rest[].resource[].searchParam[].documentation
draft | active | suspended | completed | entered-in-error | cancelled | unknown

# rest[].resource[].operation[].documentation
The operation modifies the care team assignment of the care plan and all of its sub plans.

# rest[].resource[].operation[].documentation
Suggest care teams matching the conditions required by the care plan on either a regional or a municipality level. The suggested care teams has reason codes matching all the conditions addressed by the care plan and has a managing organization matching the input region code or municipality code. One of region code or municipality code must be input. If both region code and municipality code is input, then the municipality code is ignored. Return a bundle with matching care teams and their managing organizations.

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication with the given _id

# rest[].resource[].searchParam[].documentation
Only return resources which were last updated as specified by the given range

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication share the following category(s)

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given EpisodeOfCare

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given participant actor

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given participant function

# rest[].resource[].searchParam[].documentation
A Participant with a specific function and actor

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given period

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given period end

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given period start

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given recipient

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given sent date

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given status

# rest[].resource[].searchParam[].documentation
Search for MaterialCommunication which are associated to the given subject

# rest[].resource[].searchParam[].documentation
Search the contents of the resource's data using a fulltext search

# rest[].resource[].searchParam[].documentation
Return resources linked to by the given target

# rest[].resource[].searchParam[].documentation
Only return resources which were last updated as specified by the given range

# rest[].resource[].searchParam[].documentation
Search for resources which have the given profile

# rest[].resource[].searchParam[].documentation
Search for resources which have the given security labels

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Search the contents of the resource's narrative using a fulltext search

# rest[].resource[].searchParam[].documentation
When request transitioned to being actionable

# rest[].resource[].searchParam[].documentation
draft | active | suspended | cancelled | completed | entered-in-error | unknown

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Resource for the actor (or group, by role)

# rest[].resource[].searchParam[].documentation
Affiliation to resources the consent is affiliated with, for instance EpisodeOfCare and CarePlan

# rest[].resource[].searchParam[].documentation
Classification of the consent statement - for indexing/retrieval

# rest[].resource[].searchParam[].documentation
Identifier for this record (external references)

# rest[].resource[].searchParam[].documentation
draft | proposed | active | rejected | inactive | entered-in-error

# rest[].resource[].searchParam[].documentation
When this document reference was created

# rest[].resource[].searchParam[].documentation
The organization intended to use this resource

# rest[].resource[].searchParam[].documentation
Role of organization related to modification of the DocumentReference

# rest[].resource[].searchParam[].documentation
The context that the content is intended to support

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Conditions/problems/diagnoses this episode of care is for

# rest[].resource[].searchParam[].documentation
Business Identifier(s) relevant for this EpisodeOfCare

# rest[].resource[].searchParam[].documentation
The organization that has assumed the specific responsibilities of this EpisodeOfCare

# rest[].resource[].searchParam[].documentation
A Participant with a specific function and actor

# rest[].resource[].searchParam[].documentation
The patient who is the focus of this episode of care

# rest[].resource[].searchParam[].documentation
The current status of the Episode of Care as provided (does not check the status history collection)

# rest[].resource[].searchParam[].documentation
The list of practitioners that may be facilitating this episode of care for specific purposes.

# rest[].resource[].operation[].documentation
Modify the care team assignment of the episode of care and all care plans that has the episode of care as context.

# rest[].resource[].operation[].documentation
Checks that it is allowed to set an EpisodeOfCare as context.
If the user requesting context is a patient, then the patient input parameter should be specified.
If the user requesting context is a practitioner, then the careTeam input parameter should be specified.
Throws an exception if it is not allowed to select the Episode Of Care context.
## Output
For valid Episode of Care is returned references that cause the Episode of Care to be valid context. 
For a practitioner, two output parameters will be returned on success:
- CareTeam: The Careteam that gave access
- EpisodeOfCare/CarePlan: The EpisodeOfCare or CarePlan that referenced the CareTeam

# rest[].resource[].searchParam[].documentation
Search the contents of the resource's data using a fulltext search

# rest[].resource[].searchParam[].documentation
Search the contents of the resource's data using a filter

# rest[].resource[].searchParam[].documentation
Return resources linked to by the given target

# rest[].resource[].searchParam[].documentation
Only return resources which were last updated as specified by the given range

# rest[].resource[].searchParam[].documentation
Search for resources which have the given profile

# rest[].resource[].searchParam[].documentation
Search for resources which have the given security labels

# rest[].resource[].searchParam[].documentation
Search for resources which have the given source value (Resource.meta.source)

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
Search the contents of the resource's narrative using a fulltext search

# rest[].resource[].searchParam[].documentation
E.g. Treatment, dietary, behavioral, etc.

# rest[].resource[].searchParam[].documentation
proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected

# rest[].resource[].searchParam[].documentation
Target Reference(s) (usually version specific)

# rest[].resource[].searchParam[].documentation
Search for resources which have the given tag

# rest[].resource[].searchParam[].documentation
An encounter in which this request is made

# rest[].resource[].searchParam[].documentation
proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option

# rest[].resource[].searchParam[].documentation
draft | active | on-hold | revoked | completed | entered-in-error | unknown

# rest[].operation[].documentation
This operation returns an overview of patient activities within a time period and filtered by either EpisodeOfCare or Condition code(s). On success, the returned Bundle contains a Parameters structure detailing the count of measurements received and expected. This is done per ServiceRequest with status active for those part of a CarePlan with status active related to eligible EpisodeOfCare resources. Eligible EpisodeOfCare are those with status active that refer to the given Patient and are either given as EpisodeOfCare reference in input or are referencing a Condition with a condition code that matches at least one of the Condition codes possibly given as input. The measurement regime expressed in ServiceRequest.occurrence[x] is, when possible, resolved to time slot(s) corresponding to datetime/period where an action is supposed to take place, typically performed by the Patient. When the occurrenceTiming variant is used, resolved time slots overlapping with the input time periode are considered. For occurrenceTiming expression which are either adhoc or unresolved, the effective datetime/period of a measurement is considered when checked for overlap with input time period.
## Input
The operation has three mandatory inputs, a Patient reference, a start date and an end date. Additionally the operation has three optional inputs: a list of reference(s) to EpisodeOfCare, a list of Codings for Condition and a list of Codings for tags.
### Patient reference
Mandatory reference for the Patient which the procedure overview is computed for.
### Start and end datetimes
Start and end datetime are both mandatory, and together specify the period of interest in the patient procedure overview. As stated above, for resolvable past and future time slots as well as adhoc and unresolved timings there must overlap with this period.
### EpisodeOfCare list
The list of EpisodeOfCare references is optional. If EpisodeOfCare are provided, these will be used to further filter which active EpisodeOfCare, CarePlan and ServiceRequest are considered for the patient procedure overview.
### Condition Coding list
The list of Coding for Condition is optional. If Condition Coding are provided, the EpisodeOfCare considered are those referring to a Condition matching at least one of the codes in the list. As above, the EpisodeOfCare (one or more) considered further determines which active EpisodeOfCare, CarePlan and ServiceRequest are considered.
### Tag Coding list
The list of Coding for tags is optional. If tag Coding are provided, the EpisodeOfCare considered are those including a tag matching at least one of the codes in the list. As above, both the Condition (one or more) and EpisodeOfCare (one or more) considered further determines which active EpisodeOfCare, CarePlan and ServiceRequest are considered.
### Extra boolean
This is an optional parameter that can be set to true if activities allowing 'Extra' submissions should be included in the response. Whether the ServiceRequest is included when Extra paremeter is set to true, is based on the ServiceRequest.includeAsExtra field.
## Output
For valid inputs, the server will compute and return a Bundle. The Bundle contains a Parameters resource with resolved measurement regimes and associated counts of measurement submitted and counts expected. Such counts are also included in the Parameters structure when the measurement regime is either adhoc or unresolved. In addition, the Bundle contains CarePlan and ServiceRequest referenced in the Parameters. The Bundle can contain an OperationOutcome describing any encountered warnings.
### Output Parameters
The output contains rows (encoded in parameters) for each matching and active ServiceRequest with resolved timings overlapping with the requested period. 

Rows are represented as Parameters.parameter with names: item_1, item_2, etc. Columns are represented as Parameters.parameter.part with name and value 
```
Example:
'resource': {
    'resourceType': 'Parameters',
    'parameter': [{
            'name': 'item_1',
            'part': [{
                    'name': 'CarePlan',
                    'valueReference': {
                        'reference': 'https://careplan.devtest.systematic-ehealth.com/fhir/CarePlan/164581'
                    }
            }]
    }]
}
 ```

### Columns

- CarePlan: Reference to the CarePlan that the ServiceRequest belongs to.
- ServiceRequest: Reference to the ServiceRequest.
- ServiceRequestVersionId: The version of the ServiceRequest (version specified at time of submit-measurement or the current version (for expected activities)).
- Activity: Description of the planned activity.
- ResolvedTimingStart: A planned start time for the activity in the requested period.
- ResolvedTimingEnd: A planned end time for the activity in the requested period. May be identical to start if no duration is specified in the measurement regime.
- TotalSubmitted: The number of measurements already submitted for this ServiceRequest and resolved timing.
- SubmittedTimely: The number of measurements where the measurement time matches the resolved timing.
- TimingType:
    * Resolved: a measurement regime that is supported by the infrastructure and where resolved timing and requested number of measurements can be calculated.
    * Unresolved: a measurement regime that is not supported by the infrastructure. Resolved Timing Start, end, submitted timely and Occurrences requested will be empty.
    * Adhoc: A ServiceRequest without a measurement regime or a measurement regime stating ad-hoc.
    * Extra: The service request may be performed outside the resolved timing.
- OccurrencesRequested: Expected number of measurements.
- TotalInvalidated: Number of measurements which are invalidated.

# rest[].operation[].documentation
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, conditions referenced in diagnosis list and at least one Provenance resource. All Provenances in the input must have the EpisodeOfCare as target. At least one Provenance must be interpreted into a 'Privacy-provenance' (see below).
### The EpisodeOfCare resource
The EpisodeOfCare has to have `PLANNED` status 
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 one entry in Provenance.policy which data are transported, stored, or processed in the system. Possible values are:
- 'http://ehealth.sundhed.dk/policy/dk/sundhedsloven'
- 'http://ehealth.sundhed.dk/policy/dk/serviceloven'
- 'http://ehealth.sundhed.dk/policy/dk/aeldreloven'
### Diagnosis referenced Condition resource
For any diagnosis listed, the referenced Condition must be concerning the same Patient as the EpisodeOfCare.
### Treatment area validation
When creating an EpisodeOfCare, the infrastructure validates that all diagnoses (referenced Condition.code) are within the treatment area of the telemedicine solution tied to the EpisodeOfCare.The telemedicine solution is determined by inspecting the incoming security token of the practitioner creating the EpisodeOfCare (coexistence-tag in scope claim).The treatment areas are defined by each telemedicine solution having a ValueSet determining the allowed Condition.code.The treatment area ValueSets are characterized by having a useContext with 'system-treatment-area' context code, and using the coexistence-tag as the value (see https://ehealth.sundhed.dk/fhir/ValueSet-ehealth-usage-context-type.html).
## Output
For valid inputs, the server will create, persist and return a new EpisodeOfCare, client-supplied provenances, conditions and origin-provenance carrying a server-assigned ids.
To get resources bodies in the output the request header has to contain parameter ```Prefer: return=representation```.
## Validation
- Patient.deceased must be false to create episode of care
### 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 points to a resource which is created as a shadow identity from the JWT token.

# rest[].operation[].documentation
Create a careplan with service requests for a specific episodeOfCare using the PlanDefinition as a template. If using POST the operation will persist resources and return the careplan. If using GET the operation will return transient resources in a transaction bundle. The bundle with transient careplan and servicerequest resources can then be modified before being persisted using a FHIR transaction.

# rest[].operation[].documentation
Operation for polling the status of a previously initiated FHIR Bulk Data System Level Export. A complete URL including the '_jobId' is returned in the 'Content-Location' response header when initiating the export. A 'GET' request to the polling location will return '202 Accepted' with a response header 'X-Progress' containing a status message for the progress of the export job. When the job has finished, the polling location will return '200 OK', and the contents of the body will be a JSON object providing metadata and links to the generated bulk data files. A 'DELETE' request can be used to cancel the export. If the export has already finished, the delete will return '404 Not Found', else the export job will be cancelled and a '202 Accepted' is returned with an operation outcome response.
### Parameters
- _jobId: the job ID for the Bulk Export job which was returned in the 'Content-Location' header when initiating the export

# rest[].operation[].documentation
FHIR Operation to initiate an export of data from a FHIR server. The type of resources returned can be restricted using the '_type' parameter, and the '_since' parameter can be used to restrict resources to be only included if changed since the supplied time. The FHIR server support invocation of this operation using the [FHIR Asynchronous Request Pattern](http://hl7.org/fhir/R4/async.html).
## Initiation of export
The initiation of an export must specify the request header 'Prefer: respond-async', and will return '202 Accepted' with a polling location in the response header 'Content-Location'. The polling location is for the endpoint '$export-poll-status' and has the export job ID as parameter '_jobId'.
### Parameters
- _outputFormat: Optional parameter to specify the output format of the exported files. Default is 'application/fhir+ndjson'
- _type: Optional parameter to specify a comma separated list of resource types to be included in the export. If not provided, all resource types will be included.
- _since: Optional parameter to specify a time. Only resources that have been created or modified after this time will be included in the export (i.e., if Resource.meta.lastUpdated is later than the supplied _since time).
- _until: Optional parameter to specify a time. Only resources that have been created or modified before this time will be included in the export (i.e., if Resource.meta.lastUpdated is earlier than the supplied _until time).
- _typeFilter: Optional parameter to apply search filter of resources for export. It is a string of comma-delimited FHIR REST search queries in the format [resourceType]?[parameters]. The filter will be applied when searching resources.
- _typePostFetchFilterUrl: Optional parameter to apply filtering of resources for export. It is a string of comma-delimited FHIR REST search queries in the format [resourceType]?[parameters]. The filter will be applied on resources after being fetched from the database.
- _includeHistory: Optional parameter to specify whether historical versions of resources should be included in the export. Default is false.
- _exportId: Optional parameter to specify a client provided identifier for the export. Resulting exported files (Binary) will be labeled with the identifer in meta extension 'https://hapifhir.org/NamingSystem/bulk-export-identifier'
## Polling status of export
Subsequent GET requests to the polling location will return '202 Accepted' with a response header 'X-Progress' containing a status message for the progress of the export job. When the job has finished, the polling location will return '200 OK', and the contents of the body will be a JSON object providing metadata and links to the generated bulk export data files.
## Retrieving exported files
The JSON object returned when the export job is complete will contain a list of files (Binary resources) available for download. Each file can be retrieved using a standard HTTP GET request to the provided URL. The security context of the Binary resources resulting from the export is the user that initiated the export. The files can therefore only be retrieved by the same user.
### Retention of exported files
The exported files are retained for a limited time after which they are deleted. The retention time is a server configuration with default 2 hours.

# rest[].operation[].documentation
Provides the number of resources currently stored on the server, broken down by resource type