Skip to content

Local exports (CSV / report / JSON) are uncalibrated while Nightscout/xDrip get calibrated values #130

Description

@rasc0030

I noticed an asymmetry in how software calibration reaches different outputs:

Live outputs (Nightscout, xDrip, notification, widget, on-screen) apply the software calibration on the fly, on a copy (resolveExportedValueMgdl → getCalibratedValue) — the stored reading stays raw.
On-device file exports ("Export Complete CSV", "Export Readable Report", "Save to Files" / JSON) read the raw stored history directly (HistoryExporter / ExportPackageExporter), so they come out uncalibrated.
Net effect: the value that lands in Nightscout — arguably the "official" record — doesn't match a local CSV/backup. Concretely, a CSV can show a hypo that never appeared on screen or in Nightscout.

I also saw that the "Write calibrated values" toggle (overwriteSensorValues), which would make exports calibrated, is commented out in the UI (commit "Calibration overwrite disabled"). Its backend rewrites the stored values in place destructively and irreversibly, so I understand the hesitation to expose it.

Questions:

What's the reasoning for keeping file exports raw while live uploads are calibrated?
Was the overwrite toggle disabled specifically because of the destructive at-rest rewrite?

Suggestion:

Export both non-destructively. Instead of the at-rest rewrite, apply the same emit-time projection in the file exporters (exactly what Nightscout already does), keeping stored data raw. Ideally the exports carry both a raw column and a calibrated column. That reconciles local exports with Nightscout without losing the raw archive or the reversibility of software calibration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions