Skip to content

Add DuckDB support for CareLink persistent data storage - #37

Open
albycrescini wants to merge 1 commit into
ondrej1024:mainfrom
albycrescini:albycrescini/duckdb
Open

albycrescini wants to merge 1 commit into
ondrej1024:mainfrom
albycrescini:albycrescini/duckdb

Conversation

@albycrescini

Copy link
Copy Markdown

Add persistent DuckDB storage to the proxy

CareLink responses normally expose only a rolling history window of about 24 hours. Persisting each successful proxy download preserves readings and pump events after they leave that window.

DuckDB is used because it is embedded and file-based: the proxy can write a local database without operating a separate database server. It also supports SQL queries over the retained snapshots and history when analysis is needed.

Changes

  • Add duckdb as a Python dependency.
  • Add CareLinkStorage, which stores complete API responses in carelink_snapshots and de-duplicated history records in carelink_history.
  • Persist successful proxy downloads before updating the HTTP response.
  • Add --database to select the database path; by default, carelink.duckdb is created beside the token file.
  • Ignore local DuckDB database and WAL files.
  • Document installation and storage behaviour in the README.

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