Monthly Archives: September 2011

Speaking in RIM grammar

On Thursday and Friday this week, I held a a two day course teaching how to map from Australian v2 messages to Australian CDA documents. My course went a lot further than Keith’s excellent chapter in his CDA book on the subject, because the mappings were made in the presence of both v2 and CDA implementation guides (Australian Standards and NEHTA specifications). As part of the course, I tried to teach the attendees how to speak in RIM grammar – you need to, in order to map miscellaneous v2 concepts- there’s a lot of them – into the clinical statement pattern. Obviously there’s a lot of prior art about -the NEHTA specifications and more widely, the combined IHE/HL7 implementation guides and most of all the consolidated health story Implementation Guide – but it’s common to encounter data concepts that simply haven’t been mapped to any clinical statement pattern, let alone the simple one in CDA.

So here’s a quick and simple way to learn to speak things in the RIM grammar.

Step #1: Basic Grammar

The basic grammar of the RIM is Act-Participation-Role-Entity. Learning how to speak this language is as easy is filling in the following sentences:

  • Act: “[W] is something that happens or could happen”
  • Participation: “[Y] is the [X] in [W]”
  • Role: “[Z] is capable of being a [Y]”
  • Entity: “[Z] is something that actually exists at least for a while” (i.e. doesn’t exist as a record)


  • W is a display name from the ActClass heirarchy
  • X is a display name from the ParticipationType heirarchy
  • Y is a display name from the RoleClass heirarchy
  • Z is a display name from the EntityClass heirachy

It’s simply a case of looking through those code systems and picking a code. Here’s an example:

  • E: “[person] is something that exists at least for a while”
  • R: “[person] is capable of being a [patient]”
  • A: “[encounter] is something that happens or could happen”
  • P: “[patient] is the [subject] in [encounter]”

Except that this isn’t simple. There’s a few complicating factors

  • put like this, it’s not clear how the act code, role code, and entity code interact with the class codes – this makes it hard to know quite what kind of term of you’re looking for in the act heirarchy particularly
  • Also, verbs and nouns have nothing to do with acts or not, and somethings that look like entities (Documents, Accounts) are actually acts
  • it’s hard to pick the right role code – the role code hierarchy is a mess
  • RIM classCodes and RIM classes are interlaced (the actual RIM class hierarchy doesn’t match the actual RIM class hierarchy)

The only way to work your way through these is practice, with a v3 specialist to help.

Step #2: Mood Codes

The second step is to pick the right mood code. This is easy:

  • Intent: “[W] is something that we intend to make happen”
  • Appointment: “[W] is something that is expected to happen at a set time”
  • Appointment Request: “Please give us a time for [W] to happen”
  • Promise: “[W] is promised to happen” (or I promise to do [W])
  • Proposal: “It would be good if [W] happens”
  • Request: “I would like it if [W] happens” (or “Please do [W]”)
  • Definition:    “This is what [W] looks like if/when it happens”
  • Event:“[W] is something that happened”
  • Criterion: “If [W] happens”
  • Goal: “Getting [W] to happen is our goal”

Step #3: Act Relationships

This sentence is easy:

  • “[source act sentence ]” [V] “[target act sentence]”
where V is a displayName taken from ActRelationship type.


That’s enough – you could go on and define RoleLink, and playing and scoping entity, but by the time people have mastered these, they’ve got the principles. It’s useful to understand the methodology, but you always have to consult prior art:
  • Domain Models
  • CDA Implementation Guides
  • National Program specifications (if you can get them)
It also helps to have a v3/RIM specialist on hand. Even then, you can still get confusion and contention about the “right way” to represent a notion using RIM grammar – because like all good grammars, it’s ambiguous. There’s a confusion here -the idea of the RIM isn’t to create a meaningful ontology that you can reason with, nor to offer useful leveragable logical grammar for implementors – it’s a tool to ensure consistent model definitions (and it addresses only some of those issues). That’s why, in RFH, we’re keeping the this whole RIM grammar away from the resource models, in the background where it’s exercised by RIM specialists to ensure the models are robust.

Question: how to code a prescription with “PRN”?

Question: I have a question about coding “prn” under a substanceAdministration class in CDA structure.  First, what coding system I should use to code it? Second, where should I put it? Frequency or indication of reason for
taking the medication? If it should be interpreted as a type of frequency, how can I do it?
I asked Lloyd McKenzie for an answer to this one (thanks Lloyd):
Actually, you use neither of those.  “PRN”, which translates to “as needed” is placing a precondition on the administration.  So “Administer this when x”.  Sometimes the statement is just PRN (as needed).  Sometimes it’s something like “PRN pain” (as needed for pain).
So you use the precondition relationship.  If you don’t have a specific condition, you can leave the non-mandatory attributes in the Criterion class empty.  If you have a specific condition, then you can use the code or text attributes to describe it.
Usually with PRN medications you’ll also want to specify maxDoseQuantity to indicate the maximum dose per period of time.  And you may choose to specify frequency as well.  E.g. “1 tablet every 2-4 hours PRN”

