pazaan / 600SeriesAndroidUploader

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

No IOB on backfills #223

Open whooze opened 6 years ago

whooze commented 6 years ago

I realise that the IOB is what the pump says it is.

My question is if it's possible to generate the IOB on backfills.

I guess there's no use for this in day-to-day operation, but could come in handy when it comes to tools/features in NightScout. (New tool that I think many could benefit from is on it's way)

On the Reports the COB is being generated and the IOB comes from the pump... See this pic for more details.

image

Pogman commented 6 years ago

IOB only exists in the live data and is not available as part of the pumps history as far as I know.

Potentially it could be simulated and would need to be modelled on whatever the pump uses. This would be quite involved as the pump as a whole would need simulating to account for all active insulin.

pazaan commented 6 years ago

Bolus Wizard events, and Bolus events all have an iob component, so we can definitely get data from those historical events.

pazaan commented 6 years ago

Search for iob in https://github.com/tidepool-org/chrome-uploader/blob/pazaan/medtronic600-adhoc-pairing/lib/drivers/medtronic600/NGPHistoryParser.js

Pogman commented 6 years ago

Those are only snapshots though and fairly infrequent. The momentary modelling is the awkward bit.

Pogman commented 6 years ago

And in a 'not enough coffee' moment... we don't need to simulate the pump just the bolus insulin decay model.

Pogman commented 6 years ago

Some thoughts on extracting Medtronics active insulin model:

Set the DIA 'active insulin time' to the max of 8 hours. Eat some carb to cover a useful amount of insulin and take said insulin, 5 units lets say. Run it overnight. Pull all the IOB values from the status message (maybe run this every minute). Should get a nice curve with good resolution out of that.

To recreate the missing IOB for NS: for each 5 min sample, take each potentially active bolus in the previous 8 hours and transform from model (normalised to user DIA) and adjusted for time point and sum them up.

pazaan commented 6 years ago

Wouldn't it depend on the type of insulin being used? Aren't we better off with the published spline calculations for the various insulin types, and "squishing" them based on DIA?

Pogman commented 6 years ago

There's no option on the pump for type of insulin used, at least the 640G and I don't remember there being an option on any of the older pumps too.

There's no reason not to allow for advanced users to tweak the curve used for IOB in NS bypassing the IOB the pump uses.

pazaan commented 6 years ago

Yep, I meant in the app, not in the pump 😉

Cindbar commented 6 years ago

Am Mittwoch, 6. Juni 2018, 04:16:49 CEST schrieb Pogman:

There's no option on the pump for type of insulin used, at least the 640G and I don't remember there being an option on any of the older pumps too.

Menu / Insulin Settings / Bolus Wizard Setup / Active Insulin Time is the 640G option for type of insulin.

Pogman commented 6 years ago

@Cindbar they're not the same thing - that's the DIA time

whooze commented 6 years ago

If it's possible to use the DIA component that @pazaan and calculate DIA on backfill-events it would probably be good enough. As soon as the pump is having connection with the uploaded the IOB-value from the pump can step in and over-ride the generated IOBs.

Pogman commented 6 years ago

At a minimum it needs to mirror the pump. The DIA is a component as is the curve and the curve used by Medtronic can be got and should be used. This is important for people that use large amounts of insulin, some use in the range of 100-200 units per day and some have very long insulin duration times, these factors can compound errors quickly.