# Archetype rules (invariants) in openEHR RM? **Category:** [Technical (archive)](https://discourse.openehr.org/c/technical-archive/156) **Created:** 2002-09-24 14:08 UTC **Views:** 19 **Replies:** 11 **URL:** https://discourse.openehr.org/t/archetype-rules-invariants-in-openehr-rm/14443 --- ## Post #1 by @Gavin_Brelstaff Hello all \- I'm new to the list, pls b kind\! My research group here in Italy is looking to combine an openEHR archetype\-based design with XUL/Mozilla/XML technology to produce a prototype electronic patient record system accessible via web clients of a certain degree of sophistication\. We've been happily designing archetypes using the DSTC Archetype Editor and we've been able to "compile" it's output into XUL front\-ends in an automated scheme that involves customised stylesheet amongst other things\. How do we generate "archetype rules" to provide constraints internally within archetypes\. We would like to use such rules to constrain data at it's point of entry on the client\. We already generate handler code \(in Javascript\) to ensure the data\-type and range constraints are valid\. I can find no mention of any "archetype rules" in the openEHR Reference Model nor in the "Design Principles" document\. In fact, all I can now find is the example of an invariant on page 25 of Thomas Beale's "Archetypes" report \(I've the version issued 21 /Aug/01\)\. Am I missing something obvious or have "archetype rules" been omitted, delayed from consideration? If so why? I do hope you can help\. --- ## Post #2 by @Andrew_Goodchild Hi Gavin, I am not entire sure what you mean by an archetype rule\. Are there any examples of these kinds of "rules" which you envisage the archetype encoding and your XUL UI checking? \-Andrew p\.s\. We tried going down the path you are working on at the moment, but we ended up wanting to support other browsers as well\. We finally ended up building a java program which uses a bundle of archetype definition to generate a Form for one or more archetypes \(with embeded javascript to check some basic constraints\) and a servlet which interpreted the form output and generted the raw XML \(note this feature is not in the current archetype editor\)\. The whole process is quite complicated and I am impressed that you have managed to wrap your head around it\. --- ## Post #3 by @thomas.beale Gavin Brelstaff wrote: > How do we generate "archetype rules" to provide constraints > internally within archetypes\. > We would like to use such rules to constrain data at it's point of > entry on the client\. We already generate handler code \(in Javascript\) > to ensure the data\-type and range constraints are valid\. > what we did in the Eiffel implementation of GEHR was: \- when an XML archetype is read from the database, it is turned into Eiffel objects\. \- for information creation, the archetype in memory has its create\_default\(\) routine called; this creates an initial data instance \(say of a blood pressure of whatever\)\. Each part of such an instance \(which is of course a network of instances\) is connected to a relevant part of the archetype \(also a network of instances in memory\) \- Data modification commences by the users on the data instances, with each routine which causes a change calling a a corresponding validating routine on the archetype\. If this routine returns true, the modification is allowed; else it returns false, with an error message whcih can be used on the screen \(e\.g\. "systolic blood pressue must be between 0 and 500\)\. \- Changes proceed in this fashion until the user is satisfied and hits the "commit" button, which writes the information to the db\. A detailed explanation of what happens is given at: http://www.gehr.org/technical/kernel_architecture/kernel_architecture.html \(see section 6 of the documents\)\. In openEHR, we will do the same thing \(in variaous languages \- not jsut Eiffel\) but it will be more systematic\. hope this helps, \- thomas beale --- ## Post #4 by @Zar_Zar_Tun I'm thinking he's talking about the openEHR Archetype Model document, which would specify the structure of an archetype, and how it constrains instances of the openEHR reference model\. If that's the case, Gavin, this document is still a work in progress, which is why it's not on the web\. The DSTC archetype editor generates archetypes that conform to the GEHR archetype model, which is an older version\. I hope this helps\. \-zar --- ## Post #5 by @Dario_Liberman Hello\! Nice site redesign you have got at openEHR\.org :\-\) I have taken a look at the Demographic R\.M\. 1\.2 I was wondering if it a Party may be also a team or group of people\. For example: Lets say that a clinician working at a given institution wants to prescribe the patient to have an interview with the group\-Nuero\-5 \( one of the groups of neurologists that analyze the need of internment\), he may have a kind of contact search engine in which he finds parties, in this case not a person or organization but a group of people called 'group\-Neuro\-5'\. If not, how does this example fit into the picture? Thanks, Dario Liberman\. liberman@ineba\.net --- ## Post #6 by @thomas.beale Dario Liberman wrote: > Hello\! > > Nice site redesign you have got at openEHR\.org :\-\) > > I have taken a look at the Demographic R\.M\. 1\.2 > I was wondering if it a Party may be also a team or group of people\. > currently a PARTY can be an ACTOR \- viz PERSON, ORGANISATION, or AGENT, or else it is a ROLE\. I have thought a little bit about teams etc, but have not investigated the use cases\. In mosts cases medico\-legally it is required that an individual be identified in any health activity\. This demographic model is in its early stages, and we expect that it will need some changes to allow for a general typology of PARTYs\. > For example: > Lets say that a clinician working at a given institution wants to prescribe > the patient to have an interview with the group\-Nuero\-5 \( one of the groups > of neurologists that analyze the need of internment\), he may have a kind of > contact search engine in which he finds parties, in this case not a person > or organization but a group of people called 'group\-Neuro\-5'\. > > If not, how does this example fit into the picture? > Hm \- currently in all the situations we know of \(e\.g\. Australia, sitautions in Europe to my knowledge, north america\) \- the identified party would have to be a registered provider \- either they are a GP or else it is an organisation such as a clinic or hospital\. How do you see a "group" of neurologists which is not a provider organisation \- can you describe what its status in the health system is in more detail? \- thomas beale --- ## Post #7 by @Ahmad_Risk Thomas asked: > Hm \- currently in all the situations we know of \(e\.g\. Australia, > sitautions in Europe to my knowledge, north america\) \- the identified > party would have to be a registered provider \- either they > are a GP or > else it is an organisation such as a clinic or hospital\. How > do you see a "group" of neurologists which is not a provider > organisation \- > can you describe what its status in the health system is in > more detail? Please let me enetr this dialogue\. In the UK, a GP might refer a patient to a named "Cardiologist"\. However, that referral, upon arrival at the hospital, might be handled by the "Cardiology Team" of that cardiologist\. One might argue here that the 'team' is really a department, albeit, a unit within the "Cardiology department"\. Equally, the referral from the originating GP could be directed at the "cardilogy department" without specifying the named provider\. Ahmad Risk http://cybermedic.org --- ## Post #8 by @thomas.beale Ahmad Risk wrote: > Please let me enetr this dialogue\. In the UK, a GP might refer a > patient to a named "Cardiologist"\. However, that referral, upon arrival > at the hospital, might be handled by the "Cardiology Team" of that > cardiologist\. One might argue here that the 'team' is really a > department, albeit, a unit within the "Cardiology department"\. > > Equally, the referral from the originating GP could be directed at the > "cardilogy department" without specifying the named provider\. > there are two questions here: a\) who is delivering the care \- in this case, it seems to be the team\. b\) who is legally responsible for the care, which as far as I know, must always be an individual, or a registered health care provider\. Both of these potentially need to be recorded\. If we want to identify teams or departments, we may need a new kind of party, or else we generalise the notion of ORGANISATION to something like GROUP, where a group just means more than 1 person with a common purpose \- or something in common \- what would it be, in general? thoughts? \- thomas beale --- ## Post #9 by @Dario_Liberman Thank you for your prompt response\! The idea of this group, is that it is internal to the institution\. Legally, I presume, the responsibility is of the chief directorship of the institution, and not the team\. But internally, you may need a way to identify a group of people acting as one whole entity\. And I still have not thought well about the cases, but it may not only be an administrative requirement, but the inability to represent groups of people in the system may also impact in future data\-mining researches if it is worked around with an ad\-hoc solution \(like performance of a treatment in relation to the size of the group, or even overall experience of it as the sum of each individual 's years of experience / educational level, configurations of groups, etc\) Perhaps I am missing the concept of Party that you propose, or at least making a too broad generalization of use\. Regards, Dario\. --- ## Post #10 by @Sam Tom I think work Unit or Work Group is important as long as it is linked to an organisation \- a person might work on a ward, an outpatient department and in the cardiology team\. As far as the referral is concerned \- it could be to a work unit if that is available and has a system for dealing with referrals\. Clearly an institution would limit the parties that will accept referrals\. Cheers, Sam --- ## Post #11 by @Dario_Liberman Well, In this case, I recommend to add a kind of actor, that may be de aggregation of other actors\. The administrator may decide which capabilities or roles this new actor may have, since it doesn't necessarily need to have anything in common with the aggregation of the capabilities of each of the actors it aggregates\. Best regards, Dario\. --- ## Post #12 by @thomas.beale Dario Liberman wrote: > Well, > > In this case, I recommend to add a kind of actor, that may be de aggregation > of other actors\. The administrator may decide which capabilities or roles > this new actor may have, since it doesn't necessarily need to have anything > in common with the aggregation of the capabilities of each of the actors it > aggregates\. > I have added this to a list of change requests, but there is more thinking to be done \- we may need to differentiate between workgroups which exist in and of themselves, e\.g\. cardiology team \(?\), versus groups which are formed around a patient, e\.g\. a "diabetic care team", which is a particualr grouping of people likely to exist only for a particular patient \(i\.e\. they are not constituted as any formal team\)\. Would the latter be identified as a group? Where? We have the concept of PARTY, ACTOR etc in the demographic model for things which exist regardless of context, and PARTICIPATION for context\-specific participations of PARTYs in activities around the patient\. \- thomas beale --- **Canonical:** https://discourse.openehr.org/t/archetype-rules-invariants-in-openehr-rm/14443 **Original content:** https://discourse.openehr.org/t/archetype-rules-invariants-in-openehr-rm/14443