Create a new EHR

Create a new EHR with an auto-generated identifier.
Request body may contain ehr_status and ehr_access attributes. When provided these
resources will also be created as part of the create EHR action,
otherwise default resources will be created automatically by the service.

Example URI

POSThttp://www.openehr.org/api/ehr

Request

HideShow

Headers

Prefer: return={representation|minimal}

Body

{
"commit_audit": {
"description": "Commit audit description",
"committer": {"_type": "PARTY_IDENTIFIED", ... }
},
"ehr_status": { /* not included attributes that are mandatory in the IM are set by the server, e.g. ehr_status.owner_id will be set when an uid is set for the EHR being created */"_type": "VERSIONED_EHR_STATUS",
"uid": "_a_valid_uid_", /* UUID or OID, UUID preferred */"time_created": "YYYYMMDDThhmmss,SSS(Z|[+-]hhmm)", /* ISO8601 e.g. 20170801T010646,000+0000 or 20170801T010646,000Z */
}
}

Response 201

HideShow

201 Created is returned when a new EHR has been successfully created.
The EHR resource is returned in the body when the Prefer header has the value of return=representation.

Create a new EHR with ehrId

Create new EHR with the specified EHR identifier.
The request body may contain ehr_status and ehr_access attributes,
which will be used to create these initial resources associated with the new EHR.
When the ehr_status or ehr_access attributes are not provided, defaults resources
will be created by the service.

400 Bad Request is returned when the request has invalid content such as an invalid ehrId value. // PP: what is an invalid ehdId? are we validating format? not empty? it is better to make it opaque, if it comes and there is no EHR with that id, return 404.

Response 401

HideShow

401 Unauthorized is returned when request is not authorised.

Response 404

HideShow

404 Not Found is returned when an EHR with ehrId does not exist.

Delete EHR

This call is under discussion. // PP: do not allow DELETE, use PUT to update EHR_ACCESS to not queryable and/or not modifiable.

Mark the EHR as deleted by updating the associated EHR_STATUS and EHR_ACCESS as deleted.
The request body contains commit_audit attribute to be used as the commit audit details
for the deleted EHR_STATUS and EHR_ACCESS resources. Where an implementation requires
additional attestation to authorise the deletion, this can be provided in the attestations
attribute in the request.

Note: Some jurisdictions may require the service to physically delete the EHR and all its content. // PP: since this is a delicate operation, it might be performed by an EHR management system, IMO it is not needed at the API level (for now).

This operation may be used to implement this capability but the commit_audit and attestations must be
retained using an alternative audit trail than the usual contribution audit details.

Get EHR_STATUS

Retrieve the EHR_STATUS associated with the EHR specified by ehrId.
When the versionSelector parameter is provided, the EHR_STATUS version that existed at the specified version time is returned,
otherwise the latest trunk version is returned.
The versionSelector parameter may be an ISO8601 datetime string or symbolic value such as LATEST_TRUNK_VERSION.

Example URI

GEThttp://www.openehr.org/api/ehr/ehrId/ehr_status?versionSelector=

URI Parameters

HideShow

ehrId

string(required)

EHR identifier

versionSelector

string(optional)

version time specifier

Response 200

HideShow

200 OK is return with the EHR_STATUS resource in the body when it is successfully retrieved.

Get EHR_STATUS by versionUid

Retrieve the version of the EHR_STATUS associated with the specified ehrId and versionUid. // PP: this operation is included in the previous one, just use versionSelector=versionUid. IMO this should be removed.

Update EHR_STATUS

Update EHR_STATUS associated with the specified ehrId.
The existing versionUid of EHR_STATUS resource must be specified in the Match-If header.
The response will contain the updated EHR_STATUS resource when the Prefer header has a value of return=representation

Get EHR_STATUS version

Retrieve the VERSION of an EHR_STATUS associated with the specified ehrId and selected by versionSelector.
When the versionSelector parameter is provided, the VERSION that existed at the specified version time is returned,
otherwise the latest trunk version is returned.
The versionSelector parameter may be an ISO8601 datetime string or symbolic value such as LATEST_TRUNK_VERSION.

Headers

Create a new composition

// PP: why not POST /compositions with ehrId as param? we can keep all the COMPOSITION endpoints under /compositions instead of using both /ehr/ehrId/compositions and /compositions, IMO is simpler to implement with one set of URLs for a resource. Maybe someone have a good argument for keeping both endpoints.

Update or create a composition

This call can be used to update an existing composition (identified by {objectId}) or
to create a new one with the supplied {objectId} instead of a server assigned one.
In case of an update Match-If header might be required.