Skip to content

Deduplicate Dexcom Share readings to fix delta always zero#661

Open
bjorkert wants to merge 1 commit into
devfrom
fix/dexcom-duplicate-readings
Open

Deduplicate Dexcom Share readings to fix delta always zero#661
bjorkert wants to merge 1 commit into
devfrom
fix/dexcom-duplicate-readings

Conversation

@bjorkert
Copy link
Copy Markdown
Member

Summary

  • Dexcom Share returns each reading twice when both the iPhone Dexcom app and the Apple Watch app upload to the same Share account. The two copies arrive ~9–10 seconds apart with identical SGV values.
  • Without deduplication the two most recent entries in bgData were always identical, so delta = latestBG - priorBG = 0 every time.
  • The Nightscout fetch path already had inline deduplication (30-second / same-SGV filter). Extracted it into a shared helper deduplicateBGReadings(_:) and applied it to the Dexcom-only path as well.

Dexcom Share returns each reading twice when both the iPhone Dexcom
app and the Apple Watch app upload to the same account (~9-10 s apart,
same SGV). Without deduplication the two most recent entries in bgData
were always identical, producing delta = 0.

The NS fetch path already had inline deduplication. Extract it into a
shared helper (deduplicateBGReadings) and apply it to the Dexcom-only
path as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant