Repository navigation
Conversation
Part of oss-slu#151. Define the integration boundary, provenance and permission rules for optional connected-health imports: - IntegrationConnection stores a user's explicit, read-only grant per provider and measurement type; allows() is the permission check. - ImportedMeasurement requires provider, connection, unit and recorded_at so every value keeps its source and timestamp. - integrations.py holds the provider registry and adapter protocol so pages and endpoints never depend on provider-specific code. - INTEGRATIONS_ENABLED flag (off by default) keeps integrations optional. - Endpoints to list providers, list own connections, and grant a connection, with tests and docs/integrations.md.
|
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
Defines a provider-neutral integration layer for optional connected-health imports, so imported values always record their source and timestamp, and users grant access one measurement type at a time.
Closes #202
Part of #151
Changes Made
IntegrationConnection, which stores a user's explicit, read-only grant for one provider and a list of measurement types.allows(type)is the single permission check, and it is false for any type not granted or once the connection is disconnected.ImportedMeasurement, which requiresprovider,connection_id,unitandrecorded_at, so a value without provenance cannot be saved.src/integrations.pywith a provider registry (PROVIDERS) and anIntegrationAdapterprotocol, so pages and endpoints never depend on provider-specific code. Apple Health and Health Connect are registered with plain-language limitations (neither has a web API).INTEGRATIONS_ENABLEDflag, off by default, so integrations stay optional and core features never depend on them.GET /api/v1/integrations/providers, which returns{ enabled, providers }, with an emptyproviderslist while the flag is offGET /api/v1/users/me/connections, which lists the user's own connections and is not gated by consent or the flag, so users can always see what is connectedPOST /api/v1/users/me/connections, which grants or replaces a connection and requires health consent and the flagINTEGRATIONS_DISABLED,UNKNOWN_PROVIDER,UNSUPPORTED_MEASUREMENT_TYPEandVALIDATION_ERROR.docs/integrations.mdcovering principles, architecture, data model, permission rules, API and how to add a provider.Testing
.env.Checklist
Additional Notes
INTEGRATIONS_ENABLEDis off, which is the default.