Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Categorical string values
In [16]: pandas.Series([e['data']['lastSGTrend'] for e in es]).value_counts()
Out[16]:
NONE 2425
DOWN 238
UP 159
DOWN_DOUBLE 76
UP_DOUBLE 63
dtype: int64
In [17]: pandas.Series([e['data']['sensorState'] for e in es]).value_counts()
Out[17]:
NORMAL 2844
UNKNOWN 65
WEAK_SIGNAL 34
WARM_UP 16
METER_BG 2
dtype: int64
# ^ from another dataset this can also be LOST_SENSOR
In [18]: pandas.Series([e['data']['conduitBatteryStatus'] for e in es]).value_counts()
Out[18]:
FULL 2033
HIGH 808
MEDIUM 120
dtype: int64
In [21]: pandas.Series([e['data']['calibStatus'] for e in es]).value_counts()
Out[21]:
LESS_THAN_NINE_HRS 1139
LESS_THAN_TWELVE_HRS 1060
LESS_THAN_SIX_HRS 541
LESS_THAN_THREE_HRS 138
UNKNOWN 65
DUENOW 18
dtype: int64
# Booleans
In [19]: pandas.Series([e['data']['conduitMedicalDeviceInRange'] for e in es]).value_counts()
Out[19]:
True 2863
False 98
dtype: int64
In [20]: pandas.Series([e['data']['conduitSensorInRange'] for e in es]).value_counts()
Out[20]:
True 2829
False 132
dtype: int64
# From my own tests, this remains false even when the device IS suspended.
In [27]: pandas.Series([e['data']['medicalDeviceSuspended'] for e in es]).value_counts()
Out[27]:
False 2961
dtype: int64
# Reservoir level and pump battery level are rounded to the nearest 25%
In [29]: pandas.Series([e['data']['reservoirLevelPercent'] for e in es]).value_counts()
Out[29]:
50 2107
75 764
0 65
25 18
100 7
dtype: int64
In [30]: pandas.Series([e['data']['medicalDeviceBatteryLevelPercent'] for e in es]).value_counts()
Out[30]:
75 2297
100 599
0 65
dtype: int64
# This seems worth doing something about... (digging in their JS suggests "MMOL_L" is the other value)
In [22]: pandas.Series([e['data']['bgUnits'] for e in es]).value_counts()
Out[22]:
MGDL 2961
dtype: int64
# Last alarm. Translations appear in https://gist.github.com/mddub/a95dc120d9d1414a433d
# "101" : "High SG. CHECK BG",
# "102" : "Low SG",
In [36]: pandas.Series([e['data']['lastAlarm']['type'] for e in es]).value_counts()
Out[36]:
ALARM 2961
dtype: int64
In [37]: pandas.Series([e['data']['lastAlarm']['code'] for e in es]).value_counts()
Out[37]:
101 1912
102 1049
dtype: int64
# This indicates the user's display preference, but all time strings are in 24 hour format
In [34]: pandas.Series([e['data']['timeFormat'] for e in es]).value_counts()
Out[34]:
HR_24 2961
dtype: int64
In [35]: pandas.Series([e['data']['sMedicalDeviceTime'] for e in es]).value_counts()
Out[35]:
Oct 18, 2015 16:33:00 7
Oct 19, 2015 03:53:00 7
Oct 18, 2015 06:58:00 6
Oct 17, 2015 00:15:40 6
Oct 18, 2015 05:14:01 5
Oct 19, 2015 11:24:45 5
...
# Active insulin... -1 indicates the Connect is not connected
In [57]: pandas.Series([e['data']['activeInsulin']['amount'] for e in es]).value_counts()
Out[57]:
0.000 956
0.050 109
0.025 95
-1.000 65
0.075 54
0.475 54
0.100 50
0.125 49
0.275 47
0.200 47
...
In [55]: pandas.Series([e['data']['conduitSensorInRange'] for e in es if e['data']['activeInsulin']['amount'] == -1]).value_counts()
Out[55]:
False 65
dtype: int64
In [56]: pandas.Series([e['data']['conduitMedicalDeviceInRange'] for e in es if e['data']['activeInsulin']['amount'] == -1]).value_counts()
Out[56]:
False 65
dtype: int64
# Confirming that these are unused (as of 2015-10-19)
In [23]: pandas.Series([e['data']['lastSensorTime'] for e in es]).value_counts()
Out[23]:
0 2961
dtype: int64
In [24]: pandas.Series([e['data']['medicalDeviceTime'] for e in es]).value_counts()
Out[24]:
0 2961
dtype: int64
In [25]: pandas.Series([e['data']['lastConduitTime'] for e in es]).value_counts()
Out[25]:
0 2961
dtype: int64
In [26]: pandas.Series([e['data']['lastSensorTS'] for e in es]).value_counts()
Out[26]:
0 2961
dtype: int64
# Sanity-checking integer values
In [31]: pandas.Series([e['data']['timeToNextCalibHours'] for e in es]).value_counts()
Out[31]:
8 447
7 413
10 375
11 370
9 315
6 279
5 240
4 156
3 145
2 111
0 83
1 27
In [28]: pandas.Series([e['data']['conduitBatteryLevel'] for e in es]).value_counts()
Out[28]:
100 1245
96 63
97 61
92 58
37 57
59 52
0 51
95 47
71 45
...
In [32]: pandas.Series([e['data']['sensorDurationHours'] for e in es]).value_counts()
Out[32]:
53 69
99 66
0 65
42 65
76 64
47 62
100 62
...
In [33]: pandas.Series([e['data']['reservoirAmount'] for e in es]).value_counts()
Out[33]:
78 265
55 247
95 220
94 187
77 139
47 137
80 125
87 125
...
# What's up with these *InRange fields?
In [7]: in_ranges = [' '.join(map(str, [a['conduitInRange'], a['conduitMedicalDeviceInRange'], a['conduitSensorInRange']])) for a in [b['data'] for b in es]]
In [8]: in_ranges[:5]
Out[8]:
['True True True',
'True True True',
'True True True',
'True True True',
'True True True']
# conduitInRange conduitMedicalDeviceInRange conduitSensorInRange
In [9]: pandas.Series(in_ranges).value_counts()
Out[9]:
True True True 972
True True False 12
True False False 10
False False False 6
dtype: int64
# here's an interesting value of "limits":
# User says they correspond to:
# 12 am 70-200
# 5:30am 70-180
# 2 pm 70-200
{
"limits" : [
{
"kind" : "Limits",
"index" : 0,
"version" : 1,
"highLimit" : 200,
"lowLimit" : 70
},
{
"lowLimit" : 70,
"highLimit" : 200,
"version" : 1,
"kind" : "Limits",
"index" : 60
},
{
"index" : 126,
"kind" : "Limits",
"highLimit" : 180,
"version" : 1,
"lowLimit" : 70
},
{
"index" : 228,
"kind" : "Limits",
"lowLimit" : 70,
"highLimit" : 200,
"version" : 1
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment