# Postulate: DV\_QUANTITY should be modelled with fewest possible units

**URL:** <https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327>\
**Category:** Clinical (archive)\
**Created:** [13 November 2014 20:07 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327 "2014-11-13T20:07:00Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [14 November 2014 12:12 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/21 "2014-11-14T12:12:55Z")

</div>

I guess smart querying services would do the work. But should it also be possible for the client to say when unit conversion should be used and when not?

Use case is when user only want the units stored as grams, and not kilos.

Maybe a pattern from HTTP could be used. The accept pattern.

Accept: profile (metrics, british imperial)  
Accept: gram, kilos

Of course all this add complexity and we must be sure that we really need it.

Vennlig hilsen  
Bjørn Næss  
Produktansvarlig  
DIPS ASA

Mobil +47 93 43 29 10

---

<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:** [14 November 2014 12:32 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/22 "2014-11-14T12:32:10Z")

</div>

I think we could add something at reference model level to say give me  
this quantity in 'x' units, performing the conversion at server level  
where possible or return null. This could also be supported in AQL  
since it would just be another RM attribute/function?

Ian  
Dr Ian McNicoll  
mobile +44 (0)775 209 7859  
office +44 (0)1536 414994  
skype: ianmcnicoll  
email: ian@freshehr.com  
twitter: @ianmcnicoll

Director, freshEHR Clinical Informatics  
Director, openEHR Foundation  
Director, HANDIHealth CIC  
Hon. Senior Research Associate, CHIME, UCL

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [14 November 2014 13:32 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/23 "2014-11-14T13:32:39Z")

</div>

Again, I strongly believe we can achieve this with  
Assertions/pseudo-OCL that currently can be defined in archetypes.  
For example: "if 'units' from atNNNN are 'kg' then  
'value'='value'\*1000 and 'units'=g"

I think Thomas told me there were some improvements in the archetype  
assertions section/syntax.

---

<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:** [14 November 2014 13:47 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/24 "2014-11-14T13:47:33Z")

</div>

we could do this; it would be replicating the applicable rules from the UCUM conversion engine. Writing such rules is certainly doable - it could even be done by an authoring tool that talks to the UCUM service and gets the info it needs to construct the rule.

I don't know if this is a good idea or not at this stage.

- thomas

---

<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:** [14 November 2014 13:55 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/25 "2014-11-14T13:55:56Z")

</div>

Hi Diego,

I am sure that could be done but it would mean replicating these kind  
of statements in every archetype that had multiple units. This really  
feels like something that should be handled computationally at RM  
level- it is universal and a property of the units not of the  
archetype.

Ian  
Dr Ian McNicoll  
office +44 (0)1536 414 994  
fax +44 (0)1536 516317  
mobile +44 (0)775 209 7859  
skype ianmcnicoll  
ian.mcnicoll@oceaninformatics.com

Clinical Modelling Consultant, Ocean Informatics, UK  
Director openEHR Foundation www.openehr.org/knowledge  
Honorary Senior Research Associate, CHIME, UCL  
SCIMP Working Group, NHS Scotland  
BCS Primary Health Care www.phcsg.org

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [14 November 2014 14:26 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/26 "2014-11-14T14:26:44Z")

</div>

Well, I assume that this also works for specialized archetypes, I  
don't see why it shouldn't. Declare rules in parent archetype and you  
don't need to declare them anywhere else.

---

<div class="post-metadata">

**Author:** ![heather.leslie](https://discourse.openehr.org/user_avatar/discourse.openehr.org/heather.leslie/32/1980_2.png) [@heather.leslie](https://discourse.openehr.org/u/heather.leslie)\
**Post date:** [15 November 2014 05:03 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/27 "2014-11-15T05:03:29Z")

</div>

Bjørn, Thomas

You could potentially create a template for each archetype with this unit issue, if you like, and govern it in the Norwegian CKM. That artefact can then be published as the ‘approved’ Norwegian version of the international archetype.

Templates of a single archetype are effectively a profile. We use this in Ocean’s implementations where we want consistent archetype constraints used across multiple document templates.

Templates can then be used in other templates and these Norwegian-specific constraints could be used consistently across templates within a single clinical system and also across multiple clinical systems.

The only remaining issue would be to indicate that the template is the preferred modelling artefact – not sure how we do that other than notification in CKM. It would not be apparent to modellers deep in the tools, and predominantly working with archetypes. Not sure how we could do that… L

Regards

Heater

---

<div class="post-metadata">

**Author:** ![Koray\_Atalag](https://discourse.openehr.org/user_avatar/discourse.openehr.org/koray_atalag/32/70_2.png) [@Koray\_Atalag](https://discourse.openehr.org/u/Koray_Atalag)\
**Post date:** [15 November 2014 06:10 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/28 "2014-11-15T06:10:27Z")

</div>

Tom, I think profiling would add unnecessary complexity and would backup Heather and Ian's comments.  
That sounds more like FHIR thing than openEHR! We already have a well defined mechanism to specify local constraints at template and also Choice type constructs (my inside voice warning hey you are talking to Tom who knows this way better than I do!). I'm really confused that you have raised this idea...

Cheers,

-koray

---

<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:** [15 November 2014 09:42 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/29 "2014-11-15T09:42:33Z")

</div>

Hi Heather,

I agree with that approach. I would actually regard this as a kind  
specialised archetype, just using template technology.

One of the advantages of moving to ADL1.5/2.0 is that it is is  
possible to do this kind of profiling as a specialised archetype not  
just within a template. In fact templates and archetypes are  
technically identical.

You do raise an interesting point about how/if we flag that the parent  
archetype itself should not normally be used.

Ian  
Dr Ian McNicoll  
mobile +44 (0)775 209 7859  
office +44 (0)1536 414994  
skype: ianmcnicoll  
email: ian@freshehr.com  
twitter: @ianmcnicoll

Director, freshEHR Clinical Informatics  
Director, openEHR Foundation  
Director, HANDIHealth CIC  
Hon. Senior Research Associate, CHIME, UCL

---

<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:** [15 November 2014 09:57 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/30 "2014-11-15T09:57:17Z")

</div>

It's a straw man idea. Just for purposes of discussion. Any serious ideas I have are in the ADL 2 spec 😉

- thomas

---

<div class="post-metadata">

**Author:** ![Karsten\_Hilbert](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/k/e56c9b/32.png) [@Karsten\_Hilbert](https://discourse.openehr.org/u/Karsten_Hilbert)\
**Post date:** [16 November 2014 11:02 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/31 "2014-11-16T11:02:00Z")

</div>

Uhm, yeah, well, no.

There are "units" in use which only apply in context -- their  
"conversion" would require knowing, say, the substance measured.

And that's only those that actually \_make\_ any computational sense.

Karsten

---

<div class="post-metadata">

**Author:** ![Karsten\_Hilbert](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/k/e56c9b/32.png) [@Karsten\_Hilbert](https://discourse.openehr.org/u/Karsten_Hilbert)\
**Post date:** [16 November 2014 11:12 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/32 "2014-11-16T11:12:53Z")

</div>

think mg/dl \<-\> mmol/l

Karsten Hilbert

---

<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:** [17 November 2014 07:42 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/33 "2014-11-17T07:42:29Z")

</div>

Hi Karsten,

I agree, this will not always be possible but where the conversion can  
be safely done, I would still argue that this should be done at RM  
level and not per-archetype.

Ian

Dr Ian McNicoll  
mobile +44 (0)775 209 7859  
office +44 (0)1536 414994  
skype: ianmcnicoll  
email: ian@freshehr.com  
twitter: @ianmcnicoll

Director, freshEHR Clinical Informatics  
Director, openEHR Foundation  
Director, HANDIHealth CIC  
Hon. Senior Research Associate, CHIME, UCL

---

<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:** [17 November 2014 12:13 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/34 "2014-11-17T12:13:21Z")

</div>

Hi Ian,

I'm not sure what you mean by "doing this at the RM level". Can you elaborate?

- thomas

---

<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:** [17 November 2014 12:47 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/35 "2014-11-17T12:47:57Z")

</div>

Hi Thomas,

RM function to retrieve a magnitude expressed as a particular unit.

I think we could add something at reference model level to say give me  
this quantity in 'x' units, performing the conversion at server level  
where possible or return null. This could also be supported in AQL  
since it would just be another RM attribute/function?

magnitude.inUnit['mg']

I think this is, roughly speaking, what FHIR is doing

Ian  
Dr Ian McNicoll  
office +44 (0)1536 414 994  
fax +44 (0)1536 516317  
mobile +44 (0)775 209 7859  
skype ianmcnicoll  
ian.mcnicoll@oceaninformatics.com

Clinical Modelling Consultant, Ocean Informatics, UK  
Director openEHR Foundation www.openehr.org/knowledge  
Honorary Senior Research Associate, CHIME, UCL  
SCIMP Working Group, NHS Scotland  
BCS Primary Health Care www.phcsg.org

---

<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:** [17 November 2014 13:36 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/36 "2014-11-17T13:36:26Z")

</div>

well, it's not a reference model thing inasmuch as it's not an information model concept at all, but a knowledge service concept, relying on some database of units that knows about canonical forms, conversions etc. This is what things like the UCUM service do, via an API. I wouldn't want to make the RM dependent on specific functions of such an API; I think the most that the RM should assume (as it does right now in fact) is that the units are in UCUM syntax.

- thomas

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [17 November 2014 16:00 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/37 "2014-11-17T16:00:30Z")

</div>

Dear all,

Magnitude is not the same as Units of Measurement.  
Units of Measurement are not the same as Magnitude.

Gerard

Gerard Freriks  
+31 620347088  
[gfrer@luna.nl](mailto:gfrer@luna.nl)

---

<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:** [17 November 2014 16:16 UTC](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327/38 "2014-11-17T16:16:26Z")

</div>

Hi Gerard,

Agreed - the dummy function call says "give me the magnitude in ‘xx’  
Units of measure, performing any conversions necessary”.

Ian

Dr Ian McNicoll  
office +44 (0)1536 414 994  
fax +44 (0)1536 516317  
mobile +44 (0)775 209 7859  
skype ianmcnicoll  
ian.mcnicoll@oceaninformatics.com

Clinical Modelling Consultant, Ocean Informatics, UK  
Director openEHR Foundation www.openehr.org/knowledge  
Honorary Senior Research Associate, CHIME, UCL  
SCIMP Working Group, NHS Scotland  
BCS Primary Health Care www.phcsg.org

[Previous page](https://discourse.openehr.org/t/postulate-dv-quantity-should-be-modelled-with-fewest-possible-units/15327.md?page=1)
