pazaan / 600SeriesAndroidUploader

Your Medtronic 600-series pump data, direct to Nightscout
http://pazaan.github.io/600SeriesAndroidUploader/
MIT License
189 stars 312 forks source link

Event marker #216

Closed st0ber closed 6 years ago

st0ber commented 6 years ago

I do not know if it's an error or the feature is not supported. If you enter a carbohydrate correction in the event marker in the pump (MM640g), it will not be displayed in nightscout. img_20180404_083802_141

Pogman commented 6 years ago

Event markers are not currently supported.

st0ber commented 6 years ago

OK, thanks Pogman for your hard Work.

Pogman commented 6 years ago

You can keep this open if you like, there may be users that want this feature and make good use of it. I can add a enhancement request for future work reference.

st0ber commented 6 years ago

OK, thank you.

cfaagaard commented 6 years ago

Maybe a little help (have done some data mining)

there are four markers in the pump-history. The first 8 bytes is a timestamp (rtc/offset) as we know it. The markers have different bytes after this.

EXERCISE_MARKER (int16 - duration in minutes) INJECTION_MARKER (Int32 - insulin_raw. divide with 10000) FOOD_MARKER (byte - CarbUnit (grams(0)/exchange(1)), Int16 - carb) OTHER_MARKER (no other info)

For Nightscout-json:

EXERCISE_MARKER: { .... "eventType": "Exercise", "duration": 30 ..... }

INJECTION_MARKER: { ... "eventType": "Correction Bolus", "insulin": 3.225 ..... }

FOOD_MARKER: { ... "eventType": "Meal Bolus", "carbs": 10, .... }

OTHER_MARKER: ?? what is this for :-)

Pogman commented 6 years ago

@cfaagaard thanks, already had them sorted out :) got the 'pump daily totals' too if your need them.

cfaagaard commented 6 years ago

@Pogman Ooooh yes please. It has been on my todo-list for a while. Please share :-)

cfaagaard commented 6 years ago

@Pogman Do you use the daily totals for something in NS?

Pogman commented 6 years ago

They will uploaded in the next version. Not using the data for anything as such but it is interesting as there are variations in the totals on the pump and NS due to pumps 4 second daily drift.

ns-daily-totals

Pogman commented 6 years ago

The 670G is incomplete, I need to get hold of a Carelink excel file of someone for that.

EventType.DAILY_TOTALS

     ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?A ?B ?C ?D ?E ?F
0x00 CR CR CR CR CO CO CO CO CD CD BG BA BA BL BL BH
0x10 BH MG MA MA ML ML MH MH BV BV TD TD TD TD TB TB
0x20 TB TB PB TI TI TI TI PI WW WA WA WB WC WC WC WC
0x30 WD WD WD WD WE WE WE WE WF WF WF WF WG WH WI WJ
0x40 ST ST SA SA SD SD SX SX SH SY SY SI SZ SZ SL SK
0x50 SK AA AA AB AB AC AC AD AD AE AE AF AF AG AG AH
0x60 AH

CR = RTC
CO - OFFSET
CD = DURATION (mins)

BG = METER_BG_COUNT
BA = METER_BG_AVERAGE (mg/dL)
BL = LOW_METER_BG (mg/dL)
BH = HIGH_METER_BG (mg/dL)
MG = MANUALLY_ENTERED_BG_COUNT
MA = MANUALLY_ENTERED_BG_AVERAGE (mg/dL)
ML = LOW_MANUALLY_ENTERED_BG (mg/dL)
MH = HIGH_MANUALLY_ENTERED_BG (mg/dL)
BV = BG_AVERAGE (mg/dL)

TD = TOTAL_INSULIN (div 10000)
TB = BASAL_INSULIN (div 10000)
PB = BASAL_PERCENT
TI = BOLUS_INSULIN (div 10000)
PI = BOLUS_PERCENT

WW = CARB_UNITS
WA = TOTAL_FOOD_INPUT
WB = BOLUS_WIZARD_USAGE_COUNT
WC = TOTAL_BOLUS_WIZARD_INSULIN_AS_FOOD_ONLY_BOLUS (div 10000)
WD = TOTAL_BOLUS_WIZARD_INSULIN_AS_CORRECTION_ONLY_BOLUS (div 10000)
WE = TOTAL_BOLUS_WIZARD_INSULIN_AS_FOOD_AND_CORRECTION (div 10000)
WF = TOTAL_MANUAL_BOLUS_INSULIN (div 10000)
WG = BOLUS_WIZARD_FOOD_ONLY_BOLUS_COUNT
WH = BOLUS_WIZARD_CORRECTION_ONLY_BOLUS_COUNT
WI = BOLUS_WIZARD_FOOD_AND_CORRECTION_BOLUS_COUNT
WJ = MANUAL_BOLUS_COUNT

ST = SG_COUNT
SA = SG_AVERAGE (mg/dL)
SD = SG_STDDEV (mg/dL)
SX = SG_DURATION_ABOVE_HIGH (mins)
SH = PERCENT_ABOVE_HIGH
SX = SG_DURATION_WITHIN_LIMIT (mins)
SI = PERCENT_WITHIN_LIMIT
SZ = SG_DURATION_BELOW_LOW (mins)
SL = PERCENT_BELOW_LOW
SK = LGS_SUSPENSION_DURATION (mins)

