oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

Reset cannula age (CAGE) in Nightscout upon filling cannula

Open inventor96 opened this issue 6 years ago • 11 comments

Is your feature request related to a problem? Please describe. The CAGE pill in Nightscout currently requires a manual entry of a "Pump Site Change" treatment event. I feel like it's safe to assume a site change has occurred when a cannula is filled. A toggle value in preferences.json could be added (defaulted to true) for the few people where this is not the case.

Describe the solution you'd like When a cannula filling has been detected, a "Pump Site Change" event should be sent to Nightscout using the same timestamp as the cannula filling.

Describe alternatives you've considered A work-around using IFTTT and Google Sheets has been described in https://github.com/nightscout/cgm-remote-monitor/issues/3490

inventor96 avatar Nov 04 '19 19:11 inventor96

Have you looked into how exactly this should be done? Which exact pumphistory record denotes "when a cannula is filled"? Would you want something in oref0 ns-loop to create a corresponding "Pump Site Change" treatment when it sees that record and upload them both to NS? Or something else?

scottleibrand avatar Nov 04 '19 19:11 scottleibrand

@scottleibrand I'm thinking a "Fixed Prime" >0 would indicate filling the cannula. I have a Medtronic 722, so I don't know if the options are named or show up different for other pumps. I'm not too familiar with all the moving parts of openaps yet to know where the functionality would be implemented, but using ns-loop as you described makes sense.

inventor96 avatar Nov 04 '19 20:11 inventor96

So if you wanted to implement it that way, you could create a new preference called something like "prime_indicates_site_change", and then add code to check for that preference, and if it's present, run a script that parses pumphistory.json for primes without a corresponding "Pump Site Change" event and generates the corresponding record when missing. The closest thing we have to that today is probably the "rewind resets autosens" preference.

scottleibrand avatar Nov 04 '19 21:11 scottleibrand

FWIW we sometimes fill the reservoir without changing the cannula, so there’s no 1:1 correlation to this event and cannula actually being changed so I don’t think this should not be relied on as a proof

sulkaharo avatar Nov 04 '19 21:11 sulkaharo

It should definitely be a preference since people's site-change behaviors differ. Not sure if it should default to true or false. Or maybe we could piggyback on the existing rewind_resets_autosens preference?

scottleibrand avatar Nov 04 '19 21:11 scottleibrand

@sulkaharo The same condition would apply for a battery change; a rewind and prime is required, but the cannula fill is not. At least for the 722, the fixed prime seems to only be used for filling a cannula, whereas the manual prime is used for the cases you and I brought up. Each type of prime is listed separately, which is why I was thinking to use the fixed prime and make it a preference. Are there any other patterns to consider during development of this?

inventor96 avatar Nov 04 '19 22:11 inventor96

without a corresponding "Pump Site Change" event and generates the corresponding record when missing.

@scottleibrand @sulkaharo Being new to contributing to oref0 (and still learning node), could one of you answer a couple questions to help me get started:

  1. Where would I check for corresponding "Pump Site Change" events? Are those downloaded locally, or would I have to check in with NS first?
  2. Where and what kind of script (js or sh) would I create?
  3. Is there an example of the respective kind of script I can look at to show me how to create new events that get sent to NS?

inventor96 avatar Nov 05 '19 02:11 inventor96

@inventor96 FWIW - I have used fixed prime for things other than priming a new cannula, because that this is the only way to get a measured amount of insulin out of the pump without oref0 tracking it. e.g. If I was disconnected from the pump for a while and the rig does not know that I did not receive the insulin.

straykatz avatar Nov 11 '19 01:11 straykatz

I have used fixed prime for things other than priming a new cannula

@straykatz Is there combination of specific events that indicate exclusively a new cannula? e.g. a manual prime followed by a fixed prime within 5 minutes?

inventor96 avatar Nov 11 '19 01:11 inventor96

^^^ that would be fair most of the time, but it isn’t. Like yesterday, while flashing multiple chips, I had 2 pumps out. The second/reserve pump had been left on, and had “emptied” the non-existing reservoir. In order to make it ready to be talked to by the new chip, I primed it with the infusion set of the production pump. If there would be more than a few minutes where the production pump was without reservoir, I would have used a small fixed prime on the production pump ...

I think those are rare cases, and I see a convenience benefit in not having to hit the shortcut to add the set change to Nightscout. I personally would not be too worried about having a false set change in NS - if a set is bad, it’s bad, no matter the age, and most of the time the info would be correct. Not sure if it would be ok for others, e.g. parents of kids who might hate to do a set change, but if you make that a pref that defaults to “turned off”, people can make up their mind. I would probably turn it on - I dislike the red colored SAGE enough :-)

straykatz avatar Nov 15 '19 00:11 straykatz

i'd hard coded this previously but updated to be optional preference. https://github.com/openaps/oref0/pull/1409

Foxy7 avatar Sep 22 '21 22:09 Foxy7