feat(integrations): add Oura Ring provider#454
feat(integrations): add Oura Ring provider#454vikohone wants to merge 5 commits intothe-momentum:mainfrom
Conversation
Implement full Oura Ring integration following the Strategy + Factory + Template pattern. Includes OAuth2 authorization flow, workout import with type mapping, 24/7 data collection (sleep, readiness, heart rate, daily activity, SpO2), and webhook endpoints for real-time notifications. Closes the-momentum#227 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address PR review feedback from the-momentum#446 (Strava PR): - Move all business logic from webhook routes to a dedicated service class (OuraWebhookService), keeping routes as thin handlers - Use log_structured() instead of logger.info/error f-strings for structured JSON logging with queryable attributes - Change oura_webhook_verification_token to SecretStr in config - Add timestamp parsing tests for the webhook service Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apply project code review checklist: - Replace all self.logger f-string calls with log_structured() in data_247.py (15 calls) and workouts.py (2 calls) - Fix type annotations: replace Any with DbSession and BaseProviderStrategy in webhook_service.py - Remove unused db: DbSession params from 3 subscription route handlers - Remove dead code: unused DataSourceRepository import and instance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hi @vikohone 👋 Thanks a lot for your contribution! Someone from our team will be able to verify the changes this week. Manual code review is still very important to us, because as you can see for example here: agents can still make a lot of mistakes - but in many cases, it's a matter of the Agents.md files not describing all the conventions we use, so we'll be updating them after going through the latest integration PRs. BTW, if you haven't joined our Discord yet, I highly recommend it! |
KaliszS
left a comment
There was a problem hiding this comment.
Hi. I have done rebasing job (also fixed linter issues), so you have to fetch origin, if you want to continue editing that branch (otherwise you may face new conflicts if you try to push more commits).
In general, we cannot confirm whether this works, because (right now) we don't have an access to any Oura Ring. Could you provid some screenshoots (or a video maybe) with an example of syncing data from Oura to Open Wearables frontend, please?
| } | ||
|
|
||
| @staticmethod | ||
| def _parse_data_timestamp( |
There was a problem hiding this comment.
Isn't that something that should be handled within utils/dates.py?
|
Hi @vikohone. Are you planning to continue work or should we take over this PR? |
Summary
Closes #227
New Files (15)
app/schemas/oura/— Pydantic models for all Oura API v2 responsesapp/constants/workout_types/oura.py— Activity string → WorkoutType mappingapp/services/providers/oura/— Strategy, OAuth, Workouts, 247 Data componentsapp/api/routes/v1/oura_webhooks.py— Webhook notification + subscription management endpointsapp/static/provider-icons/oura.svg— Provider icontests/providers/oura/— Test suite (5 test files)Modified Files (10)
factory.py— Register OuraStrategyconfig.py— Add Oura OAuth env vars.env.example— Document Oura env varsprovider_settings_service.py— Enable Oura in provider listroutes/v1/__init__.py— Register webhook routerschemas/__init__.py— Export Oura schema classesTest plan
pytest tests/providers/oura/ -vpytest tests/providers/test_provider_factory.py -vpytest tests/services/test_provider_settings_service.py -vpytest -v🤖 Generated with Claude Code