slanted W3C logo
Cover page images (keys)

Modeling and Validating HL7 FHIR Profiles Using ShEx

AMIA
~21 March, 2016

Data Value

Data utility depends on whether it

Data dimensions

Size/Structure (false) dichotomy

image/svg+xml StructuredData BigData MendelianDiseases EverythingElse Structure Size

Clinical Data

FHIR Goals

  • Smooth out data impedence between clinical systems.
  • Shift integration effort to acquisition effort
    • Enable more coded data
    • Focus on etiology instead of insurance.
    • Encourage acquisition of richer clinical history graph.
  • Enable pedestrian goals like single-entry.

Semantic FHIR Goals

  • Smooth out data impedence between clinical data and clinical knowledge.
  • Shift integration effort to ontology integrationeffort
    • Uniform model for information model and terminology implications.
    • Integration with anatomy and disease ontologies.
    • Encourage collaborative model mapping, CDS rules, etc.
  • Repurpose for research, efficacy monitoring, bio-surveillance...

Clinical history graph

TermInfo Opportunity

image/svg+xml Diagnosis Evidence Evidence Rectord Target IsabellaJones NEXTGENMedicalPractice PATIENTRole recordTarget player scoper ClinicalDocument Diagnosis 282291009 20130605 20130602 SNOMED Encounter REFR DRIV DRIV 20130131 inpatient Information Model Terminology Model Diagnosis 282291009

Terminological Resources in Medicine

FHIR-RDF Tools

FHIR XML to RDF

FHIR Profiles to ShEx

FHIR XML to RDF

  1. use a generic XSLT service
  2. with the XSLT and the generated XML definitions
  3. and some example instance data
  4. or hack the URL like http://services.w3.org/xslt?xmlfile=https%3A%2F%2Fhl7-fhir.github.io%2Fobservation-example.xml&docParam=http%3A%2F%2Fsome.example%2Ffire%2Fserver%2F&contained=ref&reference=ref&literals=nest&content-type=text%2Fturtle&xslfile=https%3A%2F%2Fraw.githubusercontent.com%2Fw3c%2Fhcls-fhir-rdf%2Fmaster%2Fxsl%2Ftransform.xsl&fhirdefs=https%3A%2F%2Fraw.githubusercontent.com%2Fw3c%2Fhcls-fhir-rdf%2Fmaster%2Fdata%2Fdefinitions.xml

or use a specialized form

