Install mmistorytools and add to your openaps project by following the instructions at mmhistorytools
$ sudo easy_install openapscontrib.mmhistorytools
$ openaps vendor add openapscontrib.mmhistorytools
$ openaps device add history mmhistorytools
Add a report for the prepare
command shortcut, using the raw pump history and basal profile as inputs
$ openaps report add raw-pump/pump-history-prepared.json JSON history prepare raw-pump/pump-history-raw.json --basal-profile raw-pump/selected-basal-profile.json
Change the definition of the monitor/pump-history.json
report to take the prepared pump history as input [TODO add command here prob openaps report remove, followed by openaps report add ...]
- Change
oref0 calculate-iob
to accept new format of input filepump-history.json
- Change the report
nightscout/recent-treatments.json
to accept new format of input filepump-history.json
(or keep the old one if this makes more sense) - Change alias monitor-pump-history to invoke the new report
raw-pump/pump-history-prepared.json
- Consider whether it makes sense to edit the openaps templates (for use with
oref0-mint
) - Think about the integral method to calculate iob based on square wave:
If there is an insulin bolus of 1U at time zero, the iob contribution from this bolus at time t is given by the funtion f(t). If there is a square wave delivery of 1U/hr for T hours, ending at time zero, the iob contribution from thie bolus at time t is given by the function g(t) We can show that g(t) = I(t)(t+T) f(tau)dtau In other words, if a square wave delivery ended a time of t hours ago, to get its IOB contribution, integrate the normal insulin decay curve from t to t + T, where T is the width of the square wave
It is important that integrating mmhistorytools doesn't break anyone's rig. For this reason, it probably makes sense to have some kind of setting (prefences.json
?) to indicate that we want to use the mmhistorytools versions of the oref0 code. Alternatievly, we can probably interrogate pump-history.json to find out what kind it is.