# Resolving EHR\_STATUS refs

**URL:** <https://discourse.openehr.org/t/resolving-ehr-status-refs/5628>\
**Category:** Platform\
**Created:** [27 August 2024 11:20 UTC](https://discourse.openehr.org/t/resolving-ehr-status-refs/5628 "2024-08-27T11:20:09Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [27 August 2024 11:20 UTC](https://discourse.openehr.org/t/resolving-ehr-status-refs/5628/1 "2024-08-27T11:20:10Z")

</div>

It seems to me that EHRbase resolves OBJECT\_REF refs in case of EHR\_STATUS, replacing it with the actual object - see [(UN)COMMON QUERIES | EHRbase Docs](https://docs.ehrbase.org/docs/EHRbase/Explore/AQL/Common#retrieve-ehr-id-and-external-subject-id-of-a-patient), but basically it is about an AQL like:

```auto
SELECT
   e/ehr_id/value,
   e/ehr_status/subject/external_ref/id/value
FROM EHR e

```

So my questions are:

1. Is this a (nice) EHRbase-feature, or an AQL requirement that I am not aware of?
2. Is this also working on Better platform AQL
3. Is this only implemented for EHR/EHR\_STATUS refs, or is it also available to more other situations? (for example for refs somewhere inside COMPOSITION structures)

---

<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:** [27 August 2024 11:29 UTC](https://discourse.openehr.org/t/resolving-ehr-status-refs/5628/2 "2024-08-27T11:29:12Z")

</div>

The Better CDR works exactly the same - I would guess this comes from original Ocean CDR behaviour.

Can you give an example of other Composition refs, other than LINKS and EHR\_URIS that are not resolved?

---

<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:** [27 August 2024 12:12 UTC](https://discourse.openehr.org/t/resolving-ehr-status-refs/5628/3 "2024-08-27T12:12:24Z")

</div>

I don’t have an example, I was curious about what else besides EHR\_STATUS is resolved in this fashion.  
These cases could be for instance refs of the other EHR aspects (directory, ehr\_status, contribution, etc) or from FOLDERs enclosing COMPOSITION. any other place where OBJECT\_REF is used.

If this case of object ref is always resolved, then:

1. should we have this specified in the AQL specs?
2. what to do with an AQL that is considering the RM and is trying to get he OBJECT\_REF? (e.g. `SELECT e/ehr_status/id/type FROM EHR e`)
3. What else (besides EHR\_STATUS) should the specs state that it should be always resolved?

In any case, the issue with accessing EHR\_STATUS could have been solved in a different way, without having the engine replace the ref with the corresponding object, with using equivalent `SELECT es FROM EHR contains EHR_STATUS es`, right?
