# minduy314/gait-analysis architecture

> Architecture diagram of the GitHub repository minduy314/gait-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minduy314/gait-analysis
- Repository: https://github.com/minduy314/gait-analysis

## Overview

This is a gait-analysis platform with a Next.js client and a FastAPI backend. Its principal workflow is to create a subject and session, upload a walking video, queue asynchronous analysis, then review assessment, progress, and reports. The backend also supports a research-reference pipeline and video-to-reference validation. Sampled source confirms the video-processing and assessment internals; several API-to-domain links are based on documented capabilities rather than inspected route implementations, and are marked unverified.

Main entry points: [`src/api/routes`](https://github.com/minduy314/gait-analysis/tree/main/src/api/routes) (REST endpoints), [`src/video/video_pipeline_runner.py`](https://github.com/minduy314/gait-analysis/blob/main/src/video/video_pipeline_runner.py) (Video pipeline runner), [`src/api/main.py`](https://github.com/minduy314/gait-analysis/blob/main/src/api/main.py) (FastAPI application), [`src/assessment/assessment_engine.py`](https://github.com/minduy314/gait-analysis/blob/main/src/assessment/assessment_engine.py) (Biomechanical assessment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Gait workspace"]
  node_api_client["API client<br/>[api-client.ts]"]
end

subgraph group_api["API and identity"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[routes.py]"]
  node_routes["REST endpoints"]
  node_sessions["Subjects and sessions<br/>[sessions.py]"]
  node_jobs["Analysis jobs"]
end

subgraph group_analysis["Video analysis"]
  node_video_ingest["Video validation and frames"]
  node_pose["Pose estimation"]
  node_view["Camera view detection"]
  node_events["Gait events and cycles"]
  node_video_features["Video feature extraction"]
  node_video_pipeline["Video pipeline runner"]
end

subgraph group_research["Research and assessment"]
  node_assessment["Biomechanical assessment"]
  node_reference["Reference distributions"]
  node_validation["Agreement validation"]
  node_progress["Baseline and progress<br/>[progress_engine.py]"]
  node_reports["Individual and professional reports"]
  node_npz["Motion-capture data pipeline"]
  node_npz_features["Reference feature extraction"]
end

subgraph group_records["Persistence and outputs"]
  node_database[("SQLite persistence<br/>[database.py]")]
  node_repositories["Data repositories<br/>[repositories.py]"]
  node_storage["Secure file storage<br/>[file_storage.py]"]
end

node_user(("Platform user"))

node_user -->|"uses"| node_frontend
node_frontend -.->|"requests data"| node_api_client
node_api_client -.->|"calls REST API"| node_api_entry
node_api_entry -->|"registers routers"| node_routes
node_api_entry -->|"registers router"| node_auth
node_user -->|"registers or logs in"| node_auth
node_routes -->|"includes session endpoints"| node_sessions
node_sessions -->|"uses repositories"| node_repositories
node_user -->|"creates subject and session"| node_sessions
node_user -->|"uploads recording"| node_routes
node_routes -.->|"stores upload"| node_storage
node_routes -.->|"submits analysis"| node_jobs
node_jobs -.->|"runs processing"| node_video_pipeline
node_video_pipeline -->|"validates and extracts frames"| node_video_ingest
node_video_pipeline -->|"creates estimator"| node_pose
node_video_pipeline -->|"classifies poses"| node_view
node_video_pipeline -->|"detects and segments gait"| node_events
node_video_pipeline -->|"extracts features"| node_video_features
node_routes -.->|"requests assessment"| node_assessment
node_routes -.->|"requests progress"| node_progress
node_routes -.->|"requests reports"| node_reports
node_assessment -.->|"compares features"| node_reference
node_assessment -.->|"informs tracking"| node_progress
node_user -.->|"maintains reference data"| node_npz
node_npz -->|"feeds extraction"| node_npz_features
node_api_entry -->|"initializes database"| node_database
node_database -->|"defines models"| node_repositories
node_progress -.->|"provides tracking results"| node_reports

click node_frontend "https://github.com/minduy314/gait-analysis/tree/main/frontend/src/app"
click node_api_client "https://github.com/minduy314/gait-analysis/blob/main/frontend/src/lib/api-client.ts"
click node_api_entry "https://github.com/minduy314/gait-analysis/blob/main/src/api/main.py"
click node_auth "https://github.com/minduy314/gait-analysis/blob/main/src/api/auth/routes.py"
click node_routes "https://github.com/minduy314/gait-analysis/tree/main/src/api/routes"
click node_sessions "https://github.com/minduy314/gait-analysis/blob/main/src/api/routes/sessions.py"
click node_jobs "https://github.com/minduy314/gait-analysis/tree/main/src/jobs"
click node_video_ingest "https://github.com/minduy314/gait-analysis/tree/main/src/video"
click node_pose "https://github.com/minduy314/gait-analysis/tree/main/src/pose_estimation"
click node_view "https://github.com/minduy314/gait-analysis/blob/main/src/view_detection/camera_view_classifier.py"
click node_events "https://github.com/minduy314/gait-analysis/tree/main/src/gait_events"
click node_video_features "https://github.com/minduy314/gait-analysis/blob/main/src/feature_extraction/video_feature_extractor.py"
click node_video_pipeline "https://github.com/minduy314/gait-analysis/blob/main/src/video/video_pipeline_runner.py"
click node_assessment "https://github.com/minduy314/gait-analysis/blob/main/src/assessment/assessment_engine.py"
click node_reference "https://github.com/minduy314/gait-analysis/blob/main/src/reference/reference_builder.py"
click node_validation "https://github.com/minduy314/gait-analysis/blob/main/src/validation/validation_runner.py"
click node_progress "https://github.com/minduy314/gait-analysis/blob/main/src/progress/progress_engine.py"
click node_reports "https://github.com/minduy314/gait-analysis/tree/main/src/reporting"
click node_database "https://github.com/minduy314/gait-analysis/blob/main/src/database/database.py"
click node_repositories "https://github.com/minduy314/gait-analysis/blob/main/src/database/repositories.py"
click node_storage "https://github.com/minduy314/gait-analysis/blob/main/src/storage/file_storage.py"
click node_npz "https://github.com/minduy314/gait-analysis/tree/main/src/data_loader"
click node_npz_features "https://github.com/minduy314/gait-analysis/blob/main/src/feature_extraction/npz_feature_extractor.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_api_client,node_user toneBlue
class node_api_entry,node_auth,node_routes,node_sessions,node_jobs toneAmber
class node_video_ingest,node_pose,node_view,node_events,node_video_features,node_video_pipeline toneMint
class node_assessment,node_reference,node_validation,node_progress,node_reports,node_npz,node_npz_features toneRose
class node_database,node_repositories,node_storage toneIndigo
```

## Components

### User interface

- [Gait workspace](https://github.com/minduy314/gait-analysis/tree/main/frontend/src/app): `frontend/src/app`
- [API client](https://github.com/minduy314/gait-analysis/blob/main/frontend/src/lib/api-client.ts): `frontend/src/lib/api-client.ts`

### API and identity

- [FastAPI application](https://github.com/minduy314/gait-analysis/blob/main/src/api/main.py): `src/api/main.py`
- [Authentication](https://github.com/minduy314/gait-analysis/blob/main/src/api/auth/routes.py): `src/api/auth/routes.py`
- [REST endpoints](https://github.com/minduy314/gait-analysis/tree/main/src/api/routes): `src/api/routes`
- [Subjects and sessions](https://github.com/minduy314/gait-analysis/blob/main/src/api/routes/sessions.py): `src/api/routes/sessions.py`
- [Analysis jobs](https://github.com/minduy314/gait-analysis/tree/main/src/jobs): `src/jobs`

### Video analysis

- [Video validation and frames](https://github.com/minduy314/gait-analysis/tree/main/src/video): `src/video`
- [Pose estimation](https://github.com/minduy314/gait-analysis/tree/main/src/pose_estimation): `src/pose_estimation`
- [Camera view detection](https://github.com/minduy314/gait-analysis/blob/main/src/view_detection/camera_view_classifier.py): `src/view_detection/camera_view_classifier.py`
- [Gait events and cycles](https://github.com/minduy314/gait-analysis/tree/main/src/gait_events): `src/gait_events`
- [Video feature extraction](https://github.com/minduy314/gait-analysis/blob/main/src/feature_extraction/video_feature_extractor.py): `src/feature_extraction/video_feature_extractor.py`
- [Video pipeline runner](https://github.com/minduy314/gait-analysis/blob/main/src/video/video_pipeline_runner.py): `src/video/video_pipeline_runner.py`

### Research and assessment

- [Biomechanical assessment](https://github.com/minduy314/gait-analysis/blob/main/src/assessment/assessment_engine.py): `src/assessment/assessment_engine.py`
- [Reference distributions](https://github.com/minduy314/gait-analysis/blob/main/src/reference/reference_builder.py): `src/reference/reference_builder.py`
- [Agreement validation](https://github.com/minduy314/gait-analysis/blob/main/src/validation/validation_runner.py): `src/validation/validation_runner.py`
- [Baseline and progress](https://github.com/minduy314/gait-analysis/blob/main/src/progress/progress_engine.py): `src/progress/progress_engine.py`
- [Individual and professional reports](https://github.com/minduy314/gait-analysis/tree/main/src/reporting): `src/reporting`
- [Motion-capture data pipeline](https://github.com/minduy314/gait-analysis/tree/main/src/data_loader): `src/data_loader`
- [Reference feature extraction](https://github.com/minduy314/gait-analysis/blob/main/src/feature_extraction/npz_feature_extractor.py): `src/feature_extraction/npz_feature_extractor.py`

### Persistence and outputs

- [SQLite persistence](https://github.com/minduy314/gait-analysis/blob/main/src/database/database.py): `src/database/database.py`
- [Data repositories](https://github.com/minduy314/gait-analysis/blob/main/src/database/repositories.py): `src/database/repositories.py`
- [Secure file storage](https://github.com/minduy314/gait-analysis/blob/main/src/storage/file_storage.py): `src/storage/file_storage.py`

### Other components

- **Platform user**

## Connections

- Platform user → Gait workspace: uses
- Gait workspace → API client: requests data
- API client → FastAPI application: calls REST API
- FastAPI application → REST endpoints: registers routers (evidence: `src/api/main.py`)
- FastAPI application → Authentication: registers router (evidence: `src/api/main.py`)
- Platform user → Authentication: registers or logs in (evidence: `src/api/auth/routes.py`)
- REST endpoints → Subjects and sessions: includes session endpoints (evidence: `src/api/main.py`)
- Subjects and sessions → Data repositories: uses repositories (evidence: `src/api/routes/sessions.py`)
- Platform user → Subjects and sessions: creates subject and session
- Platform user → REST endpoints: uploads recording
- REST endpoints → Secure file storage: stores upload
- REST endpoints → Analysis jobs: submits analysis
- Analysis jobs → Video pipeline runner: runs processing
- Video pipeline runner → Video validation and frames: validates and extracts frames (evidence: `src/video/video_pipeline_runner.py`)
- Video pipeline runner → Pose estimation: creates estimator (evidence: `src/video/video_pipeline_runner.py`)
- Video pipeline runner → Camera view detection: classifies poses (evidence: `src/video/video_pipeline_runner.py`)
- Video pipeline runner → Gait events and cycles: detects and segments gait (evidence: `src/video/video_pipeline_runner.py`)
- Video pipeline runner → Video feature extraction: extracts features (evidence: `src/video/video_pipeline_runner.py`)
- REST endpoints → Biomechanical assessment: requests assessment
- REST endpoints → Baseline and progress: requests progress
- REST endpoints → Individual and professional reports: requests reports
- Biomechanical assessment → Reference distributions: compares features
- Biomechanical assessment → Baseline and progress: informs tracking
- Platform user → Motion-capture data pipeline: maintains reference data
- Motion-capture data pipeline → Reference feature extraction: feeds extraction
- FastAPI application → SQLite persistence: initializes database (evidence: `src/api/main.py`)
- SQLite persistence → Data repositories: defines models (evidence: `src/database/repositories.py`)
- Baseline and progress → Individual and professional reports: provides tracking results
