# Lifecycle\_state in EHRbase

**URL:** https://discourse.openehr.org/t/lifecycle-state-in-ehrbase/1567
**Category:** Platform
**Tags:** ehrbase
**Created:** [19 May 2021 15:35 UTC](https://discourse.openehr.org/t/lifecycle-state-in-ehrbase/1567 "2021-05-19T15:35:02Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![ian.mcnicoll](https://discourse.openehr.org/user_avatar/discourse.openehr.org/ian.mcnicoll/32/4430_2.png) [@ian.mcnicoll](https://discourse.openehr.org/u/ian.mcnicoll)
#### Post date: [20 May 2021 11:40 UTC](https://discourse.openehr.org/t/lifecycle-state-in-ehrbase/1567/5 "2021-05-20T11:40:18Z")

</div>

@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](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.

```sql
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

---

_[View the full topic](https://discourse.openehr.org/t/lifecycle-state-in-ehrbase/1567)._
