Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filling in code predicates with SNOMED
@prefix : <http://smartplatforms.org/terms#> .
@prefix dcterms:<http://purl.org/dc/terms/>.
# We start with a mixed bag:
# some problems have local code only
# some problems have snomed code only
# some problems have both
<http://pboth> a :Problem;
:code <http://some.refrence.to/icd9#982.1>;
:snomedCode <http://www.ihtsdo.org/snomed-ct/concepts/74267005>;
:startDate "2011-05-05".
<http://plocal> a :Problem;
:code <http://some.refrence.to/icd9#982.1>;
:startDate "2011-05-05".
<http://psnomedonly> a :Problem;
:code <http://www.ihtsdo.org/snomed-ct/concepts/74267005>;
:startDate "2011-05-05".
<http://some.refrence.to/icd9#982.1> a :Code,:Diagnosis;
dcterms:title "Toxic effect of; carbon tetrachloride";
:system "http://some.refrence.to/icd9#";
:translation [
a :Translation;
:targetCode <http://www.ihtsdo.org/snomed-ct/concepts/74267005> ;
:translationFidelity <http://smartplatforms.org/terms/codes/TranslationFidelity#automated>.
]
<http://www.ihtsdo.org/snomed-ct/concepts/74267005> a :Code, :Diagnosis, :SNOMED;
dcterms:title "Toxic encephalopathy due to carbon tetrachloride";
:system "http://www.ihtsdo.org/snomed-ct/concepts/";
:identifier "74267005".
# this query implements some very basic
# rules-based reasoning, augmenting the
# graph by supplying a :snomedCode for each
# :Problem.
PREFIX :<http://smartplatforms.org/terms#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
insert { ?p :snomedCode ?s. }
where {
?p a :Problem.
?p :code ?c.
?c (:translation/:targetCode)* ?s.
?s a :SNOMED.
}

When a client requests the problem list, it sees the augmented graph. And so a developer can easily query for SNOMED identifiers:

SPARQL:

PREFIX :<http://smartplatforms.org/terms#>
select * where {
 ?p a :Problem.
 ?p :snomedCode ?s.
}

Yields:

@prefix : <http://smartplatforms.org/terms#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://pboth> :snomedCode <http://www.ihtsdo.org/snomed-ct/concepts/74267005> .
<http://plocal> :snomedCode <http://www.ihtsdo.org/snomed-ct/concepts/74267005> .
<http://psnomed> :snomedCode <http://www.ihtsdo.org/snomed-ct/concepts/74267005> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.