FHIR/XML file:
base URI:
Contained: Refrerences: Literals: content-type:
XSLT (you probably don't need to change this):
defs file (you probably don't need to change this):

or

Navigating profiles

FHIR has a REST-based HTTP protocol
hence the Search Parameters
much more detailed that anything in LDP.

FHIR Profiles

image/svg+xml FHIR Profile Structure Defn Extensions Protocol XML SchemaSchematron - ShEx Schema FHIR/XML FHIR/JSON FHIR/RDF FHIR semantics RDF semantics Value Sets ShEx/CTS2 XML SchemaSchematron?

Observation Profile

NameFlagsCard.Type
.. Observation IDomainResource
... identifier 0..*Identifier
... status ?! Σ1..1code
... category 0..1CodeableConcept
... code Σ1..1CodeableConcept
... subject Σ0..1Reference(Patient | Group | Device | Location)
... encounter 0..1Reference(Encounter)
... effective[x] Σ0..1
.... effectiveDateTimedateTime
.... effectivePeriodPeriod
<Observation> {
  a (fhir:Observation)?,
  fhir:Observation.identifier                 @<Identifier>*,
  fhir:Observation.status                     @<code>,
  fhir:Observation.code                       @<CodeableConcept>,
  fhir:Observation.subject   { fhir:reference @<Patient>
                                           OR @<Group>
                                           OR @<Device>
                                           OR @<Location> }?,
  fhir:Observation.encounter { fhir:reference @<Patient> }?
  (fhir:Observation.effectiveDateTime         @<DateTime> |
   fhir:Observation.effectivePeriod           @<Interval>)?,
  ...

  fhir:Observation.id @<LitShape>?,
  fhir:Observation.meta @<MetaShape>?,
  fhir:Observation.implicitRules @<LitShape>?,
  fhir:Observation.language @<LitShape>?,
  fhir:Observation.text @<NarrativeShape>?,
  fhir:Observation.contained @<ResourceShape>*,
  fhir:Observation.extension @<ExtensionShape>*,
  fhir:Observation.modifierExtension @<ExtensionShape>*,
  fhir:Observation.valueQuantity @<QuantityShape>?,
  fhir:Observation.valueCodeableConcept @<CodeableConceptShape>?,
  fhir:Observation.valuestring @<LitShape>?,
  fhir:Observation.valueRange @<RangeShape>?,
  fhir:Observation.valueRatio @<RatioShape>?,
  fhir:Observation.valueSampledData @<SampledDataShape>?,
  fhir:Observation.valueAttachment @<AttachmentShape>?,
  fhir:Observation.valuetime @<LitShape>?,
  fhir:Observation.valuedateTime @<LitShape>?,
  fhir:Observation.valuePeriod @<PeriodShape>?,
  fhir:Observation.dataAbsentReason @<CodeableConceptShape>?,
  fhir:Observation.interpretation @<CodeableConceptShape>?,
  fhir:Observation.comments @<LitShape>?,
  fhir:Observation.appliesdateTime @<LitShape>?,
  fhir:Observation.appliesPeriod @<PeriodShape>?,
  fhir:Observation.issued @<LitShape>?,
  fhir:Observation.reliability @<LitShape>?,
  fhir:Observation.bodySiteCodeableConcept @<CodeableConceptShape>?,
  fhir:Observation.bodySiteReference @<ReferenceShape>?,
  fhir:Observation.method @<CodeableConceptShape>?,
  fhir:Observation.specimen @<ReferenceShape>?,
  fhir:Observation.performer @<ReferenceShape>*,
  fhir:Observation.device @<ReferenceShape>?,
  fhir:Observation.referenceRange @<BackboneElementShape>*,
  fhir:Observation.related @<BackboneElementShape>*

}

ShEx Semantic Actions

<IssueShape> {
    ex:state (ex:unassigned ex:assigned),
    ex:reportedBy @<UserShape>,
    ex:reportedOn xsd:dateTime
        %js:{ report = _.o; return true; %},
    (ex:reproducedBy @<EmployeeShape>,
     ex:reproducedOn xsd:dateTime
        %js:{ return _.o.lex > report.lex; %}
        %sparql:{ ?s ex:reportedOn ?rpt . FILTER (?o > ?rpt) %}
    ),
    ex:related @<IssueShape>*
}

<UserShape> {
    (foaf:name xsd:string
     | foaf:givenName xsd:string+,
       foaf:familyName xsd:string),
    foaf:mbox IRI
}
<Issue1>
    ex:state        ex:unassigned ;
    ex:reportedBy   <User2> ;
    ex:reportedOn   "2013-01-23T10:18:00"^^xsd:dateTime ;
    ex:reproducedBy <Thompson.J> ;
    ex:reproducedOn "2013-01-23T10:00:00"^^xsd:dateTime ;
#    ex:related      <Issue2>, <Issue3> 
.

<User2>
    foaf:givenName "Bob" ;
    foaf:familyName "Smith" ;
    foaf:mbox <mail:bob@example.org>
.

Next Steps

image/svg+xml SOF EHR repository FHIR/RDF FHIR/XML Terminology (SNOMED-CT, LOINC) Query/CDS FHIR Ontologies

Model of Interoperability

Exmine two schemas to see:

extra slides

Term simplification

The popular CD datatype has:

  • code
  • code system
  • code system version
  • helpful text
image/svg+xml Observation Code cd:code obj to cd:code arc cd:code Coding System cd:codingSystem obj to cd:codingSystem arc cd:codingSystem Display Name cd:displayName obj to cd:displayName arc cd:displayName obj to cd:code arc cd:code hl7:coding CD 282291009 SNOMED 20130131 Observation

Terms as URLs

  • authority
  • version
PREFIX snomed: <http://ihtsdo.org…20130131…> 
PREFIX hl7: <http://hl7.org/owl/metadata#> 

<myObs> hl7:coding snomed:282291009 .
image/svg+xml Observation obj to cd:code arc cd:code hl7:coding snomed:282291009 Observation

Term oversimplification?

image/svg+xml Terminology A (e.g. SNOMED) Version 1.0 (06.04) Code 'abc'Code 'def'Code 'ghi' Version 1.1 (11.05) Code 'abc'Code 'ghj'Code 'ghk' Terminology B (e.g. ICD-9) Version 1.0 (05.04) Code '123'Code '456'Code '788' Version 2.0 (05.06) Code '123.1'Code '123.2'Code '789' bi-di mappings

Minimalist term evolution

plumbing

Taxonomy supplements

These are all sibling children of Degree findings:

Purpose-built supplemental ontologies

Separate augmenters and decreasers without requiring SNOMED to do the same.

terminology model

image/svg+xml lowered reduced decreased increased raised lowered reduced decreased increased raised degree Find.

augmented terminology

image/svg+xml lowered reduced decreased increased raised lowered reduced decreased increased raised degree Find. lowered-narrowerThan-decreasers reduced-narrowerThan-decreasers decreased-narrowerThan-decreasers decreasers-narrowerThan-degreeFindings increased-narrowerThan-augmenters raised-narrowerThan-augmenters decreasers-narrowerThan-degreeFindings decreasers augmenters

Biggest challenges

plumbing

SNOMED CT - Systemized Nomenclature of Med - Clinical Terms

SNOMED CT Identifiers

SNOMED CT URI's do not currently directly dereference. They can be used, however, using the Common Terminology Services 2 (CTS2) REST identifiers:

C-CDA XML to RDF

similar to FHIR, but using the CDA-Turtle XSLT (see online example)

_:section0_allergyProblemAct0 a rim:Observation ;
    rim:Act.id [ a dt:DSET_II ;
        dt:COLL.item [ dt:II.root "69724b9d-5e77-402f-a5b6-3379dde3e8a9" ]
    ] ;
    rim:Act.classCode [ hl7:coding [ dt:CDCoding.code "ACT" ; dt:CDCoding.codeSystem "???" ] ] ;
    rim:Act.moodCode [ hl7:coding [ dt:CDCoding.code "EVN" ; dt:CDCoding.codeSystem "2.16.840.1.113883.5.1001" ] ] ;
    rim:Act.effectiveTime-low "2012-08-06"^^xsd:date ;
    rim:Act.statusCode "active" ;
  
    rim:Act.code [
        hl7:coding [ dt:CDCoding.code "48765-2" ; dt:CDCoding.codeSystem "2.16.840.1.113883.6.1" ;
                     dt:CDCoding.displayName "ALLERGIES, ADVERSE REACTIONS, ALERTS" ; dt:CDCoding.codeSystemName "LOINC" ]
    ];
    rim:Observation.value [ 
    ] .# SUBJ
[ a rim:ActRelationship ;
    rim:ActRelationship.typeCode [ hl7:coding [ dt:CDCoding.code "REFR" ; dt:CDCoding.codeSystem "???" ] ] ;
    rim:ActRelationship.source _:section0_allergyProblemAct0 ;
    rim:ActRelationship.target _:section0_allergyProblemAct0_entryRelationship0
] .
_:section0_allergyProblemAct0_entryRelationship0 a rim:Observation ;
    rim:Act.id [ a dt:DSET_II ;
        dt:COLL.item [ dt:II.root "69724b9d-5e77-402f-a5b6-3379dde3e8a9" ]
    ] ;
    rim:Act.classCode [ hl7:coding [ dt:CDCoding.code "OBS" ; dt:CDCoding.codeSystem "2.16.840.1.113883.5.6" ] ] ;
    rim:Act.moodCode [ hl7:coding [ dt:CDCoding.code "EVN" ; dt:CDCoding.codeSystem "2.16.840.1.113883.5.1001" ] ] ;
    rim:Act.effectiveTime-low "2012-08-06"^^xsd:date ;
    rim:Act.statusCode "completed" ;
  
    rim:Act.code [
        hl7:coding [ dt:CDCoding.code "ASSERTION" ; dt:CDCoding.codeSystem "2.16.840.1.113883.5.4" ;
                     dt:CDCoding.codeSystemName "HL7ActCode" ]
    ];
    rim:Observation.value [ a dt:PQ ;
        dt:CD.code [ a dt:CD ;
            hl7:coding [ rim:CDCoding.code "416098002" ; rim:CDCoding.codeSystem "2.16.840.1.113883.6.96" ;
                         rim:CDCoding.displayName "drug allergy" ; rim:CDCoding.codeSystemName "SNOMED CT" ]
        ]
    ] .# Participant
[ a rim:Participation ;
    rim:Participation.typeCode [ hl7:coding [ dt:CDCoding.code "CSM" ; dt:CDCoding.codeSystem "???" ] ] ;
    rim:Participation.act _:section0_allergyProblemAct0_entryRelationship0 ;
    rim:Participation.role _:section0_allergyProblemAct0_entryRelationship0_participant0
] .
_:section0_allergyProblemAct0_entryRelationship0_participant0 a rim:Role ;

    rim:Role.player _:section0_allergyProblemAct0_entryRelationship0_participant0_player ;
    rim:Role.scoper _:section0_allergyProblemAct0_entryRelationship0_participant0_scoper ;
    rim:Role.classCode [ hl7:coding [ dt:CDCoding.code "ROL" ; dt:CDCoding.codeSystem "???" ] ] ;
.
_:section0_allergyProblemAct0_entryRelationship0_participant0_player a rim:Person ;
    rim:Entity.classCode [ hl7:coding [ dt:CDCoding.code "PSN" ; dt:CDCoding.codeSystem "???" ] ] ;
    rim:Entity.determinerCode [ hl7:coding [ dt:CDCoding.code "INSTANCE" ; dt:CDCoding.codeSystem "???" ] ] ;
    rim:Entity.name [ a dt:COLL_EN ;
    ].

O-RIM

CDA RMIM

C-CDA RMIM

Interoperability value proposition

Interoperability state of the art

Technical barriers:

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