MoonBit Gait Lab: A gait analysis and metrics library for running, postoperative rehabilitation, and elderly screening.
| Layer | What it provides |
|---|---|
| Data | RFC-style CSV parsing, typed tables, schemas, JSON accessors, validation, transformation, and stable exports |
| Numerics | Statistics, geometry, interpolation, matrices, robust estimators, time-series utilities, and vector operations |
| Signals | Smoothing, robust filters, derivatives, event detection, correlation, frequency features, segmentation, and windows |
| Trajectories | Time-axis checks, resampling, unit conversion, alignment, coordinate transforms, features, and quality rules |
| Gait | Cycle segmentation, temporal/spatial metrics, symmetry, variability, reference ranges, balance, and explainable screening |
| Pipeline | Strict or lenient analysis, batch processing, diagnostics, caching keys, readiness gates, invariants, and structured results |
| Reports | Markdown, JSON, CSV, text, TSV, dashboard, and accessibility-oriented summaries |
moon update
moon fmt --check
moon check --deny-warn --target all
moon test --deny-warn --target wasm-gc
moon test --deny-warn --target js
moon run main -- --demomoon test --deny-warn --target allmoon run main -- --help
moon run main -- --demo
moon run main -- --demo --format json
moon run main -- --demo --format csv
moon run main -- --demo --strict --sampling-rate 100time,hip_x,hip_y,hip_z,knee_x,knee_y,knee_z,ankle_x,ankle_y,ankle_z,foot_x,foot_y,foot_z$csv = @'
time,hip_x,hip_y,hip_z,knee_x,knee_y,knee_z,ankle_x,ankle_y,ankle_z,foot_x,foot_y,foot_z
0,0,0.9,0,0,0.5,0,0,0.1,0,0,0,0
0.01,0.01,0.9,0,0.01,0.5,0,0.01,0.1,0,0.01,0,0
'@
moon run main -- --csv-data $csv --format json{
"frames": [
{"time": 0.00, "left_foot": {"x": 0.00, "y": 0.00, "z": 0.00}},
{"time": 0.01, "left_foot": {"x": 0.01, "y": 0.00, "z": 0.00}}
]
}moon run main -- --json-data '{"frames":[{"time":0,"left_foot":{"x":0,"y":0,"z":0}},{"time":0.01,"left_foot":{"x":0.01,"y":0,"z":0}}]}' --format jsonlet result = @pipeline.analyze_frames(
left_frames,
right_frames,
@pipeline.default_config(),
)CSV / JSON / API values
│
▼
trajectory validation → units → alignment → resampling
│
▼
signal conditioning → events → gait cycles
│
▼
temporal/spatial metrics → symmetry → quality and screening
│
▼
pipeline diagnostics and readiness gates
│
▼
Markdown / JSON / CSV / text reports| Package | Responsibility |
|---|---|
| lib/math | Numeric primitives, geometry, matrices, robust statistics, and time series |
| lib/csv | CSV parser, tables, typed columns, validation, grouping, and exports |
| lib/json | JSON AST, accessors, formatting, validation, transforms, and visitors |
| lib/signal | Filtering, derivatives, events, correlation, frequency, and windows |
| lib/trajectory | Time axes, trajectory quality, units, alignment, transforms, and features |
| lib/gait | Cycles, gait metrics, variability, balance, reference rules, and explainability |
| lib/pipeline | Configuration, orchestration, diagnostics, batch analysis, readiness, and invariants |
| lib/report | Human- and machine-readable report renderers |
| main | CLI parsing and deterministic demo |
pwsh -File scripts/run_benchmark.ps1 -Target wasm-gc -Runs 3 -Iterations 5pwsh -File scripts/run_benchmark.ps1 -Target native -Runs 5 -Iterations 20moon test --deny-warn --target wasm-gc
moon test --deny-warn --target jspwsh -File scripts/audit_source_scale.ps1 -MinimumProductionLines 8000lib/ reusable MoonBit packages
main/ CLI executable
benchmarks/ deterministic workloads and measurements
scripts/ local audit and benchmark automation
data/ sample input data
.github/workflows/ continuous integrationMoonBit Gait Lab: A gait analysis and metrics library for running, postoperative rehabilitation, and elderly screening.