Question: Illegal symbols in my CDA?

Question: I have an xml file that gets sent to a cda.xsl in order for it to print out nicely via a web browser. The problem is that I am getting symbols like &188 (hex-BC)and &189 (hex-BD) and &190 (hex-BE) which represent fractions 1/4, 1/2, 3/4 is there a way to define this so that the browser doesn’t choke on the xml file that is created from the EMR system?

You don’t say where you are getting the symbols from – but it sounds like from some stream of non-unicode text. I’d guess you’re getting content in the 8859/1. And then you’re creating an XML file for the CDA using a non-unicode aware production method, and either defaulting the character encoding or setting it to utf-8, and it isn’t.

You can resolve this by explicitly converting the content to unicode in your application, or by setting the character encoding to the correct value in the output XML document. Either way, you will have to figure out the correct character set of your input. Note that if your input is v2 messages, the actual character set is very frequently different to the specified character set.


Where can I get good introductory resources for Healthcare Standards

I am very new to the healthcare / IT and standards, but since I have changed jobs recently, now have to grasp what’s going on in terms of interoperability of healthcare systems within a rather short period of time. HL7, IHE websites are overstuffed with terminology incomprehensible for me. It left me wondering – do resources like “Healthcare interoperability for dummies” exist? Any advise (links to resources, training seminars, books, etc) on how to start digging into the field would be very appreciated, thanks!

Well, the best place to look  for good material like this is books. Here’s my recommendation list. I was going to add one of my own, but I can see that’s never going to happen – hence the blog.

In addition to my blog which contains some information (see the roadmap, particularly the section on interoperability basics), Keith Boone covers the ground well. The problem with blogs is that they’re pretty scattered  – that’s their nature.

I feel as though there should be more good resources out there, but I don’t know of them. Further suggestions are welcome in the comments.

Question: ED.integrityCheck

Question: When using the ED datatype with a reference to an external file (e.g. an image), does the integrityCheck attribute contain a secure hash of

a) the XML content of the ED (i.e. just the reference)


b) the external file being referenced


The integrity is the has value of the target of the reference – the external file being referenced.


RFH: Outcomes from San Diego meeting

Previously, on this blog, I proposed an idea for consideration by the fresh look task force: “Resources For Healthcare“. The proposal was widely discussed here at the San Diego meeting, and many people have asked me for a report on how the discussions went. This is the report.

Firstly, RFH was very well received. Very well received. Most of the RFH sessions were packed, and one session had people crowded out the door. There’s a real appetite in HL7 for change, and while there were many questions and open concerns – see below – very few people were unhappy with the intent or general shape of RFH. In fact, given the RFH was just an idea, with heaps of parts not done, I kind of feel as though I proposed an aeroplane, laid out the seats, marked the cockpit and wings with some rope, and then, when I looked back, the seats were full of people wanting to know when the plane takes off.

In fact, several projects are already considering using the data types portion of RFH. Comments on the data types are welcome here.

In fact, the fresh look taskforce decided that there was no need for the fresh look task force to be involved in RFH: it’s migrated straight into committee business. Modeling and Methodology will create and sponsor an official project to develop RFH towards adopting it as official methodology. Of course, that can only happen if lots of open issues can be resolved.

In addition to thoroughly considering the differences between RFH and existing HL7 methodology, the following issues were discussed at length:

  • In it’s current form, RFH appears to mandate that REST is to be used. It needs to be rewritten to make it obvious that REST (http) is not required, but is optional – and often not even relevant
  • There was discussion about how RFH relates to HData. RFH offers contents for hData (or HData is a record aggregation profile for RFH resources).
  • hData is also REST based – I will work with Gerald (hdata author) to see if both hdata and RFH can use the same transport (i.e. http) spec
  • RFH proposes a new model for extensibility; this offers real advantages but raises a new issue about how this is best governed in order to balance between the requirements of various implementation concerns and scopes
  • There was much discussion about how RFH will resolve the tension within HL7 around complexity, and allowing people to do what they want without making it too complex for everyone
  • RFH needs to align better with classic RESTful documentation styles
  • There was contention around how RFH resources are aggregated (very technical), and the importance of maintaining resource boundaries. I’ll make a separate post on this in depth later
  • We discussed how to manage the definitional layer (data dictionary / ontology) at length. There’s a real risk of this complexity slipping out of control, and that will be a serious focus of the next round of development

Where to now? MnM is going to create a project proposal to give RFH a home at Hl7. On the technical side, I’m planning to work with Ewout Kramer, Lloyd Mckenzie, and perhaps one other to develop RFH into a serious proposal for consideration at the next HL7 meeting at San Antonio in January. For now, much of our work will be mediated through the wiki on this site. You can track changes to the wiki here.


Question: What is IHMSDO and what does Resources for Health have to do with it?

I attended your RFH session earlier today which was both rather crowded as well as informational.  In the video available at , at 6 minutes into the video, it talks about “RFH R2”. In effect the entire video, set in the future, is a kind of Fresh Look proposal. I’m relatively new to HL7 – what do you make of it? I’d appreciate a review.

It’s a parody video – set in the future looking backwards in time to today. It’s quite funny, though not everyone will be amused. The fact that it mentions RFH R2 shows that it’s pretty recent indeed. Whoever made it thinks RFH might be part of the future – I’m honoured. But they don’t say who they are. Still given the accent and some aspects of the video, I’ll be chatting to my dutch friends to see if any of them will own up to knowing who made the video.

And yes, today’s RFH session was packed. I’ll make a post about RFH tomorrow

Question – should I use v2 or v3 for teleradiology


In 2011, what is the % of worldwide and/or US HL7 v2.x implementations vs v3 ? For dedicated point to point HL7 interfaces on teleradiology applications, does it make sense to use v3 vs. v2 ?


To my knowledge, v3 messaging has been implemented by national programs in the Netherlands, UK, and Canada. Some parts of the v3 standard have found application internally to vendor systems, and CDA has been widely implemented. It’s hard to know what % of implementations of HL7 are because:

  • No one is required to report implementations
  • How do you calculate % – implementations, messages, noisy consultants?
  • it varies so much between countries

What I can say is that I’d be astounded if there were any teleradiology applications outside Netherlands, UK, and Canada that were using v3, and only quite surprised if there were any in those countries. It would be version 2, and version 2 is the only choice that makes sense.

Note that you wouldn’t use CDA to implement a teleradiology application, because it’s about process and exchange, which are outside the scope of CDA. On the other hand, when it comes to carrying the actual content of a radiology report inside a v2 message, CDA is not a bad choice to use at all (I think it’s best to provide reports in as many formats as possible when sending them – I’d consider txt, rtf, pdf, and cda).


How do you put tablets in PQ.units?

This is one of the top 3 questions about the data types:

PQ.units only supports UCUM units. UCUM doesn’t support customary units like “tablet”, “scoop”, etc, which are very common in healthcare – how are these supposed to be handled?

PQ.units is a CS type – a “simple code”, though simple is not the right word for UCUM codes, which are sophisticated and clever beasts. Some typical examples of UCUM units:

  • mg/mL
  • U/L
  • mmol/l

All these units – and all the others in UCUM – are derived from unambiguous measures of physical reality. There is no units that have any ambiguity about them, and therefore UCUM doesn’t have anything like “tablet”. What UCUM does have is a unit “1”, which means countable entities. So 3 “1”s of something is a count of 3. The PQ data type has a default unit of “1”. So

  <value xsi:type="PQ" value="3"/>

means that there is 3 individual countable units of whatever value is a measure of. The code defines that. This requires a mind shift about how the measure is conceived. Instead of 3 tablets of acetominaphen(value = 3, units = tablets, thing = acetominaphen),  it’s 3 units of acetominaphen tablets (value = 3, units = 1, thing = acetominaphen tablet).

This applies whether we are talking of a known specified does such as

    <code code="23628011000036109"
       displayName="paracetamol 500 mg tablet"/>
    <doseQuantity value="3"/>

or whether the dosage is specified as a range:

    <code code="23628011000036109"
       displayName="paracetamol 500 mg tablet"/>
    <doseQuantity xsi:type="URG_PQ">
      <low value="1"/>
      <high value="3"/>

In either case, the fact that we are talking about tablets comes from the code, not the doseQuantity. In my examples, I have used a code taken from AMT (The Australian Medicines Terminology). In other contexts, you’d have to use a different coding system that includes the dosage form as part of the code. I don’t know off the top of my head whether the major coding systems such as RxNorm have the dose form included. if they don’t, you could do this:

    <code code="acetominaphen"
       codeSystem="[my substances oid]"
      <name code="form"
        codeSystem="[my expression syntax OID]"
        displayName="form of substance"/>
      <value code="tablet"
        codeSystem="[my forms OID]"
        displayname="given as a tablet"/>

This CDA sample is still incomplete – where’s the 500mg? btw, in ISO 21090, we removed the qualifier syntax – it causes way more problems than it solves, and you’d have to  do:

    <code code="acetominaphen:form=tablet"
       codeSystem="[my adminstration expression oid]"
         displayName="acetominaphen as a tablet"/>

Substance Administration is a complex thing. Somehow pushing tablets into the measurement wouldn’t make it easier.

p.s. PQ includes a translation. So you could try for something like this:

  <value xsi:type="PQ" value="3">
   <translation value="3" code="tablets"
     codeSystem="[my custom dose units oid]"/>

Don’t do this – it’s not valid, and it doesn’t solve your problem properly.