How jiajuntang2006/pose-based-fall-risk-prediction works
FallGuard is a macOS fall-risk monitoring product built around a local Python inference service and a native SwiftUI client. Its main workflow captures or imports video, extracts pose and temporal features, predicts confirmed and advisory risk states, then records monitoring sessions and events for review. The graph also preserves the documented training/data-preparation and model-fusion capabilities. Some backend and UI links rely on README-level architecture statements; unsampled source is not treated as inspected.
Main entry points: FallGuardAPIClient.swift API client · ml_predictor.py Tree prediction · frame_pipeline.py Frame risk pipeline · app.py Service composition
Components 27
Native macOS client
- SwiftUI screens
app/macos/native/FallGuard/Features/ContentView.swift - Dashboard
app/macos/native/FallGuard/Features/Dashboard/DashboardView.swift - Event history
app/macos/native/FallGuard/Features/Events/EventsView.swift - Media import
app/macos/native/FallGuard/Features/ImportMedia/ImportMediaView.swift - Profiles and settings
app/macos/native/FallGuard/Features/Settings/SettingsView.swift - API client
app/macos/native/FallGuard/Services/FallGuardAPIClient.swift - Python service manager
app/macos/native/FallGuard/Services/PythonServiceManager.swift - Notifications
app/macos/native/FallGuard/Services/NotificationService.swift
Local service and records
- Service composition
app/macos/src/fall_prediction_service/app.py - Authenticated API
app/macos/src/fall_prediction_service/server.py - Monitoring runtime
app/macos/src/fall_prediction_desktop/web_app.py - Frame risk pipeline
app/macos/src/fall_prediction_desktop/frame_pipeline.py - Risk state machine
app/macos/src/fall_prediction_desktop/risk_state_machine.py - Event service
app/macos/src/fall_prediction_desktop/event_service.py - SQLite persistence
app/macos/src/fall_prediction_desktop/database/database.py
Pose and risk inference
- Camera and video
fall_prediction/video_app.py - Pose extraction
fall_prediction/pose.py - Tree prediction
fall_prediction/ml_predictor.py - Motion features
fall_prediction/features.py - Calibration and robustness
fall_prediction/robustness.py - Skeleton fusion model
fall_prediction/fusion_model.py - Temporal risk policy
fall_prediction/risk.py
Datasets and model development
- Window datasets
fall_prediction/window_dataset.py - Skeleton datasets
fall_prediction/skeleton_dataset.py - Tree model training
fall_prediction/train_model.py - Fusion model training
fall_prediction/train_fusion_model.py
Other components
- User
Connections 28
- User → SwiftUI screens: uses
- SwiftUI screens → API client: requests data
- Python service manager → Service composition: starts
- API client → Authenticated API: calls localhost API
- Dashboard → API client: requests status
- Event history → API client: requests events
- Media import → API client: submits media
- Profiles and settings → API client: updates settings
- Authenticated API → Monitoring runtime: routes requests
app/macos/src/fall_prediction_service/server.py - Service composition → Authenticated API: configures
app/macos/src/fall_prediction_service/app.py - Service composition → Monitoring runtime: creates runtime
app/macos/src/fall_prediction_service/app.py - Monitoring runtime → Frame risk pipeline: processes frames
app/macos/src/fall_prediction_desktop/web_app.py - Frame risk pipeline → Risk state machine: updates risk state
app/macos/src/fall_prediction_desktop/frame_pipeline.py - Frame risk pipeline → Event service: observes risk
app/macos/src/fall_prediction_desktop/frame_pipeline.py - Event service → SQLite persistence: persists events
- Frame risk pipeline → Tree prediction: predicts risk
- Camera and video → Pose extraction: extracts keypoints
fall_prediction/video_app.py - Pose extraction → Motion features: derives motion
- Motion features → Tree prediction: provides features
fall_prediction/ml_predictor.py - Tree prediction → Calibration and robustness: uses calibration
fall_prediction/ml_predictor.py - Tree prediction → Skeleton fusion model: combines prediction
fall_prediction/ml_predictor.py - Tree prediction → Temporal risk policy: stabilizes state
fall_prediction/ml_predictor.py - Window datasets → Motion features: builds windows
fall_prediction/window_dataset.py - Skeleton datasets → Window datasets: uses windowing
fall_prediction/skeleton_dataset.py - Tree model training → Window datasets: trains from windows
fall_prediction/train_model.py - Fusion model training → Skeleton datasets: trains from skeletons
fall_prediction/train_fusion_model.py - Fusion model training → Skeleton fusion model: builds model
fall_prediction/train_fusion_model.py - Notifications → User: alerts