proposed quantity package changes

I have uploaded a set of changes to the Quantity package that simplify the existing classes while not changing any of their data; see - http://svn.openehr.org/specification/BRANCHES/Release-1.1-candidate/publishing/architecture/rm/data_types_im.pdf

This is the kind of thing I have been contemplating for some time. It properly distinguishes between date/time/datetime and other kinds of quantities. Date/times are not ‘amounts’, so the + and - operators are not defined. On an ‘amount’, stuff + more stuff = stuff and stuff - some stuff = less stuff. No matter what you do, you only have one type of stuff - like a lump of clay that you pull apart and stick together. Date/times on the other hand (but not durations) are ‘offsets’ from an origin, and + and - don’t make sense (you can’t add two dates, two times, or two date/times; you can subtract them, but you don’t end up with the same kind, you get a duration).

So the changes are the following:

  • add the class DV_RELATIVE_QUANTITY to model relative amounts (most quantities)

  • add the class DV_ABSOLUTE_QUANTITY to model amounts that a absolute points on a line with an origin (date/times, but not Duration)

  • collapse DV_MEASURED and DV_QUANTITY

  • remove DV_QUANTITIED.diff_type (this simplifies the implementation of the date/time types)

  • remove DV_CUSTOMARY_QUANTITY (this type was originally designed to handle customary quantities like stone/lb/oz, yard/foot/inch etc etc; it is still a sensible inclusion in the model, except that we have never needed to use it for this purpose. We also historically modelled time as a subtype due to y/m/d and h/m/s - which are in fact customary unit systems - but as it turns out, date/times are not real ‘amounts’ anyway, and I don’t know if modelling them as customary quantities is that useful)
    that’s it. The semantics of DV_QUANTITY, DV_COUNT, DV_PROPORTION and all the DATE/TIME types remain the same, except for no diff_type and annoying implementations of + and -

Reactions? Rong has already said he doesn’t like the names DV_RELATIVE_QUANTITY and DV_ABSOLUTE_QUANTITY as they are ambiguous; I am inclined to agree. Other names could be:

  • DV_RELATIVE_QUANTITY → DV_AMOUNT

  • DV_ABSOLUTE_QUANTITY → DV_OFFSET

  • thomas

Some problems with accuracy in the date/time types are now fixed, and the specification is further simplied.

  • thomas

Thomas Beale wrote:

Tom

This is great work and I think will be a very important candidate set for the ISO health data types. They are clean and well tested…some work to do but very simple to implement.

Well done, Sam

Thomas Beale wrote: