# openEHR RM v2.0: points to improve/simplify the openEHR reference model

**URL:** <https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664>\
**Category:** Specifications\
**Created:** [29 May 2022 05:25 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664 "2022-05-29T05:25:18Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [29 May 2022 05:25 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/1 "2022-05-29T05:25:18Z")

</div>

Since a recent discussion about date/time types the idea of summarizing several improvements to the openEHR RM proposed and discussed from time to time into a list we can review and discuss over something concrete, I did a quick review of the specs to bring this discussion over the table, mainly checking the UML diagrams and remembering some issues I had when implementing the specs in the [EHRServer](https://cloudehrserver.com/) and the [openEHR Toolkit](https://toolkit.cabolabs.com/). This is just an exercise for the future, not something we need to do for tomorrow.

Note some of these are breaking changes! That is why this is RM v2.0.

1. Have some kind of system-wide CONTRIBUTION+AUDIT\_DETAILS for EHR operations like create EHR, delete EHR (even the physical delete use case required by some countries), etc. Currently CONTRIBUTIONs are just for in-EHR and VERSIONED data.

2. Support lifecycle state (incomplete, complete, deleted) for EHRs: allow to create ‘incomplete’ EHRs, for instance without the minimal required information. Currently only versioned data has lifecycle state.

3. Define an architectural component for a terminology service (TS), including the REST API and exchange format schemas (ITS). There is currently an initial spec for this in the support package that seems to be just for the openEHR terminology (?). It would be nice to generalize this package to access any terminology on an openEHR TS (SNOMED CT, LOINC, ICD X).

4. composition.EVENT\_CONTEXT should be LOCATABLE. It is PATHABLE but I think we might need the node\_id in the archetype, for instance to define alternatives.

5. Remove ENTRY.workflow\_id if it’s not used on any implementations.

6. ACTION.ism\_transition should be optional. Just recording an ACTION without any state or transition information should be allowed.

7. ACTIVITY.timing: DV\_PARSABLE should be fully specified.

> Timing of the activity, in the form of a parsable string. If used, the preferred syntax is ISO8601 ‘R’ format, but other formats may be used including HL7 GTS.
> 
> May be omitted if:
> 
> - timing is represented structurally in the description attribute (e.g. via archetyped elements), or
> - unavailable, e.g. imported legacy data; in such cases, the INSTRUCTION.narrative should carry text that indicates the timing of its activities.

a. The ‘R’ format mentioned is formally the ‘recurring time interval’ expression in ISO8601.  
b. We could restrict all the possible formats to just couple and add examples of each in the specs, making life of implementers a little easier.

1. INSTRUCTION\_DETAILS.activity\_id should be defined in a way it always identifies a single ACTIVITY within an INSTRUCTION: see updated issue description [[SPECPR-221] - openEHR JIRA](https://openehr.atlassian.net/browse/SPECPR-221)

2. Simplify ITEM\_STRUCTURE package: [https://openehr.atlassian.net/wiki/spaces/spec/pages/4915242/openEHR+2.x+RM+proposals+-+lower+information+model](https://openehr.atlassian.net/wiki/spaces/spec/pages/4915242/openEHR+2.x+RM+proposals+-+lower+information+model) (my proposal is in the list)

Rationale:

a. all ITEM\_STRUCTURE concrete types are a special case of TREE.  
b. the ITEM hierarchy is enough to represent a TREE  
c. ITEM could take the place of ITEM\_STRUCTURE in the RM  
d. if needed we could have some field that could state which kind of structure is represented at runtime  
e. either way most archetypes use ITEM\_TREE

1. DV\_IDENTIFIER.type could be a DV\_TEXT instead of String, allowing this field to be free or coded text via DV\_CODED\_TEXT. Since the ID type sometimes need to be controlled by a coding system.

2. Remove DV\_STATE, doesn’t seem to be used, it’s a leftover from some previous design of the RM.

3. Remove DV\_PARAGRAPH, doesn’t seem to be used.

4. TERM\_MAPPING might be defined inside, or linked to, our terminology server (see 3.)

5. DV\_PROPORTION: separate the concepts of percentage, ratio and fraction in different data value classes. This simplifies implementation in terms that the meaning of the numerator and denominator don’t depend on the PROPORTION\_KIND code, also removes the need of PROPORTION\_KIND. It’s just cleaner.

6. Remove double inheritance from date/time/duration classes, and make the internal representation independent from ISO8601. After studying our specs and the ISO specs, it seems we mixed what is representation for data exchange and representation for data management. ISO 8601 is for data exchange, and it’s limited for manipulation, management, and computation.

7. Define semantics and detailed operations for date/time/duration classes (after making the change in 15.)

8. DV\_PARSABLE.formalism: String could be DV\_TEXT to allow free or coded text via DV\_CODED\_TEXT when archetyped of at runtime.

9. Complete the ehr\_extract spec, it has a lot of TO BE SPECIFIED/DEFINED comments.

10. ehr\_extract diagram 1 shows “version container”, is that a VERSIONED\_OBJECT instance? After that in the spec, that “container” doesn’t seem to be defined.

11. Define how to query over LINKs in AQL.

12. Define how to query over INSTRUCTION/ACTIVITY+ACTION to know the current state or the history of states of an ACTIVITY. (depends on 8.)

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [29 May 2022 13:14 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/2 "2022-05-29T13:14:15Z")

</div>

I would suggest that we create some child pages under the [current root page in the wiki for openEHRv2 ideas](https://openehr.atlassian.net/wiki/spaces/spec/pages/4915243/openEHR+2.x+RM+proposals).

There are some already, and I’ve added another couple - blank right now, but will help to arrange the issues.

Some random points in response to the list.

> [@pablo](#):
>
> 1. Define an architectural component for a terminology service (TS), including the REST API and exchange format schemas (ITS). There is currently an initial spec for this in the support package that seems to be just for the openEHR terminology (?). It would be nice to generalize this package to access any terminology on an openEHR TS (SNOMED CT, LOINC, ICD X).

I built a [draft spec some time ago in the SM for this purpose](https://specifications.openehr.org/releases/UML/latest/index.html#Diagrams___19_0_3_8fe028d_1603907771620_32587_5458) - aligned to FHIR terminology service. I think this could be a good starting point.

> [@pablo](#):
>
> ACTION.ism\_transition should be optional. Just recording an ACTION without any state or transition information should be allowed.

We could do this, but it starts to create junk data in the EHR, which is a major source of grief in today’s systems. An Action with no state means that queries looking for say active or suspended orders don’t know what to return for such actions.

A better way to deal with it is to allow an ‘unknown’ state, or else the the state ‘unknown’ in the null-flavours sense (i.e. no data on state available). Then the query engine needs a mode to return only positive hits and also positive + unknown (= possible hits).

> [@pablo](#):
>
> DV\_IDENTIFIER.type could be a DV\_TEXT instead of String, allowing this field to be free or coded text via DV\_CODED\_TEXT. Since the ID type sometimes need to be controlled by a coding system.

Just a note on when to use DV\_XXX types - they should only be in places like `ELEMENT.value`, to allow polymorphic attachment. For attributes of known types, the more basic underlying primitive type can usually be used, e.g. `Terminology_code`, `String`, the `Iso8601_xxx` types etc. We made a few mistakes in the original RM, so this was not always followed, but it is in Task Planning.

> [@pablo](#):
>
> DV\_PROPORTION: separate the concepts of percentage, ratio and fraction in different data value classes. This simplifies implementation in terms that the meaning of the numerator and denominator don’t depend on the PROPORTION\_KIND code, also removes the need of PROPORTION\_KIND. It’s just cleaner.

Probably true I think.

> [@pablo](#):
>
> Remove double inheritance from date/time/duration classes, and make the internal representation independent from ISO8601. After studying our specs and the ISO specs, it seems we mixed what is representation for data exchange and representation for data management. ISO 8601 is for data exchange, and it’s limited for manipulation, management, and computation.

I did originally have exactly that separation, but it wasn’t popular… here’s the way the model looked back in 2017  
 ![openEHR-Idate_types](https://discourse.openehr.org/uploads/default/original/2X/1/14797576702e0a52fdffb82c082eb90953558fca.svg)

> [@pablo](#):
>
> Define how to query over LINKs in AQL.

This is probably openEHRv1.x

> [@pablo](#):
>
> Define how to query over INSTRUCTION/ACTIVITY+ACTION to know the current state or the history of states of an ACTIVITY. (depends on 8.)

Also openEHRv1.x querying guidance.

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [2 June 2022 22:12 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/3 "2022-06-02T22:12:01Z")

</div>

> [@thomas.beale](#):
>
> I would suggest that we create some child pages under the [current root page in the wiki for openEHRv2 ideas](https://openehr.atlassian.net/wiki/spaces/spec/pages/4915243/openEHR+2.x+RM+proposals).

I will create one page for each topic so we can discuss in detail.

> [@thomas.beale](#):
>
> > [@pablo](#):
> >
> > ACTION.ism\_transition should be optional. Just recording an ACTION without any state or transition information should be allowed.
> 
> We could do this, but it starts to create junk data in the EHR, which is a major source of grief in today’s systems. An Action with no state means that queries looking for say active or suspended orders don’t know what to return for such actions.

Not sure if that is junk data, because there could be cases for recording actions when there is no previous instruction, for instance in emergency care, ambulance/paramedic services.

So in the case the ACTIVITY is linked to an ACTION archetype\_id and an ACTION has INSTRUCTION\_DETAILS, the ISM\_TRANSITION would be required, but it that is not the case, the mandatory ISM\_TRANSITION could still generate junk data, since the mandatory ISM\_TRANSITION might not be needed.

On the other hand, it’s strange that INSTRUCTION\_DETAILS is optional and ISM\_TRANSITION is mandatory in an ACTION, which is strange to have a `current_state` without having the reference to the INSTRUCTION/ACTIVITY from INSTRUCTION\_DETAILS.

> [@thomas.beale](#):
>
> > [@pablo](#):
> >
> > DV\_IDENTIFIER.type could be a DV\_TEXT instead of String, allowing this field to be free or coded text via DV\_CODED\_TEXT. Since the ID type sometimes need to be controlled by a coding system.
> 
> Just a note on when to use DV\_XXX types - they should only be in places like `ELEMENT.value`, to allow polymorphic attachment. For attributes of known types, the more basic underlying primitive type can usually be used, e.g. `Terminology_code`, `String`, the `Iso8601_xxx` types etc. We made a few mistakes in the original RM, so this was not always followed, but it is in Task Planning.

Not sure why is that self-imposed constraint. DV\_TEXT is like any other type. If a DV\_XXX complies with the requirements of data elsewhere in the RM, why using something else?

The main point is: DV\_IDENTIFIER.type could be codified, and if that is the case, we need a place to store the terminology\_id. The same happens with any other String attribute in the RM that could be a coded value. Architecturally it’s better to define a type for those fields instead of inventing some patch solution like encoding code+terminology\_id in the String field. Also using String and requiring to store a code would require implementers to create their own custom subclass of String, like a CodedString. IMO that is a bad solution but is arguable.

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [3 June 2022 04:32 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/4 "2022-06-03T04:32:27Z")

</div>

@thomas.beale on a second thought, what you mention about using DV\_XXX just at the ELEMENT level is not what we have right now, you can see DV\_DATE, DV\_DATE\_TIME, CODE\_PHRASE, DV\_PARSABLE, DV\_TEXT and DV\_CODED\_TEXT everywhere in the RM from EHR to ELEMENT, so I’m not sure if that argument could be sustained for not using DV\_TEXT/DV\_CODED\_TEXT elsewhere to formalize some fields that could be coded or could be just plain strings.

Even in LOCATABLE there is a name: DV\_TEXT field, so most classes in the RM actually have a DV\_TEXT field because they inherit from LOCATABLE.

At the DV level we also have DVs using other DVs as types for their internal fields:

- DV\_STATE.value: DV\_CODED\_TEXT
- DV\_TEXT.hyperlink: DV\_URI
- DV\_ORDINAL.symbol: DV\_CODED\_TEXT
- DV\_SCALE.symbol: DV\_CODED\_TEXT
- DV\_ORDERED.normal\_status: CODE\_PHRASE
- DV\_ABSOUTE\_QUANTITY.accuracy: DV\_AMOUNT
- DV\_TIME\_SPECIFICATION.value: DV\_PARSABLE
- DV\_MULTIMEDIA.uri: DV\_URI
- …

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [3 June 2022 12:44 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/5 "2022-06-03T12:44:00Z")

</div>

> [@pablo](#):
>
> I’m not sure if that argument could be sustained for not using DV\_TEXT/DV\_CODED\_TEXT elsewhere to formalize some fields that could be coded or could be just plain strings

Yes they are used in places with fixed types, but that was an error. Simpler types could be used, particularly [Terminology\_code](https://specifications.openehr.org/releases/BASE/latest/foundation_types.html#_terminology_code_class) and the Iso8601\_date / time types. This is what we have done in Task Planning.

Compare a `DV_CODED_TEXT` to `Terminology_code`:  
 ![dv_coded_text](https://discourse.openehr.org/uploads/default/original/2X/9/9b424ab12e45ecd24406e526608f28e4030fbfd5.png)

![Terminology_code](https://discourse.openehr.org/uploads/default/original/2X/c/c403dcbfa428a3e8ccafb1381b5cb4a624cb9d11.png)

And similarly `DV_DATE` to `Iso8601_date`:  
 ![dv_date](https://discourse.openehr.org/uploads/default/original/2X/a/a53504d1c3ec8b6d812d18aba2f3616589608fa0.png)

![iso8601_date](https://discourse.openehr.org/uploads/default/original/2X/a/a84b3924af6c36248b8d7378f8027faa54ff1021.png)

The DV\_ types could of course be more efficient, and an openEHRv2 approach might be something like what I [proposed for FHIR](https://wolandscat.net/2019/09/12/fhir-fixes-the-observation-value-problem/), except translated into openEHR types.

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [4 June 2022 20:42 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/6 "2022-06-04T20:42:48Z")

</div>

> [@thomas.beale](#):
>
> Yes they are used in places with fixed types, but that was an error. Simpler types could be used, particularly [Terminology\_code](https://specifications.openehr.org/releases/BASE/latest/foundation_types.html#_terminology_code_class) and the Iso8601\_date / time types.

Thanks @thomas.beale though architecturally I don’t understand why one approach is better than the other. What you mention “feels” (needs an in deep review) there is a need of having each of those types kind of duplicated as DV\_XXX and as foundation types. I don’t see a clear advantage of that approach.

I understand the foundation types could be simpler since the inheritance hierarchies are flatter and there are few attributes, but there is an overlapping between the DV\_XXX and the foundation type that serves the same purpose. Then, why not using the foundation type inside the DV\_XXX type to reduce the overlapping-duplication of fields and increase reusing those fields.

In your example, I would prefer something like DV\_CODED\_TEXT.coding: Terminology\_code and remove DV\_CODED\_TEXT.(hyperlink, defining\_code)

Similarly to the date/time/duration types, though there are other issues with that model, like mentioned form the ISO 8601 review, the RM representation could be independent from the exchange format, which is the purpose of the ISO standard (see point 15. on my initial message), so this might require a deeper refactoring.

In conclusion, I get what you say, and besides using foundation types for all RM attributes, as said I would also refactor the dava\_types model trying to reuse the foundation in the DVs too. Anyway, all this would certainly break the RM so it’s good to discuss for RM v2.

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [6 June 2022 08:34 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/7 "2022-06-06T08:34:12Z")

</div>

> [@pablo](#):
>
> Thanks @thomas.beale though architecturally I don’t understand why one approach is better than the other. What you mention “feels” (needs an in deep review) there is a need of having each of those types kind of duplicated as DV\_XXX and as foundation types. I don’t see a clear advantage of that approach.

I’ll answer properly later on, but here is a demonstration of what happens when there is no parent ‘Data value’ type of some kind - [you get this, common in FHIR](https://wolandscat.net/2019/09/12/fhir-fixes-the-observation-value-problem/).

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [6 June 2022 22:45 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/8 "2022-06-06T22:45:06Z")

</div>

> [@thomas.beale](#):
>
> > [@pablo](#):
> >
> > Thanks @thomas.beale though architecturally I don’t understand why one approach is better than the other. What you mention “feels” (needs an in deep review) there is a need of having each of those types kind of duplicated as DV\_XXX and as foundation types. I don’t see a clear advantage of that approach.
> 
> I’ll answer properly later on, but here is a demonstration of what happens when there is no parent ‘Data value’ type of some kind - [you get this, common in FHIR](https://wolandscat.net/2019/09/12/fhir-fixes-the-observation-value-problem/).

But I’m not proposing removing the parent or avoiding any hierarchy here, my comment is about preventing the duplication of attributes in different classes that play the same role in the RM, like `code_string` or `terminology_id`. I believe we are talking about different things.

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [7 June 2022 06:26 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/9 "2022-06-07T06:26:45Z")

</div>

That post indicates one way to achieve a set of primitive data types, as well as simple types like coded term, quantity etc, that can have a common parent. We don’t have this structure in openEHR. For data fields that have statically known types (Date, Coded term etc) it is attractive to use the simplest type available for the purpose. For polymorphic fields like ELEMENT.value representing values from the real world, we need something else - not just a parent type, but a clean way to distinguish measured / stated, and probably a few other things.

---

<div class="post-metadata">

**Author:** ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)\
**Post date:** [7 June 2022 07:19 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/10 "2022-06-07T07:19:47Z")

</div>

> [@pablo](#):
>
> the duplication of attributes in different classes that play the same role in the RM, like `code_string` or `terminology_id`. I believe we are talking about different things.

When I first started with openEHR I was confused by the duplicate datatypes like Terminology\_code and CODE\_PHRASE. I soon realized why they are needed. Before RM classes are generated from the RM specification files, they “don’t exist” and RM specification files use e.g. Terminology\_code.

- Foundation types in BASE are needed to specify RM.
- RM data types are used once the RM “comes into existence”.

At least this is how I interpret them 😊

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [7 June 2022 08:09 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/11 "2022-06-07T08:09:39Z")

</div>

> [@borut.jures](#):
>
> duplicate datatypes like Terminology\_code and CODE\_PHRASE

Indeed, if we had had `Terminology_code` back then, we would not have created `CODE_PHRASE`. `Terminology_code` is a good example of a data type that is of a better design than the original we created (i.e. `CODE_PHRASE`) - it is based on SNOMED experts’ analysis of how to point to a terminology concept code.

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [8 June 2022 02:49 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/12 "2022-06-08T02:49:18Z")

</div>

> [@thomas.beale](#):
>
> That post indicates one way to achieve a set of primitive data types, as well as simple types like coded term, quantity etc, that can have a common parent. We don’t have this structure in openEHR. For data fields that have statically known types (Date, Coded term etc) it is attractive to use the simplest type available for the purpose. For polymorphic fields like ELEMENT.value representing values from the real world, we need something else - not just a parent type, but a clean way to distinguish measured / stated, and probably a few other things.

Hi @thomas.beale I’m afraid there are still some bits here I don’t get. Are you implying inheritance shouldn’t be used at the foundation types? If yes, what purpose does it serve?

What I would try to reach for openEHR RM 2.0 is just to remove all duplicated attributes in similar types, and use the foundation types where needed in the RM, including in data\_types classes.

If that involves having some inheritance in the foundation types or not is something to determine, not sure why that should be avoided a priori.

Again, this is just an exercise, I didn’t think about how this should be modeled in a concrete UML, when I have some time I’ll do that to understand the scope and reach of this refactoring and I will share it here to discuss.

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [8 June 2022 07:09 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/13 "2022-06-08T07:09:31Z")

</div>

> [@pablo](#):
>
> Are you implying inheritance shouldn’t be used at the foundation types? If yes, what purpose does it serve

It generally won’t exist in the Foundation types as such, because they are usually built-in types of languages, and they will just inherit from Any or Object, but not from some Primitive type. So there is usually no type available to use in a place like ELEMENT.value. To construct one, an inheritance structure has to be created - in our case, with DATA\_VALUE as the parent - and with wrapper classes for the various primitives, plus more complex data value types like DV\_QUANTITY and so on.

But it would be helpful in some places, e.g. Subject Proxy, to have simpler types, even like Quantity, Terminology\_term that don’t assume much, and can be synthesised from openEHR, MPI systems, RDMBS sources, FHIR, HL7 v2 and so on.

All needs discussion of course.

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [9 June 2022 10:47 UTC](https://discourse.openehr.org/t/openehr-rm-v2-0-points-to-improve-simplify-the-openehr-reference-model/2664/14 "2022-06-09T10:47:39Z")

</div>

> [@thomas.beale](#):
>
> > [@pablo](#):
> >
> > Are you implying inheritance shouldn’t be used at the foundation types? If yes, what purpose does it serve
> 
> It generally won’t exist in the Foundation types as such, because they are usually built-in types of languages, and they will just inherit from Any or Object, but not from some Primitive type

Do you mean that foundation types do not have any inheritance more because of the concrete technology than for our decision to do so?

If that is the idea, I would say it might be true in some cases if we chose to use fairly basic types, though, for instance, a foundation `date` type in Java might be mapped to a class that certainly don’t inherit from Object/Any but from another class.

But I understand we don’t need to represent the full inheritance structure of the foundation types in our model. I would still like to make the exercise to refactor DVs + foundation to check if that holds true.

> [@thomas.beale](#):
>
> So there is usually no type available to use in a place like ELEMENT.value. To construct one, an inheritance structure has to be created - in our case, with DATA\_VALUE as the parent - and with wrapper classes for the various primitives, plus more complex data value types like DV\_QUANTITY and so on.

This is clear for me, never questioned that point. I don’t think ELEMENT.value should be something else than a DV. My point was to analyze the design of a refactored model which reuse foundation types inside DV types to avoid duplication of attributes in the RM, and remove unneeded types.