AA = HIGH_PREDICTIVE_ALERTS
AB = LOW_PREDICTIVE_ALERTS
AC = LOW_BG_ALERTS
AD = HIGH_BG_ALERTS
AE = RISING_RATE_ALERTS
AF = FALLING_RATE_ALERTS
AG = LOW_GLUCOSE_SUSPEND_ALERTS
AH = PREDICTIVE_LOW_GLUCOSE_SUSPEND_ALERTS

EventType.CLOSED_LOOP_DAILY_TOTALS

     ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?A ?B ?C ?D ?E ?F
0x00 CR CR CR CR CO CO CO CO CD CD BG BA BA BL BL BH
0x10 BH -- -- TD TD TD TD TB TB TB TB PB TI TI TI TI
0x20 PI -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
0x30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
0x40 -- -- ST ST SA SA SD SD SX SX SH SY SY SI SZ SZ
0x50 SL SK SK -- -- -- -- -- -- -- -- -- -- -- -- --
0x60 -- -- -- -- -- -- --

CR = RTC
CO - OFFSET
CD = DURATION (mins)

BG = METER_BG_COUNT
BA = METER_BG_AVERAGE (mg/dL)
BL = LOW_METER_BG (mg/dL)
BH = HIGH_METER_BG (mg/dL)
MG = MANUALLY_ENTERED_BG_COUNT
MA = MANUALLY_ENTERED_BG_AVERAGE (mg/dL)
ML = LOW_MANUALLY_ENTERED_BG (mg/dL)
MH = HIGH_MANUALLY_ENTERED_BG (mg/dL)
BV = BG_AVERAGE (mg/dL)

TD = TOTAL_INSULIN (div 10000)
TB = BASAL_INSULIN (div 10000)
PB = BASAL_PERCENT
TI = BOLUS_INSULIN (div 10000)
PI = BOLUS_PERCENT

ST = SG_COUNT
SA = SG_AVERAGE (mg/dL)
SD = SG_STDDEV (mg/dL)
SX = SG_DURATION_ABOVE_HIGH (mins)
SH = PERCENT_ABOVE_HIGH
SX = SG_DURATION_WITHIN_LIMIT (mins)
SI = PERCENT_WITHIN_LIMIT
SZ = SG_DURATION_BELOW_LOW (mins)
SL = PERCENT_BELOW_LOW
SK = LGS_SUSPENSION_DURATION (mins)
pazaan commented 6 years ago

You can't get CSV's for 670's 😞. CareLink does not make CSV's available if you upload a 670G.

cfaagaard commented 6 years ago

@Pogman Thanks a lot! I will give it a go.

pazaan commented 6 years ago

Oh! But I can give you the protocol breakdown for that event...

Pogman commented 6 years ago

@pazaan cool, it's nice data to have available for those that like the details

pazaan commented 6 years ago

@Pogman sent to you on Gitter.

cfaagaard commented 6 years ago

@Pogman Just a hint (maybe you know this): you can html-format notes. So you could make daily total more readable :-) Example with table: image EDITED: json: { "_id": { "$oid": "5acd3c9fb30d552c4a83f97e" }, "enteredBy": "", "eventType": "Note", "reason": "", "duration": 0, "notes": "Daily total<br><table><tr><th>Firstname<\/th><th>Lastname<\/th><th>Age<\/th><\/tr><tr><td>Jill<\/td><td>Smith<\/td><td>50<\/td><\/tr><tr><td>Eve<\/td><td>Jackson<\/td><td>94<\/td><\/tr><\/table>", "created_at": "2018-04-10T22:37:19.909Z" }

maybe more like this (from the old carelink report) image

Pogman commented 6 years ago

@cfaagaard my concern with doing stuff like that, which would be nice btw, is any knock on effect in other areas like the reports and then on other devices and browsers.

Pogman commented 6 years ago

Actually had a quick mess with that, worth pursuing but with an 'formating' option in case there are issues in wild.

Tests: very quick prototype here and thanks for the hint ;)

ns-daily-totals-format-test1

ns-daily-totals-format-test2

cfaagaard commented 6 years ago

@Pogman Looking good!

Pogman commented 6 years ago

Well... could be an issue with this as there is a very hard limit on the size of a treatments note entry due to it being a index key in mongo.

Also a quick code based test is double serialising the json and that could be the uploader doing it once and then NS doing it again before sending it on to the db.

This means things like </table> become <\\/table> in the db rather then just <\/table>
cfaagaard commented 6 years ago

hmmm.... I see your point.

Pogman commented 6 years ago

The double serialising thing is an artefact of string handling in the uploader java and not NS so that can be sorted, just have to be careful with the size of the note - so still on.

Pogman commented 6 years ago

And something that works now in the code... pita too to get all that data formated with the index key size limitation and looking decent (In fairness I kinda get a kick out of that sort of thing being a bit old school)

I would have liked a bit more space between items but those tags add up fast.

ns-daily-formated

cfaagaard commented 6 years ago

Looking good! So much better. Suggestion: (now that we are having fun the old school way. lol) Maybe you could show the insulin column with two rows (colored/grayed) representing basal and bolus and the height of the rows representing the percentage for basal and bolus (27%/73%). Maybe the same thing for the sensor (high/low/within) (same coloring as in the graph)

I know, it begins to smell a bit like a report :-)

Pogman commented 6 years ago

There is just no space for anything , there was barely enough to do some minimal formatting after just the text headings and data points.