Skip to content

Add Fitbit API sleep import #52

Open
wellivea1 wants to merge 2 commits intosleepdiary:mainfrom
wellivea1:codex/fitbit-api-import
Open

Add Fitbit API sleep import #52
wellivea1 wants to merge 2 commits intosleepdiary:mainfrom
wellivea1:codex/fitbit-api-import

Conversation

@wellivea1
Copy link
Copy Markdown

This was done entirely in Codex with GPT 5.4. I apologize for any mistakes. This tool is necessary for my medical care and it was no longer being actively maintained, I might as well share this as it works.

Summary

  • add Fitbit Web API JSON parsing to the Fitbit engine
  • support wrapped browser-backup JSON and archived sleep-*.json files
  • keep imported API records aligned with the legacy Fitbit CSV timeline behavior
  • add tests covering API JSON, wrapped JSON, fitbit-n24-style JSON, and archive JSON

Why

The dashboard can now fetch sleep data directly from the Fitbit API, but upstream core only understands the legacy Fitbit CSV export. This adds direct JSON support so hosted dashboard imports do not need a compatibility shim and continue to plot records consistently with the existing CSV importer.

Testing

  • parser cases added in src/Fitbit/test.js
  • syntax-checked updated files locally
  • verified that API-shaped records normalize to the same effective timeline the legacy CSV importer uses

@wellivea1
Copy link
Copy Markdown
Author

This enables the paired dashboard import flow in sleepdiary/dashboard#84.

@wellivea1
Copy link
Copy Markdown
Author

Added Google Health as an option due to the Fitbit API being deprecated this year. It has a working fallback in case you want the user to provide the Client ID.

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