feat: Open Wearables integration proof-of-concept#345
Draft
travis-sauer-oltech wants to merge 9 commits intomainfrom
Draft
feat: Open Wearables integration proof-of-concept#345travis-sauer-oltech wants to merge 9 commits intomainfrom
travis-sauer-oltech wants to merge 9 commits intomainfrom
Conversation
- POST /api/v1/ow/users: create/find user in Open Wearables, store OW user_id - GET /api/v1/ow/oauth/oura/authorize: proxy Oura OAuth through OW - ow-client.js: implement steps 1-8 (parse invite, token exchange, OW user creation, Oura auth redirect) - common.js: extract parseInvitationCode and exchangeCodeForToken utilities - launch.html: replace TODO comments with actual implementation Ref #331
Add 16 unit tests covering: - TestCreateOwUser: auth, settings validation, user creation, conflict handling, error cases - TestOuraAuthorize: auth, user validation, settings, URL retrieval, redirect_uri, errors - TestOwConfig: missing/partial settings All tests pass with DRF camelCase response rendering.
… names in OW client JS - common.js: Use window.location.origin for token endpoint instead of bare host (which lacks protocol prefix) - ow-client.js: Use /auth/callback redirect_uri to match Grant's stored URI - ow-client.js: Use camelCase property names (owUserId, authorizationUrl) to match DRF CamelCaseJSONRenderer output
- Add provider picker grid UI in launch.html - Generalize oura_authorize → provider_authorize (any provider) - Add list_providers proxy endpoint - Add provider_callback_proxy for any provider - Update complete.html with success UI - Update ow-client.js with provider grid rendering and selection
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a complete proof-of-concept integration between JupyterHealth Exchange (JHE) and Open Wearables (OW), enabling patients to connect wearable devices (Oura, Garmin, etc.) through JHE's existing invite-link flow.
What Changed
Backend - Proxy API (
core/views/ow.py)/api/v1/ow/usersow:<user_id>in JHE identifier field/api/v1/ow/providers/api/v1/ow/oauth/<provider>/authorize/api/v1/oauth/<provider>/callbackConfig is read from
JheSettingDB records (ow_api_base_url,ow_api_key).Frontend - Client Flow (
core/static/js/)common.js- New shared utilities:parseInvitationCode(),exchangeCodeForToken(),base64UrlEncode()ow-client.js- Full client-side orchestration:Templates
base_ow_client.html- Base template with Bootstrap 4, Bootstrap Icons, common scriptslaunch.html- Landing page with status spinner, provider picker grid, integration log panelcomplete.html- Success page after OAuth completionURL Routes
/ow/- Launch page (invite link entry point)/ow/complete- Post-OAuth completion pageIntegration Log Panel
Terminal-style debug panel rendered during the flow showing:
End-to-End Flow
/ow/?code=<invitation_code>Test Coverage
tests/test_ow_integration.py- 257 lines covering:Files Changed
core/views/ow.pycore/static/js/ow-client.jscore/static/js/common.jscore/templates/ow_client/launch.htmlcore/templates/ow_client/complete.htmlcore/templates/partials/base_ow_client.htmlcore/templates/partials/base.htmlcore/urls.pycore/views/common.pytests/test_ow_integration.py