# Setting audit\_change\_type value in compositions

**URL:** <https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600>\
**Category:** Platform\
**Created:** [22 August 2024 11:29 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600 "2024-08-22T11:29:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)\
**Post date:** [22 August 2024 11:29 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/1 "2024-08-22T11:29:09Z")

</div>

When I get a versioned composition (3c355f02-c805-4a29-84bd-7fb71cbafb76::ehr.ehr.network::3) I do not see get any commit\_audit details, but I am able to retrieve it using aql(v/commit\_audit/change\_type/value).

However even for updated compositions, the change\_type is shown as creation. So I assume that this is not managed by the server and needs to be supplied at the time of POST/PUT of the composition.

What is the format to do this in FLAT compositions?

regards

---

<div class="post-metadata">

**Author:** ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)\
**Post date:** [26 August 2024 07:35 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/2 "2024-08-26T07:35:32Z")

</div>

@birger.haarbrandt does EHRBase support adding commit\_audit/change\_type in FLAT compositions? Currently we are getting “creation” for both initial and updated versions of compositions.

regards

---

<div class="post-metadata">

**Author:** ![sebastian.iancu](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.iancu/32/31_2.png) [@sebastian.iancu](https://discourse.openehr.org/u/sebastian.iancu)\
**Post date:** [26 August 2024 08:02 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/3 "2024-08-26T08:02:58Z")

</div>

I don’t know if commit\_audit is part of FLAT or neither I don’t know how particularly EHRbase is or should handle it, but I would just like to comment from a general perspective:

The Version (and commit) data is not “inside” composition, as it is a metadata associated with the process or creation or update of that composition. As parallel with real life: consider that if a Composition is an (paper) envelope or a package that you want to send via regular-post, you will get the the stamp or stickers “on”, and not “in” your envelope/package, which has to be deliver unopen to the destination. Thus, you should not expect to have this info (commit\_audit) will be at same place (and mingled)with your clinical-data. Instead these are often available or supplied as extra http headers, or need another REST endpoint. That’s also the reason in AQL you need that extra `v`.

---

<div class="post-metadata">

**Author:** ![Dileep\_V\_S](https://discourse.openehr.org/user_avatar/discourse.openehr.org/dileep_v_s/32/664_2.png) [@Dileep\_V\_S](https://discourse.openehr.org/u/Dileep_V_S)\
**Post date:** [26 August 2024 09:48 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/4 "2024-08-26T09:48:13Z")

</div>

Thanks @sebastian.iancu What you say make sense and I also gathered this with my experimentation.

If commit\_audit is not part of the composition, shouldn’t the REST specs include how this is managed? I do not think the current REST specs covers this.

Headers in POST/PUT Composition is a good option. But the problem would be that we would need multiple headers - change\_type.value, change\_type.code, change\_type.terminology, commit\_audit/time\_committed etc. The other option is to put the composition inside a larger container, that contains composition object, commit\_audit object and probably other metadata.

Is this aspect being considered from the specifications perspective?

regards

---

<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:** [26 August 2024 10:53 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/5 "2024-08-26T10:53:22Z")

</div>

It is explicitly covered by the /Contribution calls - this does exactly what you are describing.

> **[EHR API openEHR specs](https://specifications.openehr.org/releases/ITS-REST/Release-1.0.3/ehr.html#tag/CONTRIBUTION)**
>
> EHR API openEHR specifications

The /composition POST actually performs a CONTRIBUTION under the hood - so it is essentially a convenience wrapper for simple single composition commit use-cases.

---

<div class="post-metadata">

**Author:** ![sebastian.iancu](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.iancu/32/31_2.png) [@sebastian.iancu](https://discourse.openehr.org/u/sebastian.iancu)\
**Post date:** [26 August 2024 11:06 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/6 "2024-08-26T11:06:57Z")

</div>

> [@Dileep\_V\_S](#):
>
> Is this aspect being considered from the specifications perspective?

There are some recommendation for such related headers on request, and in theory something similar can be used for response, but I don’t know the implementation state.

The larger-container is what Ian mentioned → Contribution.

---

<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:** [26 August 2024 11:12 UTC](https://discourse.openehr.org/t/setting-audit-change-type-value-in-compositions/5600/7 "2024-08-26T11:12:54Z")

</div>

FLAT/ STRUCTURED Ehrscape calls do allow a little manipulation of the VERSION wrapper but via API parameters instead of Headers, so pretty well equivalent.

EhrBase openEHR Canonical REST supports FLAT/STRUCTURED, and I understand Better are implementing this also, so we will move away from Ehrscape /composition to openEHR /composition just to minimise confusion.
