-
Notifications
You must be signed in to change notification settings - Fork 15
Description
ValueSet expansion from CodeSystems is inference
For background on ValueSet bindings see: #167
Summary: ValueSet composition can be more usefully translated to subsumption and property restrictions in the FHIR OWL ontology. This would enable RDF & OWL to be used natively for ValueSet expansion, which is both necessary for data validation and also not (currently) supported by ShEx.
This feature of FHIR RDF would make it much more useful in R6, planned for 2026. (Although more of a bonus feature. This related issue is more important).
Here’s an example of a fhir:Condition
that is uses a SNOMED code:
@prefix fhir: <http://hl7.org/fhir/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sct: <http://snomed.info/id/> .
<http://hl7.org/fhir/Condition/f201> a fhir:Condition ;
fhir:clinicalStatus [
fhir:coding ( [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/condition-clinical"^^xsd:anyURI ] ;
fhir:code [ fhir:v "resolved" ]
] )
] ; #
fhir:subject [
fhir:link <http://hl7.org/fhir/Patient/f201> ;
fhir:reference [ fhir:v "Patient/f201" ] ; # It entails Roel's problem
fhir:display [ fhir:v "Roel" ]
] ; #
fhir:code [
fhir:coding ( [
a sct:386661006 ;
fhir:system [ fhir:v "http://snomed.info/sct"^^xsd:anyURI ] ;
fhir:code [ fhir:v "386661006" ] ;
fhir:display [ fhir:v "Fever" ]
] ) # The problem is a fever
] ; #
It’s great to see here an IRI which lets us more directly relate this to a resource for the SNOMED code sct:386661006
.
Condition.code has an example binding to the ValueSet http://hl7.org/fhir/ValueSet/condition-code . So, these are generally good examples of codes to use with Condition.code
:
<http://hl7.org/fhir/ValueSet/condition-code> a fhir:ValueSet ;
fhir:url [ fhir:v "http://hl7.org/fhir/ValueSet/condition-code"^^xsd:anyURI] ;
fhir:compose [
fhir:include ( [
fhir:system [ fhir:v "http://snomed.info/sct"^^xsd:anyURI ] ;
fhir:filter ( [
fhir:property [ fhir:v "concept" ] ;
fhir:op [ fhir:v "is-a" ] ;
fhir:value [ fhir:v "404684003" ]
] )
] [
fhir:system [ fhir:v "http://snomed.info/sct"^^xsd:anyURI ] ;
fhir:concept ( [
fhir:code [ fhir:v "160245001" ] ;
fhir:display [ fhir:v "No current problems or disability" ]
] )
] )
] ; #
fhir:expansion [] . #
Notice:
- This doesn't imply only 2 codes, but also any code that's related to
sct:404684003
via some "is-a" relationship(s). - Roel’s fever condition is represented by the SNOMED code
sct:386661006
. - So, how do I know that is code is related to the code
sct:404684003
by some “is-a” relationship?
We don’t need to know this for data validation, since this is only an example binding, but you’d need to know that in a required binding. That requires ValueSet expansion .
Problem Summary ⚠️
FHIR represents relationships between CodeSystem codes in kind of a generic way that supports variety and extensibility, but on the other hand require extra effort to interpret. The meaning of “is-a” here is apparently only known to SNOMED and otherwise has an interpretation that’s hidden away in whatever code is used to expand ValueSets. A separate, dedicated terminology server is usually required to do this in practical usage.
Proposed Solution 💡
The relationship “is-a” at least sometimes is the same as rdfs:subClassOf
relation. The SNOMED OWL representation uses this, along with other object properties:
# Class: <http://snomed.info/id/386661006> (Fever (finding))
SubClassOf(:386661006 ObjectIntersectionOf(:123979008 ObjectSomeValuesFrom(:609096000 ObjectIntersectionOf(ObjectSomeValuesFrom(:363713009 :281302008) ObjectSomeValuesFrom(:363714003 :386725007)))))
...etc...
So, changing ValueSet compositions to use rdfs:subClassOf
would mean that we can use RDF and OWL to both represent FHIR and the codes used in FHIR in the same language, and expand their relationships using the inferential semantics of RDF and OWL predicates.
ValueSets should be related to useful IRIs for codes from CodeSystems
There are a few other problems that need resolving in order for this to work.
The ValueSet binding for Condition.clinicalStatus
is http://hl7.org/fhir/ValueSet/condition-clinical.
But unlike the last ValueSet, this one tells us that it includes all the codes from CodeSystem http://terminology.hl7.org/CodeSystem/condition-clinical.
<http://hl7.org/fhir/ValueSet/condition-clinical> a fhir:ValueSet ;
fhir:url [ fhir:v "http://hl7.org/fhir/ValueSet/condition-clinical"^^xsd:anyURI] ;
fhir:compose [
fhir:include ( [
fhir:system [ fhir:v "http://terminology.hl7.org/CodeSystem/condition-clinical"^^xsd:anyURI ]
] )
] .
Missing CodeSystem IRIs Problem: We have a URI for this CodeSystem, but it would be nice to have an IRI to directly relate to the CodeSystem itself in RDF. Right now it’s unnecessarily difficult to relate this ValueSet to that CodeSystem resource.
Here’s some of the RDF Turtle for the CodeSystem: https://terminology.hl7.org/6.5.0/CodeSystem-condition-clinical.ttl
Missing Code IRIs Problem: None of the codes have IRIs, which makes it unnecessarily difficult to tell whether the code I use in my Encounter.status is one of these codes. And actually, that status code "resolved" is also missing an IRI in the example instance http://hl7.org/fhir/Condition/f201.