# Msg#4 - Software Archetypes - single vs double systems

**URL:** https://discourse.openehr.org/t/msg-4-software-archetypes-single-vs-double-systems/14133
**Category:** Technical (archive)
**Created:** [10 April 2006 17:51 UTC](https://discourse.openehr.org/t/msg-4-software-archetypes-single-vs-double-systems/14133 "2006-04-10T17:51:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bill\_Walton](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Bill\_Walton](https://discourse.openehr.org/u/Bill_Walton)
#### Post date: [10 April 2006 17:51 UTC](https://discourse.openehr.org/t/msg-4-software-archetypes-single-vs-double-systems/14133/1 "2006-04-10T17:51:38Z")

</div>

systems

> What I find most frustrating about discussion of archetypes is that it  
> is so often vague and intuitive in nature, making it rather hard to  
> decipher.
> 
> \> Software Archetypes - single vs double systemsHi Lorie,  
> \>  
> \> Archetypes provide a capability that's very familiar to programmers,  
> \> but take it to the next level. At the most basic level, it's about  
> \> decoupling. An RDBMS shields programs from the need to know about  
> \> the underlying structure of the data. A program needs only know  
> \> about the db schema. Views provide another level of abstraction,  
> \> shielding programs from changes in the schema. Archetypes (which I  
> \> believe do not depend on an RDBMS implementation) provide a similar  
> \> capability, but take it to the domain level.
> 
> By domain do you mean application domain? Or are you referring to  
> domains in their technical sense in database theory (as a set of  
> values)? At any rate, it is clear that you are trying to abstract away  
> from a particular set of units, treating the quantity itself as a value  
> (not how it might be represented).
> 
> \>  
> \> When working with an archetype-enabled system, programs / programmers  
> \> work directly with domain concepts like blood pressure or height or  
> \> weight. The underlying data is stored / accessed through the  
> \> archetype.
> 
> But what does this mean? It suggests that an archetype is realizable as  
> a computational object (much as a schema may be realized as a set of  
> relations, or a class instantiated to form an object). I suspect that  
> this is the point at which an important concept is missing: The  
> integers are a ring, but when I add two numbers, I'm not using the +  
> operation of the category Ring, but rather of a specific member of that  
> category, namely Z.
> 
> \> A trivial example of the benefits would be lbs. vs. kgs..  
> \> In an archetype-enabled system, the program has no knowledge of the  
> \> unit-of-weight measure used to store the data. Programs access the  
> \> data store with statements like (no representation made re: syntax)  
> \> store\_weight(220, lbs) and patient\_weight =  
> \> retrieve\_weight(patient\_id, kgs).
> 
> Okay, here is some concrete syntax, but what are you really doing? Is  
> kgs a flag or map (or something else altogether)? From a mathematical  
> point of view, it's natural to think of it as a scaling transformation  
> (a map). But that's confusing, too, because it implies the existence  
> of some reference instance out there (say kilograms) that is somehow  
> privileged among other possible choices, and that your kgs flag is  
> simply the scaling factor (isomorphism) you need to apply to get your  
> chosen representation.  
> \>  
> \> You might want to take a look at  
> \> [http://oceaninformatics.biz/archetypes/MindMap/ArchetypeMap.html](http://oceaninformatics.biz/archetypes/MindMap/ArchetypeMap.html) for  
> \> a better, high-level understanding of the above. This, and a good  
> \> deal of the related stuff, will be migrated shortly to the openEHR  
> \> site.  
> \>  
> \> Be happy to provide / get you more in-depth info if desired.  
> \>  
> \> hth,  
> \>
> 
> ===  
> Gregory Woodhouse \<gregory.woodhouse@sbcglobal.net\>
> 
> "It is foolish to answer a question that  
> you do not understand."  
> --G. Polya ("How to Solve It")
> 
> -------------------------------------------------------  
> This SF.Net email is sponsored by xPML, a groundbreaking scripting

language

> that extends applications into web and mobile media. Attend the live

webcast

> and join the prime developer group breaking into this new coding

territory!

---

<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: [11 April 2006 17:08 UTC](https://discourse.openehr.org/t/msg-4-software-archetypes-single-vs-double-systems/14133/2 "2006-04-11T17:08:21Z")

</div>

Some answers that may or may not be useful for the hardhats.

Bill Walton wrote:

> From: "Greg Woodhouse" \<gregory.woodhouse@sbcglobal.net\>  
> To: \<hardhats-members@lists.sourceforge.net\>  
> Sent: 2006-04-10 10:46 AM  
> Subject: Re: [Hardhats-members] Software Archetypes - single vs double  
> systems
> 
> > What I find most frustrating about discussion of archetypes is that it  
> > is so often vague and intuitive in nature, making it rather hard to  
> > decipher.
> > 
> > > Software Archetypes - single vs double systemsHi Lorie,
> > > 
> > > Archetypes provide a capability that's very familiar to programmers,  
> > > but take it to the next level. At the most basic level, it's about  
> > > decoupling. An RDBMS shields programs from the need to know about  
> > > the underlying structure of the data. A program needs only know  
> > > about the db schema. Views provide another level of abstraction,  
> > > shielding programs from changes in the schema. Archetypes (which I  
> > > believe do not depend on an RDBMS implementation) provide a similar  
> > > capability, but take it to the domain level.  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > 
> > By domain do you mean application domain? Or are you referring to  
> > domains in their technical sense in database theory (as a set of  
> > values)?

application domain. It means you can consider an archetype as a model of some domain concept, like "microbiology test result", that a health care professional can understand (and define).

> > At any rate, it is clear that you are trying to abstract away  
> > from a particular set of units, treating the quantity itself as a value  
> > (not how it might be represented).
> > 
> > > When working with an archetype-enabled system, programs / programmers  
> > > work directly with domain concepts like blood pressure or height or  
> > > weight. The underlying data is stored / accessed through the  
> > > archetype.  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > 
> > But what does this mean? It suggests that an archetype is realizable as  
> > a computational object (much as a schema may be realized as a set of  
> > &nbsp;&nbsp;&nbsp;&nbsp;

it is. The model of all archetypes is given at [http://svn.openehr.org/specification/TRUNK/publishing/architecture/am/aom.pdf](http://svn.openehr.org/specification/TRUNK/publishing/architecture/am/aom.pdf)  
or if you want online UML, see [http://www.openehr.org/uml/Browsable/\_9\_0\_76d0249\_1108467924943\_474004\_589Report.html](http://www.openehr.org/uml/Browsable/_9_0_76d0249_1108467924943_474004_589Report.html)

> > relations, or a class instantiated to form an object). I suspect that  
> > this is the point at which an important concept is missing: The  
> > integers are a ring, but when I add two numbers, I'm not using the +  
> > operation of the category Ring, but rather of a specific member of that  
> > category, namely Z.
> > 
> > > A trivial example of the benefits would be lbs. vs. kgs..  
> > > In an archetype-enabled system, the program has no knowledge of the  
> > > unit-of-weight measure used to store the data. Programs access the  
> > > data store with statements like (no representation made re: syntax)  
> > > store\_weight(220, lbs) and patient\_weight =  
> > > retrieve\_weight(patient\_id, kgs).  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > 
> > Okay, here is some concrete syntax, but what are you really doing? Is  
> > kgs a flag or map (or something else altogether)? From a mathematical  
> > point of view, it's natural to think of it as a scaling transformation  
> > (a map). But that's confusing, too, because it implies the existence  
> > of some reference instance out there (say kilograms) that is somehow  
> > privileged among other possible choices, and that your kgs flag is  
> > simply the scaling factor (isomorphism) you need to apply to get your  
> > chosen representation.  
> > &nbsp;&nbsp;&nbsp;&nbsp;

it is not that complicated. The archetype simply constrains a QUANTITY object which is defined by a QUANTITY class. The openEHR model of this class is here: [http://www.openehr.org/uml/Browsable/\_9\_0\_76d0249\_1109599337877\_94556\_1510Report.html](http://www.openehr.org/uml/Browsable/_9_0_76d0249_1109599337877_94556_1510Report.html)

There is a custom C\_QUANTITY constrainer class that can be used as well, which is particularly suitable for constraining values in multiple unit systems.  
See this test archetype: [http://my.openehr.org/wsvn/knowledge/archetypes/dev/adl/test/clinical\_types/adl-test-entry.c\_quantity.draft.html?op=file&rev=0&sc=0](http://my.openehr.org/wsvn/knowledge/archetypes/dev/adl/test/clinical_types/adl-test-entry.c_quantity.draft.html?op=file&rev=0&sc=0)  
That's raw ADL of course; in the clinician's archetype editor it is done via a GUI.

- thomas beale
