Reading Diabetes Data from Tidepool into MATLAB

Here’s what I did over the weekend with the help of my awesome coworker Kelly.

email = 'your email address';
password = 'your password';
cmd = sprintf('curl -I -X POST -u %s:%s', email, password);
[status, loginResult] = system(cmd);
result = regexp(loginResult, 'x-tidepool-session-token: (?<token>[a-z_A-Z0-9\.]*)\s', 'names');

opt = weboptions('KeyName', 'x-tidepool-session-token', 'KeyValue', result.token, 'MediaType', 'application/json');

query = sprintf('METAQUERY WHERE emails CONTAINS %s QUERY TYPE IN activity, basal, bloodKetone, bolus, cbg, cgmSettings, deviceEvent, deviceMeta, food, grabbag, note, pumpSettings, settings, smbg, upload, wizard', email);

data = webwrite('', query, opt);

Yup that’s (almost?) all of my diabetes data from Medtronic Carelink, which I uploaded to Tidepool. Yay!

This entry was posted in Data-betes, Diabetes, Fodder for Techno-weenies, MATLAB. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>