How xreep/raksha works
PHC is a privacy-preserving mobile health companion: it collects on-device readings, combines them with local environmental context, assesses risk, and presents dashboard/history results or initiates an SOS. The README documents the end-to-end pipeline and major features; sampled source confirms key orchestration boundaries. The relay’s endpoint wiring is sampled, but most app hooks and several subsystems are represented from the README and file tree.
Main entry points: dispatch.ts Channel dispatch · index.tsx Dashboard · deliver.ts SOS orchestration · service.ts Environment feed
Components 29
Mobile experience
- Dashboard
src/app/index.tsx - Trends screen
src/app/trends.tsx - Settings
src/settings/provider.tsx - Community summary
src/community/aggregate.ts
Sensing and assessment
- Sensor ingestion
src/sensors/provider.tsx - Reading store
src/store/sqlite.ts - Risk engine
src/risk/assess.ts
Context and community
- Environment feed
src/environment/service.ts - Environment cache
src/environment/cache.ts - Community aggregation
src/community/aggregate.ts - Preparedness advice
src/advisories/preparedness.ts
Emergency response
- Local alerts
src/alerts/notify.ts - SOS orchestration
src/sos/deliver.ts - SOS location
src/sos/location.ts - App relay client
src/sos/relay.ts
SOS relay
- Relay API
relay/src/index.ts - Channel dispatch
relay/src/dispatch.ts - Telegram adapter
relay/src/adapters/telegram.ts - Textbelt adapter
relay/src/adapters/textbelt.ts - Twilio adapter
relay/src/adapters/twilio.ts - FCM adapter
relay/src/adapters/fcm.ts - Telegram linking
relay/src/link.ts
Other components
- Phone user
- Health Connect
- Phone motion sensor
- OpenWeatherMap
- Native SMS composer
- Delivery providers
- Link token store
Connections 33
- Phone user → Dashboard: views
- Phone user → Settings: configures
- Health Connect → Sensor ingestion: supplies vitals
- Phone motion sensor → Sensor ingestion: supplies motion
- Sensor ingestion → Reading store: persists readings
- Reading store → Risk engine: provides history
- Dashboard → Risk engine: requests assessment
- Environment feed → Risk engine: provides context
- Environment feed → OpenWeatherMap: fetches weather/AQI
- Environment feed → Environment cache: writes snapshot
- Environment cache → Environment feed: fallback reads
- Dashboard → Local alerts: plans notifications
- Dashboard → SOS orchestration: hands off triggers
- SOS orchestration → SOS location: resolves location
- SOS location → Phone user: gets device fix
- SOS orchestration → App relay client: requests delivery
- App relay client → Relay API: posts SOS
- SOS orchestration → Native SMS composer: opens fallback
- Trends screen → Reading store: reads history
- Phone user → Community summary: views summary
- Community summary → Community aggregation: summarizes cohort
- Phone user → Preparedness advice: reads guidance
- Relay API → Channel dispatch: dispatches alert
- Channel dispatch → Telegram adapter: sends message
- Channel dispatch → Textbelt adapter: sends SMS
- Channel dispatch → Twilio adapter: sends SMS
- Channel dispatch → FCM adapter: sends notification
- Telegram adapter → Delivery providers: calls API
- Textbelt adapter → Delivery providers: calls API
- Twilio adapter → Delivery providers: calls API
- FCM adapter → Delivery providers: calls API
- Relay API → Telegram linking: handles linking
- Telegram linking → Link token store: redeems token