Skip to content

Instantly share code, notes, and snippets.

@bewest
Last active August 15, 2016 10:58
Show Gist options
  • Save bewest/4965993 to your computer and use it in GitHub Desktop.
Save bewest/4965993 to your computer and use it in GitHub Desktop.
how do we encode glucose records?

How do we encode glucose results?

We'd like to communicate using this type of thing:

We have some example records here:

EG:

2011-03-07T19:04:12	90
2011-03-07T17:21:34	143
2011-03-07T16:44:14	121
2011-03-07T14:45:46	144

So we have the time and the value, but what is the LOINC code?

bewest@paragon:~/Downloads/loinc$ grep glucose ./* | wc -l
351
bewest@paragon:~/Downloads/loinc$ grep glucose ./* | grep -v -i -E "tolerance|enzyme|amniotic|peri" | wc -l
24
bewest@paragon:~/Downloads/loinc$ 
bewest@paragon:~/Downloads/loinc$ grep glucose ./* | grep -v -i -E "tolerance|enzyme|amniotic|peri" 
grep -i glucose ./* | grep -v -i -E "tolerance|enzyme|amniotic|peri"  | grep -i meter 
./LOINCDB.TXT:"14743-9"	"Glucose"	"SCnc"	"Pt"	"BldC"	"Qn"	"Glucometer"	"CHEM"	"OMH"	"19980116"	"ADD"		"ACTIVE"			1				"CORN SUGAR, D GLUCOPYRANOSE, D GLUCOSE, D GLUCOSE, DEXTROSE, GLU, GRAPE SUGAR,"						"Y"		"Glu; Gluc; Glucoseur; Substance concentration; Level; Point in time; Random; Cap blood; Cap bld; Capillary bld; Capillary blood; Finger stick; Quantitative; QNT; Quant; Quan; Glucomtr; Chemistry"	"Glucose BldC Glucomtr-sCnc"	"Both"				"mmol/L"	"Glucose [Moles/volume] in Capillary blood by Glucometer"	"NM/ST"	"PQ"			"mmol/L"					0	0	0	
./LOINCDB.TXT:"43151-0"	"Glucose meter device panel"	"-"	"Pt"	"^Patient"	"-"		"PANEL.DEVICES"	"SH"	"20051117"	"ADD"		"ACTIVE"			2										"N"		"; Glucose Meter Device Pnl; Glu; Gluc; Glucoseur; Point in time; Random; Pan; Panl"	"Glucose Meter Device Pnl"	"Order"					"Glucose meter device panel"										0	0	0	
./LOINCDB.TXT:"41653-7"	"Glucose"	"MCnc"	"Pt"	"BldC"	"Qn"	"Glucometer"	"CHEM"	"VA"	"20050705"	"ADD"		"ACTIVE"	"Glucose finger stick"		1										"N"	"mg/dL"	"Glu; Gluc; Glucoseur; Mass concentration; Level; Point in time; Random; Cap blood; Cap bld; Capillary bld; Capillary blood; Finger stick; Quantitative; QNT; Quant; Quan; Glucomtr; Chemistry"	"Glucose BldC Glucomtr-mCnc"	"Both"				"mg/dL"	"Glucose [Mass/volume] in Capillary blood by Glucometer"	"NM/ST"	"PQ"	"74-106;mg/dL"		"mg/dL"					0	41	0	
./LOINCDB.TXT:"41896-2"	"Class"	"Type"	"Pt"	"Glucose meter device"	"Nom"		"DEVICES"	"SH"	"20050727"	"ADD"		"ACTIVE"			2										"N"		"Typ; Point in time; Random; Glucose Mtr Dev; Nominal"	"Glucose Mtr Dev Class"	"Observation"					"Type of Glucose meter device"										0	0	0	
./LOINCDB.TXT:"41897-0"	"Vendor device name"	"ID"	"Pt"	"Glucose meter device"	"Nom"		"DEVICES"	"SH"	"20050727"	"ADD"		"ACTIVE"			2			"ONETOUCH® II, ONETOUCH® PROFILE®, ONETOUCH® SURESTEP®, ONETOUCH® FASTTAKE®, ONETOUCH® BASIC®, ONETOUCH® ULTRA®, ONETOUCH® ULTRASMART®, INDUO®, GLUCOMETER ELITE XL DIABETES CARE SYSTEM, ASCENSIA® CONTOURTM, ASCENSIA� BREEZE�, ACCU-CHEK® ACTIVE METER, ACCU-CHEK® ADVANTAGE SYSTEM, ACCU-CHEK® COMPACT METER, ACCU-CHEK® COMPLETE METER, ACCU-CHEK® VOICEMATE SYSTEM, PMP SELFCHECK� GLUCO"							"N"		"; Vendor name; Identifier; Ident; Point in time; Random; Glucose Mtr Dev; Nominal"	"Glucose Mtr Dev Vendor name"	"Observation"					"Glucose meter device Vendor name"										0	0	0	
./LOINCDB.TXT:"41898-8"	"Vendor device model code"	"ID"	"Pt"	"Glucose meter device"	"Nom"		"CHEM"	"SH"	"20050727"	"ADD"		"ACTIVE"			1										"N"		"; Model Cd; Identifier; Ident; Point in time; Random; Glucose Mtr Dev; Nominal; Chemistry"	"Model Cd Glucose Mtr Dev"	"Observation"					"Vendor device model code of Glucose meter"										0	0	0	
./LOINCDB.TXT:"41899-6"	"Vendor serial number"	"ID"	"Pt"	"Glucose meter device"	"Nom"		"DEVICES"	"SH"	"20050727"	"ADD"		"ACTIVE"			2										"N"		"; Serial #; Num; No; Identifier; Ident; Point in time; Random; Glucose Mtr Dev; Nominal"	"Glucose Mtr Dev Serial #"	"Observation"					"Glucose meter device Vendor serial number"										0	0	0	
./LOINCDB.TXT:"41900-2"	"Vendor software version"	"ID"	"Pt"	"Glucose meter device"	"Nom"		"DEVICES"	"SH"	"20050727"	"ADD"		"ACTIVE"			2										"N"		"; Software vers; Identifier; Ident; Point in time; Random; Glucose Mtr Dev; Nominal"	"Glucose Mtr Dev Software vers"	"Observation"					"Glucose meter device Vendor software version"										0	0	0	
./LOINCDB.TXT:"62852-9"	"PhenX - fasting plasma glucose for diabetes screening - glucometer protocol"	"-"	"Pt"	"^Patient"	"-"	"PhenX"	"PANEL.PHENX"	"PhenX"	"20110105"	"ADD"	"This protocol provides basic information for measuring blood glucose concentrations using a glucose meter or glucometer. Participants are asked to fast for at least 9 hours (generally overnight) prior to the test. If the 9-hour fast is not met, the Diabetes Working Group recommends that the test can still be completed as a ""casual"" glucose concentration (see protocol for casual glucose reference ranges for screening plus/minus Diabetes)."	"TRIAL"			2									"PhenX.140802"	"N"		"; Fast plasma gluc glucometer proto; Glu; Gluc; Glucoseur; Point in time; Random; SCN; Asymptomatic; Asympt"	"Fast plasma gluc glucometer proto"						"PhenX - fasting plasma glucose for diabetes screening - glucometer protocol"										0	0	0	

We have a few different types:

Fingerstick

Usually in mg/dL in US?

  1. For finger sticks (measured by glucometer; units = mg/dL?), you should probably be looking at LOINC code 41653-7 http://s.details.loinc.org/LOINC/41653-7.html . https://groups.google.com/forum/?fromgroups=#!topic/smart-app-developers/0fXhUp7rHDw

Aha! Thanks, ~@joshmandell!

CGM Display, vs sensor

how do we encode medical records?

@bewest
Copy link
Author

bewest commented May 20, 2013

How do I say:

A "glucose value" is a CodedResult? LabResult of LOINC-41653-7.
There is a medical record for patient @bewest.
The medical record for patient @bewest has a list of these *glucose values*:
  * ts, value
  * ts, value
  * ...

Eg, just a minimal graph to say here is a list of sugar values for this patient.
It turns out there are some interesting semantics to play with here... I think if I could get started with a few demo RDF sentences, everything would start to unravel... it would be nice for example to retain the provenance of how the data was collected. Eg:

Here is an auditing session of meter #xyz on date:
Which are labresults of LOINC... for patient *link to foaf*

Then I can upload all raw sessions, and if my API is SMART/triple aware, I can ask for a distinct set of results over time, while just uploading the full results of each auditing session.

@jmandel
Copy link

jmandel commented May 20, 2013

To say "here are two glucose values for bewest," you could do something like:

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix sp: <http://smartplatforms.org/terms#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

_:bewest a sp:MedicalRecord.

[] a sp:LabResult;
   sp:belongsTo _:bewest;
   dcterms:date "2013-04-01T12:12:00";
   sp:labName [
     a sp:CodedValue;
     sp:code <http://purl.bioontology.org/ontology/LNC/41653-7>
   ];
  sp:quantitativeResult [
    a sp:QuantitativeResult;
    sp:valueAndUnit [
    a sp:ValueAndUnit;
    sp:value "82";
    sp:unit "mg/dL"
    ]
  ].

[] a sp:LabResult;
   sp:belongsTo _:bewest;
   dcterms:date "2013-04-01T13:30:00";
   sp:labName [
     a sp:CodedValue;
     sp:code <http://purl.bioontology.org/ontology/LNC/41653-7>
   ];
  sp:quantitativeResult [
    a sp:QuantitativeResult;
    sp:valueAndUnit [
    a sp:ValueAndUnit;
    sp:value "95";
    sp:unit "mg/dL"
    ]
  ].

As for representing the auditing sessions, it's probably easiest to pick a representation that closely matches the actual device data (whatever that may be), and then later convert from there to whatever you need downstream. So up-front you might just capture something like:

[] a dm:AuditingSession;
   dcterms:date "2013-04-02T15:00:00";
   hasReading [
     a dm:FingerStickReading;
     dcterms:date "2013-04-01T13:30:00";
     dm:rawFingerStickValue "92" -- may even be expressed in some device-specific units?
   ], [
     a dm:FingerStickReading;
     dcterms:date "2013-04-01T18:30:00";
     dm:rawFingerStickValue "110"
  ], [
     a dm:FingerStickReading;
     dcterms:date "2013-04-02T09:00:00";
     dm:rawFingerStickValue "132"
  ]
].

@jmandel
Copy link

jmandel commented May 21, 2013

(Just added missing sp:belongsTo predicates to the 1st examples.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment