Artificial-Pancreas / iAPS

MIT License
174 stars 719 forks source link

BG not displayed in IAPS though present in log and received by dexcom g7 app #490

Open francesc0-cgm opened 8 months ago

francesc0-cgm commented 8 months ago

Using dev 2.7.0, on an Iphone 15, Omnipod Dash and G7 sensor with direct uploading to NS without Bridge.

Some BG values are taken by dexcom g7 app, not shown in IAPS with >5 min stale data without enacting loop cycle, though present in IAPS log.

here is the log. Example of issue at 15:42:46

log.txt

Jon-b-m commented 8 months ago

I can see from your logs that the glucose Observer finds a new glucose first at the next CGM reading at:

"New glucose found 2024-01-15T15:47:45+0100 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 52 - DEV: start storage glucose"

and then saves it. You'll only see the glucose in Home view after it's saved to glucoseStorage.

Not sure why exactly this glucose reading was skipped here.

How does your stats look regarding the number of readings and the number of loops? This is the best objective test of fetched CGM readings in iAPS. Please check out the statistics view.

francesc0-cgm commented 8 months ago

Successful BGs are about 97% in a month, issue happens often at school where his phone stays on teacher desk.

I noticed that G7 sometime seems to send BG for a much longer window than G6, for example when you come back next to your iphone restoring BT Connection, dexcom g7 app will show BG a bit later. Iaps glucosefetching service has a settable timeout to have more time to use a "late received" BG?

widmann commented 3 months ago

I am experiencing the same or a similar problem with a higher frequency. I'm missing 30-50 readings a day. I do not see a systematic pattern yet.

The readings are recorded in the logs:

2024-06-06T00:57:01+0200 [DeviceManager] DexcomSourceG6.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 78 - DEV: device Manager for Optional("88BWHM") : Connected
2024-06-06T00:57:01+0200 [DeviceManager] DexcomSourceG6.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 78 - DEV: device Manager for Optional("88BWHM") : New reading: 2024-06-05 22:56:54 +0000
2024-06-06T00:57:01+0200 [DeviceManager] DexcomSourceG6.swift - processCGMReadingResult(_:readingResult:completion:) - 145 - DEV: DEXCOM - Process CGM Reading Result launched with newData([LoopKit.NewGlucoseSample(date: 2024-06-05 22:56:54 +0000, quantity: 117 mg/dL, condition: nil, trend: Optional(LoopKit.GlucoseTrend.flat), trendRate: Optional(0.2 mg/min·dL), isDisplayOnly: false, wasUserEntered: false, syncIdentifier: "88BWHM 1309574", syncVersion: 1, device: Optional(<<HKDevice: 0x30757bc50>, name:CGMBLEKit, manufacturer:Dexcom, model:G6, software:21.0, UDIDeviceIdentifier:00386270000385>))])
2024-06-06T00:57:01+0200 [DeviceManager] DexcomSourceG6.swift - cgmManager(_:hasNew:) - 108 - DEV: DEXCOM - Direct return done

However, they are not processed as in successful loops:

2024-06-06T01:02:03+0200 [DeviceManager] FetchGlucoseManager.swift - glucoseStoreAndHeartDecision(syncDate:glucose:glucoseFromHealth:) - 131 - DEV: New glucose found
2024-06-06T01:02:03+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 52 - DEV: start storage glucose
2024-06-06T01:02:03+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 95 - DEV: start storage cgmState

The problem is relatively annoying. Is this expected behavior? In case it is not, I would be happy to do some testing or provide more information.

The number of readings and the number of loops are mostly the same. If there is a small difference, it is much smaller than the number of missed readings. Currently both are 123, but there are 138 Dexcom readings ("78 - DEV: Device Manager for Optional("88BWHM") : Connected") in the log.

My CGM is Dexcom G6, pump is Dana-i, I'm using the latest version of the Dana branch (5d0e36b), but the problem has been occurring since I started using iAPS with version 3.4.0.

Thanks for looking into this!

widmann commented 3 months ago

Last night the problem was especially bad. Almost half of the Dexcom readings were received (in the logs) but not processed (screenshots attached).

This problem makes the system unusable for me due to lack of trust. Do you think this problem can be fixed or do I have to live with it? In the latter case I would seriously consider switching back with a very heavy heart. I was really happy to hear about iAPS and Dana support.

image1 image0