Add HealthKit integration, FHIR normalization, dashboard redesign, and clinical records#8
Merged
Add HealthKit integration, FHIR normalization, dashboard redesign, and clinical records#8
Conversation
The MEDICAL_HISTORY step was added to OnboardingStep enum and ONBOARDING_FLOW but never added to the DevToolBar path map, causing a crash when navigating back from BASELINE_SURVEY. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…leep, and vitals This is a major feature commit that adds full HealthKit data querying capabilities for the HomeFlow BPH study, including daily activity tracking, sleep stage analysis, and Apple Watch vitals collection. New Features: - Daily activity queries: steps, exercise/move/stand minutes, sedentary time estimation - Sleep queries with iOS 16+ stage support (Awake/Core/Deep/REM) and legacy fallback - Vitals queries: heart rate stats, resting HR, HRV (SDNN), respiratory rate - Date range utilities for bucketing health samples by day - Debug panel UI for testing 7/30 day data fetches - Detailed permission status tracking New Types: - DailyActivityDay, SleepNight, SleepStage enum, VitalsDay - PermissionResult with granted/denied/notDetermined arrays - Query result types (DailyActivityResult, SleepResult, VitalsResult) API Additions: - getDailyActivity(range), getSleep(range), getVitals(range) - getDateRange(days), date bucketing utilities - HealthKitService.querySleepSamples() for category type queries - HealthKitService.requestAuthorizationWithStatus() for detailed permissions Testing: - 75 tests covering date utilities, sleep stage mapping, sedentary calculation Note: Sedentary time is approximated as (16h waking - exercise - stand) since HealthKit doesn't track sedentary time directly. This is documented as a limitation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Delete old packages/healthkit/ workspace and rebuild as a clean service layer under lib/services/healthkit/ using @kingstinct/react-native-healthkit directly with correct Nitro module API signatures. New service layer: - types.ts: DailyActivity, SleepNight, VitalsDay, HealthPermissionResult - mappers.ts: Date helpers, sample bucketing, sleep stage mapping - HealthKitClient.ts: requestHealthPermissions(), getDailyActivity(), getSleep(), getVitals() with correct filter/limit/unit query options - index.ts: Barrel exports Data pulled: - Activity: steps, exercise/move/stand minutes, sedentary (estimated), active energy, distance - Sleep: stages (Core/Deep/REM/Awake) on iOS 16+, fallback to asleep/inBed on older iOS - Vitals: heart rate (min/avg/max), resting HR, HRV SDNN, respiratory rate, SpO2 Updated health.tsx debug panel and permissions.tsx to use new service. Removed @spezivibe/healthkit workspace reference from package.json and tsconfig.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ios/, android/, and plugins/ directories for native builds - Configure HealthKit with background delivery and deployment target 16.0 - Update onboarding flow and service - Remove Swift 6.0.3 compiler crash workaround (now on Swift 6.2.1) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace raw debug panel with calm, section-based health summary for BPH patients (age 50+). Add view-model layer that derives plain-language insights from HealthKit data, with expandable Sleep, Activity, and Vitals cards using subtle color-tinted dark mode palette (indigo/teal/rose). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Notify the onboarding status hook after reset so the root layout re-evaluates and declaratively redirects to the onboarding flow without requiring an app restart. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace parallax Home screen with dashboard showing surgery countdown, watch reminders, daily tasks, and study progress cards - Restructure tab bar: add Voiding, Profile tabs; hide old Explore, Contacts, Schedule tabs; update styling and icons - Upgrade Chat tab to concierge chat helper with guided playbook - Add new screens: profile, voiding log, consent viewer - Add hooks for surgery date tracking and watch usage monitoring - Add SurgeryCompleteModal component and consent document content - Update permissions, DevToolBar, and icon-symbol for new flows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…est screen Adds expo-clinical-records native module for FHIR clinical data access, withClinicalRecords config plugin for entitlements, and health data test screen in onboarding flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…records Build a deterministic FHIR parsing layer that extracts medications, labs, conditions, and procedures from Apple Health clinical records to pre-fill medical history fields. The chatbot now only asks about gaps instead of all fields. Also adds HealthKit demographics (age, biological sex), clinical records permission to onboarding, and fixes stale tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move useEffect before early return in onboarding index (rules-of-hooks) - Wrap strings with apostrophes in JSX expressions (react/no-unescaped-entities) - Merge duplicate healthkit imports in health-data-test - Remove unused error variable in permissions catch block - Use T[] syntax instead of Array<T> in questionnaire Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
HealthKit Integration, FHIR Normalization, Dashboard Redesign & Clinical Records
♻️ Current situation & Problem
This PR represents the cumulative development work on Chehan-branch since the last merge (#5). The app previously had a basic onboarding flow with chatbot-based medical history collection, but lacked:
⚙️ Release Notes
HealthKit Integration
getBiologicalSex(),getDateOfBirth(), andgetDemographics()for patient demographicsClinical Records Module
expo-clinical-recordsnative module wrapping Apple Health clinical records (HKClinicalRecord)ClinicalRecordsClientwith typed helpers for medications, lab results, conditions, and proceduresFHIR Normalization Layer (
lib/services/fhir/)MedicalHistoryPrefillwith confidence scores and provenanceMedical History Prefill Integration
Dashboard & Navigation Redesign
Bug Fixes
clinicalRecordstoOnboardingData.permissionstype (was causing TS error)isCompleteandresetout of sync withONBOARDING_FINISHEDflag)Infrastructure
📚 Documentation
PrefillEntry<T>pattern documented with confidence levels (high= code match,medium= text match,none= no data)✅ Testing
npm test— services + workspaces)npx tsc --noEmit)onboarding-service.test.ts:isCompletetest now correctly mocksONBOARDING_FINISHEDstorage keyresettest now includesONBOARDING_FINISHEDin expectedmultiRemovearray.catch(() => null)fallbacks so the app degrades gracefully on simulators or devices without health data📝 Code of Conduct & Contributing Guidelines
By submitting this pull request, I agree to follow the Code of Conduct and Contributing Guidelines: