Based on the review of flow.md, stackAndFlow.md, and the current repo structure/codebase.
[x]Done[-]Partial / started[ ]Left / not implemented yet
- Create high-level fall response flow in
flow.md - Create detailed architecture, stack, and phased plan in
stackAndFlow.md - Define major module areas:
interfaceservertestfault_detection_model
- Freeze final MVP scope
- Freeze final event lifecycle and naming
- Freeze final API contracts and endpoint naming
- Decide clearly whether fall alerts are active from day 1 or only after calibration
- Separate MVP features from later-phase features:
- BLE broadcast
- ETA monitoring
- full 108 automation
- advanced ML fusion
- Create main mobile app scaffold in
interface - Create backend scaffold in
server - Create IMU dataset collection app in
test - Create model workspace in
fault_detection_model - Clean up naming consistency where needed
- Add root-level implementation tracking and milestone documentation
- Add architecture decision record for MVP choices
- App bootstrap exists
- Navigation structure exists
- Home screen exists
- Navigation screen exists
- Settings screen exists
- Sensor service abstraction exists
- GPS service abstraction exists
- Camera service abstraction exists
- Voice output helper exists
- Haptic helper exists
- [-] Voice confirmation component exists but is not fully integrated into the live app flow
- [-]
useSensorshook exists but is not driving the full fall pipeline
- Express app scaffold exists
- Health endpoint exists
- Contacts route exists
- Basic fall route exists
- Twilio SMS service scaffold exists
- [-] Fall validation service exists, but only in simplified prototype form
- [-] Contacts are stored via local JSON, not a production-ready user/contact model
- Add proper versioned API structure
- Add persistent data model for users, contacts, and fall events
- Add event resolution lifecycle
- Add event history endpoints
- Align the implemented app/backend flow with
flow.md - Align the implemented app/backend flow with
stackAndFlow.md - Fix confirmation timing mismatch:
- docs say ~30 seconds
- current prototype behavior is much shorter
- Replace current prototype-only backend decision model:
motionScoreorientationChange- optional transcript with a real fall event payload
- Add severity model to the event flow:
- MINOR
- SEMI_MAJOR
- MAJOR
- Ensure the app actually wires together:
- sensor monitoring
- candidate detection
- confirmation
- SOS dispatch
- resolution
- Define one clear user-facing fall flow for MVP and keep all code aligned to it
- Detect a simple fall candidate on-device
- Ask user for confirmation with voice + haptic + large button
- If user cancels, log false alarm and stop
- If user does not respond, send SOS alert with location to emergency contacts
- Log the event locally and on backend
- Allow manual resolution of the event
- Decide exact candidate detection rule for MVP
- Decide exact confirmation duration for MVP
- Decide whether voice-only, button-only, or both are required in MVP
- Decide whether 108 is included in MVP or postponed
- Decide whether BLE is postponed to post-MVP
- Create a dedicated fall detection state machine
- Recommended states:
IDLEMONITORINGCANDIDATECONFIRMINGALERTINGESCALATINGRESOLVEDFALSE_ALARM
- Persist state transitions locally
- Mirror final event status to backend
- Add structured event IDs
- Add timestamps for every state transition
- Accelerometer access started
- Gyroscope access started
- [-] Basic motion-state logic exists
- Real production sensor pipeline is not implemented yet
- Implement real sensor monitoring architecture
- Add ring buffer for pre-fall IMU capture
- Store at least the planned pre-event window
- Add synchronized sensor event timestamps
- Improve motion-state classifier
- Move critical detection logic out of JS where needed
- Ensure low-latency handoff from sensor data to fall candidate detection
- Add battery-aware sampling strategy
- Add restart-safe behavior for long-running monitoring
- Implement Android foreground service for continuous fall monitoring
- Make monitoring survive app backgrounding
- Make monitoring survive screen-off state
- Make monitoring recover after device restart
- Add iOS background strategy
- Add background-safe location caching
- Add background-safe fall candidate handling
- Add graceful fallback behavior if full background capability is unavailable
- Implement 5-day calibration pipeline
- Collect passive movement baselines
- Compute personal thresholds
- Store calibration profile locally
- Add shadow mode
- Log shadow detections
- Add daily lightweight check-in flow if needed
- Add recalibration trigger logic
- Decide whether calibration blocks alerts or only improves them
- Prefer safe default thresholds from day 1 unless product policy says otherwise
- Stage 1: free-fall detection gate
- Stage 2: impact detection gate
- Stage 3: orientation assessment
- Stage 4: post-impact motion monitoring
- Stage 5: ML + rules + context fusion
- Build simple candidate detector first
- Add impact threshold logic
- Add orientation change logic
- Add immobility check
- Add event confidence score
- Add structured fall candidate payload
- Add event logging for all candidate detections
- Add severity levels to domain model
- Add rule-based severity scoring
- Include factors such as:
- impact strength
- orientation change
- immobility duration
- user response / no response
- Use severity to control escalation behavior
- Ensure severity is part of both device and backend event schema
- Add throw-vs-fall disambiguation
- Add phone drop-vs-human fall separation
- Add soft surface / hard surface handling
- Add context-based suppression rules
- Add false alarm logging
- Add false alarm fingerprint DB
- Add recalibration trigger when false alarms are too frequent
- Add false alarm history UI
- Allow user to reclassify a logged event later if needed
- TTS prototype exists
- Speech recognition prototype exists
- [-] Backend transcript submission exists in prototype form
- Not fully integrated into the main app flow
- Integrate voice confirmation into actual fall workflow
- Add large accessible
I'M OKbutton - Add full-screen confirmation UI
- Add countdown timer
- Match confirmation duration to final product decision
- Support slower user response patterns
- Add retry/fallback behavior if voice recognition fails
- Add multilingual confirmation phrases
- Add accessibility support for screen readers
- Ensure confirmation works even when app is backgrounded or locked where possible
- Haptic helper exists
- Voice output helper exists
- Add dedicated fall alert haptic pattern
- Add dedicated emergency voice prompts
- Add volume escalation logic for emergency prompts
- Add user settings for voice language and rate
- Add emergency audio fallback if speech recognition fails
- Ensure alerts are clear for elderly users in noisy environments
- GPS service wrapper exists
- [-] Live GPS reading exists in prototype form
- Planned background last-known-location cache flow is not implemented
- Add last-known-location cache strategy
- Cache location periodically in background
- Include cached location in all fall alerts
- Add behavior when GPS is weak or unavailable
- Add stale-location handling
- Add maps link generation
- Add location accuracy tracking in event payload
- Add floor-level/context hooks when available
- Define final
FallEventschema - Include:
- event ID
- user ID
- timestamps
- severity
- candidate metrics
- transcript / confirmation result
- location
- alert chain status
- resolution
- Add persistent user model
- Add persistent contact model
- Add event audit log
- Add fall history API
- Add false alarm history API
- Basic contacts API exists
- [-] SMS alerting exists
- No full app-side SOS contact management flow yet
- Build SOS contact management UI in app
- Add add/edit/remove contact flow
- Add limit rules if needed
- Add address book import if required
- Add backend sync for contacts
- Validate contact numbers
- Add primary / secondary contact priority if needed
- Add contact test-message flow
- [-] Prototype SMS dispatch exists
- Full chain does not exist
- Trigger alerts from actual fall event state machine
- Send SMS with:
- user name
- timestamp
- location link
- severity
- event ID
- Add acknowledgement tracking
- Add retry policy
- Add escalation timing policy
- Add event resolution flow
- Add alert delivery logs
- Add fallback behavior if first alert method fails
- Redis
- MongoDB
- BullMQ
- socket.io
- Firebase Admin
- geospatial nearby search
- queue-based escalation workers
- Add Redis for location/event cache
- Add MongoDB for persistent event and user storage
- Add queue workers for dispatch/escalation
- Add socket.io for live event updates
- Add Firebase push notification support
- Add configuration and environment validation
- Add structured logging
- Add runtime error monitoring
- Current routes do not yet match the planned architecture
- Define final versioned API namespace
- Add endpoint for location caching
- Add endpoint for fall event create/update
- Add endpoint for SOS dispatch
- Add endpoint for ETA updates
- Add endpoint for event resolve
- Add endpoint for fall history
- Add request validation on all routes
- Align mobile app requests with final backend contracts
- Add Firebase Cloud Messaging integration
- Send push notifications to SOS contacts
- Add acknowledgement tracking
- Add push-to-SMS fallback timing
- Add contact-side event open screen
- Add
I'm heading thereaction - Add
I've reached themaction - Add contact-side manual call action
- Log all acknowledgement and response actions
- Add SOS responder live tracking flow
- Add ETA calculation logic
- Add ETA threshold escalation rules
- Recompute ETA periodically
- Detect if responder is not moving toward user
- Escalate based on drift / no progress
- Close event when responder arrives
- Finalize whether 108 is part of MVP or post-MVP
- Add device-side emergency calling strategy
- Add scripted emergency message generation
- Add backend fallback call strategy if required
- Add logging for every 108 attempt
- Add escalation rules based on severity
- Add escalation rules based on no-response windows
- Decide whether BLE is post-MVP
- Add BLE emergency broadcast on supported platforms
- Add nearby device scanning flow
- Add responder notification UI
- Add event packet format
- Add resolution behavior for BLE-triggered assistance
- Add server-driven nearby responder fallback if implemented later
- Add barometer integration
- Add floor-level estimation
- Add staircase/ditch heuristics
- Add ambient audio context capture
- Add optional scene/context enrichment
- Add context tags to event payload:
- indoor
- outdoor
- market
- washroom
- staircase
- unknown
- Ensure privacy-safe handling of audio/context features
- Model environment setup exists
- Dataset prep scripts exist
- Test app exists for IMU data collection
- [-] ML integration into app is not done
- Finalize labeled data collection plan
- Collect fall-like and non-fall datasets
- Prepare training pipeline
- Train initial classifier
- Evaluate with meaningful metrics
- Export mobile-compatible model
- Integrate model runtime in app
- Add model confidence handling
- Fuse model output with rule-based severity
- Add fallback path when model confidence is low
- Dataset collection app exists for gathering non-fall movement data
- Add unit tests for fall validation logic
- Add unit tests for event state machine
- Add integration tests for app-to-server flow
- Add backend route tests
- Add end-to-end tests for candidate -> confirm -> alert
- Add simulated fall scenarios
- Add phone drop / throw / table placement scenarios
- Add controlled field tests
- Measure detection rate
- Measure false positive rate
- Measure alert latency
- Measure battery impact
- Audit all critical flows for elderly users
- Ensure large touch targets
- Ensure large default font sizes
- Ensure high contrast UI
- Ensure screen reader support
- Ensure emergency prompts are simple and understandable
- Ensure confirmation screen is usable under stress
- Add one-permission-per-screen onboarding flow
- Add gentle degraded-mode messaging when permissions are denied
- Add language selection support
- Add multilingual emergency prompts
- Add multilingual voice recognition phrases
- Localize onboarding, settings, and alerts
- Localize emergency SMS templates if needed
- Define data retention policy
- Define consent handling for:
- background location
- microphone
- aggregate model improvement
- Add in-app privacy explanation
- Add plain-language consent screens
- Add privacy policy
- Review DPDP/GDPR implications as needed
- Decide exact integration boundary between PathSense navigation and FallSense
- Share IMU infrastructure where appropriate
- Share GPS preprocessing where appropriate
- Add Safety Supervisor handoff
- Pause navigation guidance during active fall event
- Resume navigation after resolution
- Reuse context/depth services only when needed
- Freeze MVP flow
- Freeze event model
- Freeze API contracts
- Sensor candidate detection
- Confirmation UI
- SMS alert with location
- Event logging
- Manual resolution
- Background monitoring
- Permissions onboarding
- Contact management
- Persistent backend storage
- Calibration
- false alarm reduction
- severity scoring
- better context
- push notifications
- ETA tracking
- 108 escalation
- BLE
- ML fusion
- Finalize the exact MVP fall flow
- Build the app-side fall event state machine
- Replace prototype fall request payload with a real event payload
- Integrate the confirmation UI into the actual running app
- Make SOS SMS with location work end-to-end from the app
- Planning and architecture docs
- Repo structure
- App scaffold
- Backend scaffold
- Dataset collection app
- Model workspace setup
- [-] Voice confirmation prototype
- [-] Simple sensor and fall prototype
- The real end-to-end FallSense product flow
- The production-safe background monitoring architecture
- The full escalation chain
- The calibration and false-alarm learning pipeline
- The full backend infrastructure
- The ML integration
- The final PathSense-core integration