slanted W3C logo
Cover page images (keys)

RDF RIM Tutorial

Orientation material for the W3C HCLS group

This document is intended to supply the reader with a basic understanding of the structure of how data written in HL7's RIM can be expressed in RDF. It is not a substitute for HL7's documentation, but instead the author's notion of a quick way to familiarize oneself with the concepts and terms used in the RIM and how the graph structure of RDF is a natural way to represent this data.

Notation:

The RIM has ~40 basic classes, but the most important ones are color coded for easy recognition (inspired by Peter Coad):

At the right is a typical RIM diagram using the color-coding described above.

Clinical Observation

Suppose we want to write down a fairly detailed clinical observation:

Grade 4 anaphylactic reaction to penicillin as evidenced by the combination of wheals (hives), acute respiratory distress (ARD) and systemic hypotension (LBP) following a penicillin injection.

As a set of observations and relationships, it might look like the image on the right.

That image may be somewhat informative if viewed directly by a physician, but it lacks all the structure and use of common coding systems necessary for machine interpretation.

anaphylaxis grade 4/5 severity weals(hives) evidence acuterespiratorydistress evidence lowbloodpressure evidence

Acts with codes

We can add codes to the observation (recall that they are Acts). Codes perform several functions:

This is a step towards machine-readability and interoperability, but so far, we are still counting on the information model have sufficient relationship terms to convey every detail relating two observations.

ActRelationships

Adding codes to the ActRelationships permits us to use a coding system to provide the detailed relationships we want to convey. This reduces significantly the expressivity requirements on the information model, though in practice, the codes in this example still come from HL7, the same folks who define the information model.

The RIM graph

Here's what it looks like all together. Kind of a mess as a diagram, but pretty easy to sort through in a typical instance document. The rimITS provides a straightforward XML representation of RIM:

<rim-graph xmlns="urn:hl7-org:v3-rim"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="0229">
  <content xsi:type="Observation" classCode="OBS" moodCode="EVN">
    <code code="ASSERTION" displayName="Assertion"
       codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
    <value xsi:type="CD" code="241938005" displayName="penicillin-induced anaphylaxis (disorder)"
       codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
 
    <inboundRelationship typeCode="SUBJ">
      <source xsi:type="Observation" classCode="OBS" moodCode="EVN">
        <code code="SEV" displayName="Severity Observation"
           codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
        <value xsi:type="CD" code="423132009"
           codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
      </source>
    </inboundRelationship>
 
    <outboundRelationship typeCode="EVID">
      <target xsi:type="Observation" classCode="OBS" moodCode="EVN">
        <code code="ASSERTION" displayName="Assertion"
           codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
        <value xsi:type="CD" code="247472004" displayName="weal (disorder)"
           codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
      </target>
    </outboundRelationship>
 
    <outboundRelationship typeCode="EVID">
      <target xsi:type="Observation" classCode="OBS" moodCode="EVN">
        <code code="ASSERTION" displayName="Assertion"
           codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
        <value xsi:type="CD" code="373895009" displayName="acute respiratory distress"
           codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
      </target>
    </outboundRelationship>
 
    <outboundRelationship typeCode="EVID">
      <target xsi:type="Observation" classCode="OBS" moodCode="EVN">
        <code code="ASSERTION" displayName="Assertion"
           codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
        <value xsi:type="CD" code="45007003" displayName="low blood pressure (disorder)"
           codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
      </target>
    </outboundRelationship>
  </content>
</rim-graph>
2.16.840.. SNOMED 2013-01-01 241938005 penicillin-induced anaphylaxis 2.16.840.. SNOMED 2013-01-01 423132009 Grade 4/5 2.16.840.. HL7 2013-01-01 SEV Severity Act.code 2.16.840.. SNOMED 2013-01-01 247472004 Weals (Hives) 2.16.840.. HL7 2013-01-01 ASSERTION Assertion Act.code 2.16.840.. SNOMED 2013-01-01 373895009 Respiratory Distress 2.16.840.. HL7 2013-01-01 ASSERTION Assertion Act.code 2.16.840.. SNOMED 2013-01-01 45007003 Low Blood Pressure 2.16.840.. HL7 2013-01-01 ASSERTION Assertion Act.code

CCDA

The rimITS example we just saw is optimized for readability by RIM afficionados. There are many more popular representations of the RIM which use XML tags and structures which are less related to the core RIM structure. An important one is C-CDA, mandated by the Affordable Care Act to provide patient portability between clinics and systems.

There is still some consistency between RMIMs; the structure attributes like mood and typeCode remain the same and, if you know the mapping back to RIM, it's fairly intuitive to read data expressed in some RMIM as RIM objects. At the right is a small excerpt of the RMIM for C-CDA capturing the reference ranges for measured values. Below is what that looks like in XML:

referenceRange RMIM
<observation classCode="OBS" moodCode="EVN">
  <code code="718-7" displayName="Hgb Bld-mCnc" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" />
  <value xsi:type="PQ" value="15.0" unit="g/dL" />
  <referenceRange>
    <observationRange>
      <text>13.5 - 18</text>
    </observationRange>
  </referenceRange>
</observation>

Note that classCode, moodCode, code, displayName, codeSystem and codeSystemName are the same structure attributes that we saw in the rimITS example.

CCDAs 2

Some XML elements represent a cyclic structure. At the right, the entryRelationship element connects one Observation to another. This captures the Acts and ActRelationships we saw in the rimITS example. The diagnosis and severity from the rimITS example can be expressed in C-CDA as:

  <Observation classCode="OBS" moodCode="EVN">
    <code code="ASSERTION" displayName="Assertion"
       codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
    <value xsi:type="CD" code="241938005" displayName="penicillin-induced anaphylaxis (disorder)"
       codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
    <entityRelationship typeCode="SUBJ"
         xsi:type="Observation" classCode="OBS" moodCode="EVN">
        <code code="SEV" displayName="Severity Observation"
           codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7 ActCode"/>
        <value xsi:type="CD" code="423132009"
           codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT"/>
      </@@@source>
    </@@@inboundRelationship>
entryRelationship RMIM

As RDF

From what we've seen of the RIM, its general graph structure can model anything (a famous example being plays by Shakespear), provided you can define ActRelationships to capture the relationships. The core of the expressivity is that the ActRelationship define potentially cyclic graph. Such a graph model can be trivially expressed in RDF.

@@

Thank you

Come geek with us in the W3C Semantic Web in Health Care and Life Sciences IG

join us

sprites

image/svg+xml RIM RDF Tutorial cd:code codeSystem:codeSystemName:codeSystemVersion:code:displayName: rim:ActRelationship typeCode:source:target: rim:ActRelationship typeCode:sequenceNumber:priorityNumber:source:target: codeSysName codeSysVer code displayName classCode:activityTime:typeCode: OBS2013-01-01 rim:Act cd:code obj to cd:code arc cd:code