Skip to content

Instantly share code, notes, and snippets.

View jmandel's full-sized avatar

Josh Mandel jmandel

View GitHub Profile
<OrderMedAmb>
<orderable>
<Orderable>
<rdf:type rdf:resource="&cemterms;OrderMedAmb.orderable" />
<frequency>
<Frequency>
<frequencyItem>
<FrequencyItem>
<periodicFrequencyLowerLimit>
<PeriodicFrequencyLowerLimit>
@jmandel
jmandel / ordermedamb.sparql
Created August 2, 2011 23:54
OrderMedAmb SPARQL Query
QUERY:
BASE <http://smartplatforms.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?root_subject <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://smartplatforms.org/cemterms#OrderMedAmb>.
?root_subject <http://smartplatforms.org/cemterms#orderNumber> ?orderNumber_object.
?orderNumber_object <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type_object.
?orderNumber_object <http://smartplatforms.org/terms#string> ?string_object.
?root_subject <http://smartplatforms.org/cemterms#counterSigned> ?counterSigned_object.
?counterSigned_object <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type_object_2.
@jmandel
jmandel / jsonld frame
Created November 9, 2011 01:30
jsonld data
{
"@context": {
"@coerce": {
"ex:contains": "@iri"
},
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@subject": [
@jmandel
jmandel / data_models_and_coding_systems.md
Created December 27, 2011 18:39
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
jmandel / p2304575.xml
Created February 27, 2012 21:18
SMART Pan-SHARP: Sample Patient RDF File
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sp="http://smartplatforms.org/terms#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:v="http://www.w3.org/2006/vcard/ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:spcode="http://smartplatforms.org/terms/codes/">
<sp:Demographics>
@jmandel
jmandel / 1_starting_graph.ttl
Created March 21, 2012 22:18
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>;
@jmandel
jmandel / binary_search_openrdf.py
Created March 30, 2012 18:34
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
jmandel / medlists.py
Created May 1, 2012 22:35
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:<http://purl.org/dc/terms/>
PREFIX sp:<http://smartplatforms.org/terms#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?l ?s ?sname ?d
@jmandel
jmandel / post.md
Created May 16, 2012 00:59
"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
jmandel / query
Created May 30, 2012 17:16
SPARQL: Problems --> Body Parts
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX umls:<http://bioportal.bioontology.org/ontologies/umls/>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
select distinct ?xl ?bodyPartLabel {
?x rdfs:subClassOf* ?y.
?y <http://purl.bioontology.org/ontology/SNOMEDCT/has_finding_site> ?z.
?z rdfs:subClassOf* ?bodyPart.
?x skos:prefLabel ?xl.