Skip to content

Instantly share code, notes, and snippets.


Josh Mandel jmandel

View GitHub Profile
View gist:1121436
<rdf:type rdf:resource="&cemterms;OrderMedAmb.orderable" />
jmandel / ordermedamb.sparql
Created Aug 2, 2011
OrderMedAmb SPARQL Query
View ordermedamb.sparql
PREFIX rdf: <>
?root_subject <> <>.
?root_subject <> ?orderNumber_object.
?orderNumber_object <> ?type_object.
?orderNumber_object <> ?string_object.
?root_subject <> ?counterSigned_object.
?counterSigned_object <> ?type_object_2.
View jsonld frame
"@context": {
"@coerce": {
"ex:contains": "@iri"
"dc": "",
"ex": "",
"xsd": ""
"@subject": [
jmandel /
Created Dec 27, 2011
It's a mistake to abstract Coding Systems from Data Models

It's a mistake to abstract Coding Systems from Data Models

JCM, 12/27/2011

How models are "supposed to work"

In theory, clinical modellers erect an abstraction barrier to keep the details of coding systems out of their data models. According to this theory:

  1. "Data Models" describe classes or types of data, along with the properties that class members can/should/must assign. For instance, let's take a model for "Prescription" specifying that each Prescription has a required start date, optional end date, and a required "drug" field.

  2. "Coding Systems" are separately-maintained sets of values that a data model can "bind" to a given property. These are often large, multi-purpose systems maintained by teams of analysts working for a major healthcare organization, government, or SDO. For instance:

jmandel / p2304575.xml
Created Feb 27, 2012
SMART Pan-SHARP: Sample Patient RDF File
View p2304575.xml
<?xml version="1.0" encoding="utf-8"?>
jmandel / 1_starting_graph.ttl
Created Mar 21, 2012
Filling in code predicates with SNOMED
View 1_starting_graph.ttl
@prefix : <> .
@prefix dcterms:<>.
# 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 <>;
jmandel /
Created Mar 30, 2012
Binary search to find max working graph size
import sys
import urllib
import urllib2
REPOSITORY = "http://localhost:8080/openrdf-sesame/repositories/test/statements"
head="""INSERT DATA {
GRAPH <http://one-graph-to-break-them-all> { """
tail=""" }
jmandel /
Created May 1, 2012
MedicationList REST App Example
client = get_smart_client(smart_oauth_header)
# Represent the list as an RDF graph
med_lists = client.records_X_medication_lists_GET()
lists_q = """
PREFIX dcterms:<>
PREFIX sp:<>
PREFIX rdf:<>
select ?l ?s ?sname ?d
jmandel /
Created May 16, 2012
"CCD Export" doesn't solve interoperability

At yesterday's Health 2.0 conference, Farzad Mostashari asked why SMART isn't using CCD export (as specified by Meaningful Use) to extract data from EMR systems. This is a great question, in part because it separates out two important aspects of SMART:

  1. Getting data out of today's EHRs
  2. Presenting those data to apps in a natural, convenient, developer-friendly way. -- and focuses on #1. (I don't think many would argue that CCD is fit for #2. And to be clear: for developers building a SMART app, the details of #1 are almost irrelevant. SMART app developers get one clear-cut API to work with, and consistent SMART data elements)

Well! ONC is certainly headed in the right direction by requiring more specific, demanding export formats as part of meaningful use. Having a baseline level of consistently structured data is the right aspiration! And MU s

jmandel / query
Created May 30, 2012
SPARQL: Problems --> Body Parts
View query
PREFIX rdfs:<>
PREFIX xsd:<>
PREFIX owl:<>
PREFIX umls:<>
PREFIX skos:<>
select distinct ?xl ?bodyPartLabel {
?x rdfs:subClassOf* ?y.
?y <> ?z.
?z rdfs:subClassOf* ?bodyPart.
?x skos:prefLabel ?xl.