Skip to content

Instantly share code, notes, and snippets.

@jmandel
Last active December 18, 2015 01:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmandel/5704061 to your computer and use it in GitHub Desktop.
Save jmandel/5704061 to your computer and use it in GitHub Desktop.
FHIR RDF proposals / examples
@prefix : <http://hl7/org/fhir/DiagnosticReport#> .
@prefix fhir: <http://hl7/org/fhir/> .
@prefix Narrative: <http://hl7/org/fhir/Narrative#> .
@prefix Observation: <http://hl7/org/fhir/Observation#> .
@prefix Quantity: <http://hl7/org/fhir/Quantity#> .
@prefix Resource: <http://hl7/org/fhir/Resource#> .
@prefix Reference: <http://hl7/org/fhir/Reference#> .
@prefix Range: <http://hl7/org/fhir/Range#> .
@prefix Codeable: <http://hl7/org/fhir/Codeable#> .
@prefix Coding: <http://hl7/org/fhir/Coding#> .
@prefix xml: <http://www.w3.org/1999/xhtml> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema> .
@base <http://this-fhir-server/fhir/> .
[] a fhir:DiagnosticReport;
Resource:text [
a fhir:Narrative;
Narrative:status [a fhir:Code; fhir:value "generated"];
xml:div """<h3>CBC Report for Wile. E. COYOTE (MRN: 23453) issued 3-Mar 2011 11:45</h3>
<pre>
Test Units Value Reference Range
Haemoglobin g/L 176 135 - 180
Red Cell Count x10*12/L 5.9 4.2 - 6.0
<p>Acme Laboratory, Inc signed: Dr Pete Pathologist</p>"""
];
:status [a fhir:Code; fhir:value "final"];
:issued [a fhir:DateTime; fhir:value "2011-03-04T11:45:33+11:00"^^xsd:dateTime];
:subject [
a fhir:Reference;
Reference:reference <patient/@pat2>
];
:performer [
a fhir:Reference;
Reference:reference <organization/@1832473e-2fe0-452d-abe9-3cdb9879522f>;
Reference:display [a fhir:String; fhir:value "Acme Laboratory, Inc"]
];
:reportId [
a fhir:Identifier;
:system [a fhir:Uri; fhir:value <http://acme.com/lab/reports>];
:key [a fhir:String; fhir:value "5234342"];
];
:serviceCategory [
a fhir:Codeable;
Codeable:coding [
a fhir:Coding;
Coding:system [a fhir:Uri; fhir:value <http://hl7.org/fhir/sid/v2-0074>];
Coding:code [a fhir:Code; fhir:value "HM"];
]
];
:diagnosticTime [a fhir:DateTime; fhir:value "2011-03-04T08:30:00+11:00"^^xsd:dateTime];
:results [
:results_name [
a fhir:Codeable;
Codeable:coding [
a fhir:Coding;
Coding:system [a fhir:Uri; fhir:value <http://loinc.org>];
Coding:code [a fhir:Code; fhir:value "15430-2"];
Coding:display [a fhir:String; fhir:value "FULL BLOOD EXAMINATION"];
], [
a fhir:Coding;
Coding:code [a fhir:Code; fhir:value "CBC"];
Coding:display [a fhir:String; fhir:value "MASTER FULL BLOOD COUNT"];
];
];
:results_result [
a fhir:Reference;
Reference:reference _:r1
], [
a :Reference;
Reference:reference _:r2
]
].
_:r1 a fhir:Observation;
Resource:text [
a fhir:Narrative;
Narrative:status [a fhir:Code; fhir:value "empty"];
xml:div """Missing"""
];
Observation:name [
a fhir:Coding;
Coding:system [a fhir:Uri; fhir:value <http://loinc.org/>];
Coding:code [a fhir:Code; fhir:value "718-7"];
Coding:display [a fhir:String; fhir:value "Haemoglobin"]
];
Observation:valueQuantity [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "176"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "g/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "g/L"]
];
Observation:status [a fhir:Code; fhir:value "final"];
Observation:reliability [a fhir:Code; fhir:value "ok"];
Observation:referenceRange [
# I dislike this predicate... but I think we need it
# given e.g. "type" @ http://www.hl7.org/implement/standards/fhir/documentreference.htm
Observation:referenceRange_rangeRange [
a fhir:Range;
Range:low [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "135"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "g/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "g/L"]
];
Range:high [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "180"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "g/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "g/L"]
]
]
].
_:r2 a fhir:Observation;
Resource:text [
a fhir:Narrative;
Narrative:status [a fhir:Code; fhir:value "empty"];
xml:div """Missing"""
];
Observation:name [
a fhir:Coding;
Coding:system [a fhir:Uri; fhir:value <http://loinc.org/>];
Coding:code [a fhir:Code; fhir:value "789-8"];
Coding:display [a fhir:String; fhir:value "Red Cell Count"]
];
Observation:valueQuantity [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "5.9"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "x10*12/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "10*12/L"]
];
Observation:status [a fhir:Code; fhir:value "final"];
Observation:reliability [a fhir:Code; fhir:value "ok"];
Observation:referenceRange [
Observation:rangeRange [
a fhir:Range;
Range:low [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "4.2"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "x10*12/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "10*12/L"]
];
Range:high [
a fhir:Quantity;
Quantity:value [a fhir:Decimal; fhir:value "6"^^xsd:decimal];
Quantity:units [a fhir:String; fhir:value "x10*12/L"];
Quantity:system [a fhir:Uri; fhir:value <http://unitsofmeasure.org>];
Quantity:code [a fhir:Code; fhir:value "10*12/L"]
]
]
].
<patient/@pat2> a fhir:Patient.
<organization/@1832473e-2fe0-452d-abe9-3cdb9879522f> a fhir:Organization.
<DiagnosticReport xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<h3>CBC Report for Wile. E. COYOTE (MRN: 23453) issued 3-Mar 2011 11:45</h3>
<!-- you could use ab html table here, but laboratories are still
using fixed text tables, and this will take decades to change... -->
<pre>
Test Units Value Reference Range
Haemoglobin g/L 176 135 - 180
Red Cell Count x10*12/L 5.9 4.2 - 6.0
</pre>
<p>Acme Laboratory, Inc signed: Dr Pete Pathologist</p>
</div>
</text>
<contained>
<!--
all the data items (= Observations) are contained
in this diagnostic report. It would be equally
valid - and normal - for them to be separate trackable
items. However for the purposes of this example, it's
more convenient to have them here. For more discussion,
see under "Contained Resources" on the Resource Definitions
topic page -->
<!-- for users steeped in v2, each observation roughly corresponds with an
OBX, and the Diagnostic Report with an ORU_R01 message -->
<Observation id="r1">
<text>
<status value="empty"/>
<div xmlns="http://www.w3.org/1999/xhtml">Missing</div>
</text>
<name>
<coding>
<system value="http://loinc.org"/>
<code value="718-7"/>
<display value="Haemoglobin"/>
</coding>
</name>
<valueQuantity>
<value value="176"/>
<units value="g/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="g/L"/>
</valueQuantity>
<status value="final"/>
<reliability value="ok"/>
<referenceRange>
<rangeRange>
<low>
<value value="135"/>
<units value="g/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="g/L"/>
</low>
<high>
<value value="180"/>
<units value="g/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="g/L"/>
</high>
</rangeRange>
</referenceRange>
</Observation>
</contained>
<contained>
<Observation id="r2">
<text>
<status value="empty"/>
<div xmlns="http://www.w3.org/1999/xhtml">Missing</div>
</text>
<name>
<coding>
<system value="http://loinc.org"/>
<code value="789-8"/>
<display value="Red Cell Count"/>
</coding>
</name>
<valueQuantity>
<value value="5.9"/>
<units value="x10*12/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="10*12/L"/>
</valueQuantity>
<status value="final"/>
<reliability value="ok"/>
<referenceRange>
<rangeRange>
<low>
<value value="4.2"/>
<units value="x10*12/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="10*12/L"/>
</low>
<high>
<value value="6.0"/>
<units value="x10*12/L"/>
<system value="http://unitsofmeasure.org"/>
<code value="10*12/L"/>
</high>
</rangeRange>
</referenceRange>
</Observation>
</contained>
<!-- first, various administrative/context stuff -->
<status value="final"/> <!-- all this report is final -->
<issued value="2011-03-04T11:45:33+11:00"/>
<subject>
<type value="Patient"/>
<reference value="patient/@pat2"/>
</subject>
<performer>
<type value="Organization"/>
<reference value="organization/@1832473e-2fe0-452d-abe9-3cdb9879522f"/>
<display value="Acme Laboratory, Inc"/>
</performer>
<reportId>
<system value="http://acme.com/lab/reports"/>
<key value="5234342"/>
</reportId>
<serviceCategory>
<coding>
<system value="http://hl7.org/fhir/sid/v2-0074"/>
<code value="HM"/>
</coding>
</serviceCategory>
<diagnosticTime value="2011-03-04T08:30:00+11:00"/>
<results>
<name>
<coding>
<system value="http://loinc.org"/>
<code value="15430-2"/>
<display value="FULL BLOOD EXAMINATION"/>
</coding>
<coding>
<code value="CBC"/>
<display value="MASTER FULL BLOOD COUNT"/>
</coding>
</name>
<!-- now the atomic results -->
<result>
<type value="Observation"/>
<reference value="#r1"/>
</result>
<result>
<type value="Observation"/>
<reference value="#r2"/>
</result>
</results>
</representation>
</DiagnosticReport>
@prefix : <http://hl7/org/fhir/DiagnosticReport#> .
@prefix fhir: <http://hl7/org/fhir/> .
@prefix Order: <http://hl7/org/fhir/Order#> .
@prefix Narrative: <http://hl7/org/fhir/Narrative#> .
@prefix Resource: <http://hl7/org/fhir/Resource#> .
@prefix Reference: <http://hl7/org/fhir/Reference#> .
@prefix Codeable: <http://hl7/org/fhir/Codeable#> .
@prefix Coding: <http://hl7/org/fhir/Coding#> .
@prefix xml: <http://www.w3.org/1999/xhtml> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema> .
@base <http://this-fhir-server/fhir/> .
[] a fhir:Order;
Resource:text [
a fhir:Narrative;
Narrative:status [a fhir:Code; fhir:value "generated"];
xml:div """Request for Prescription (on patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321)"""
];
Order:date [
a fhir:DateTime;
fhir:value "2012-12-28T09:03:04+11:00"^^xsd:dateTime
];
Order:subject [
a fhir:Reference;
Reference:reference <patient/@pat2>
];
Order:source [
a fhir:Reference;
Reference:reference <practitioner/@example>
];
Order:reason [
a fhir:String;
fhir:value "Standard admission testing"
];
Order:when [
Order:when_code [ # I dislike this predicate... but I think we need it given e.g. "type" @ http://www.hl7.org/implement/standards/fhir/documentreference.htm
a fhir:Codeable;
Codeable:coding [
a fhir:Coding;
Coding:system [a fhir:Uri; fhir:value <http://acme.com/codes/request-priority>];
Coding:code [a fhir:Code; fhir:value "today"];
]
]
];
Order:detail [
a fhir:Reference;
Reference:reference <medicationprescription/@example>
].
<medicationprescription/@example> a fhir:MedicationPrescription.
<patient/@pat2> a fhir:Patient.
<practitioner/@example> a fhir:Practitioner.
<Order xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Request for Prescription (on patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321)</div>
</text>
<date value="2012-12-28T09:03:04+11:00"/>
<subject>
<type value="Patient"/>
<reference value="patient/@pat2"/>
</subject>
<source>
<type value="Practitioner"/>
<reference value="practitioner/@example"/>
</source>
<reason value="Standard admission testing"/>
<!-- Institution local code meaning "do this today" -->
<when>
<code>
<coding>
<system value="http://acme.com/codes/request-priority"/>
<code value="today"/>
</coding>
</code>
</when>
<detail>
<type value="MedicationPrescription"/>
<reference value="medicationprescription/@example"/>
</detail>
</Order>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment