Lifecycle_state in EHRbase

@Paulmiller

Right now Ehrbase does not support AQL for the VERSION object, which is wrapper around a stored composition that has the lifecycle_status on it.

However you can use the REST API to get the VERSION container for any composition.

https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#composition-versioned_composition-get-2

which would let you see the lifecyle_state and ‘hide’ that composition if appropriate.

To set the lifecycle_state on a composition you would have to use the POST /contribution call which allows you to manually tweak the Version information before you commit the composition (which goes inside the data attribute). The usual POST /composition does actually do a POST /contribution this behind the scenes, with sensible defaults. So it is a little more cumbersome but can be boilerplated fairly easily.

the Better CDR dos support VERSION querying e.g.

SELECT
    vo/uid/value,
    vo/owner_id/id/value,
    vo/time_created,
    v/uid/value,
    v/preceding_version_uid/value,
    v/commit_audit/committer,
    v/commit_audit/time_committed
FROM EHR e
CONTAINS VERSIONED_OBJECT vo
CONTAINS VERSION v`
CONTAINS COMPOSITION c
WHERE c/name/value = 'ReSPECT-3'
and v/lifecycle_state/value  = 'completed'   //You could normally use the defining_code

which would only return ‘completed’ compositions, You don’t need the VERSIONED_OBJECT stuff - that is just for info

3 Likes