Skip to content
JCoder2209Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

FieldMD

A privacy-first movement-screening app: deterministic biomechanics computed entirely on-device, explained by on-device Movement Guidance.

FieldMD turns a phone or laptop camera into a movement-screening station — with everything processed and stored locally. An athlete performs a short, guided movement; on-device pose estimation extracts joint kinematics; transparent, deterministic biomechanics compute assessment-specific findings; and a local guidance mapper translates those findings into plain-language explanations and practice suggestions. Results save to on-device history for progress tracking. No wearables, no lab, no account, no cloud upload, nothing ever leaves your device.

FieldMD is a movement-screening prototype, not a medical device. It reports camera-derived movement observations. It does not diagnose injuries, predict injury probability, or replace professional evaluation.

Assessments

Assessment Status Measures
Single-Leg Squat ✅ Supported Knee tracking, squat depth, pelvic stability, trunk control, left/right symmetry
Single-Leg Balance ✅ Supported Postural sway, stability-loss events, hold completion, trunk control, side difference

Roadmap (not in the product UI)

  • Drop Landing — planned metrics: landing knee flexion, frontal knee displacement, left/right landing asymmetry, trunk position at impact, stabilization time.
  • Lateral Step-Down — planned metrics: stance-knee tracking, pelvic drop, trunk compensation, movement depth, side-to-side consistency.
  • Featherless interpretation layer — a validated LLM coaching layer exists in the codebase (src/ai/, api/analyze.ts) behind the disabled FEATURE_FEATHERLESS flag (src/flags.ts); the public product ships with deterministic local guidance only.
  • Team rosters and shared coach dashboards.

Architecture

flowchart LR
    subgraph Device["On device (browser) — everything"]
        CAM[Camera] --> POSE["MediaPipe Pose<br/>33 landmarks"]
        POSE --> ANAT["Anatomical side mapping<br/>(vision/anatomy.ts)"]
        ANAT --> BIO["Deterministic biomechanics<br/>angles · tilt · sway"]
        BIO --> RULES["Assessment-specific rules<br/>thresholds → findings"]
        RULES --> GUIDE["Movement Guidance<br/>local finding→advice mapper"]
        GUIDE --> UI["Report UI"]
        UI --> HIST["Local history<br/>(localStorage)"]
        HIST --> PROG["Progress trends"]
    end
    subgraph Optional["Behind disabled flag (FEATURE_FEATHERLESS)"]
        API["/api/analyze → Featherless"]
    end
    RULES -. "not used in public product" .-> API
Loading

Measure first, explain second — the product's core principle:

  • Every number (joint angle, tilt, sway, symmetry) is computed locally with plain geometry. Same input → same output. Every finding names its value and threshold.
  • Movement Guidance is a deterministic local mapper (src/guidance.ts): each finding maps to a plain-language explanation and vetted, low-risk practice suggestions. Same findings → same guidance. No model output reaches the public UI.

Privacy model

FieldMD is built privacy-first, by design, not as an afterthought:

  • Camera video, frames, and raw landmarks never leave the device — all pose tracking and biomechanics run in your browser.
  • Assessment history and your optional details live only in this browser's local storage; clearing browser data removes them permanently.
  • There is no account, no sign-in, and no cloud upload of any kind. FieldMD has no server-side user data, no database, and nothing to breach.
  • Nothing is collected: no email, no name, no analytics, no tracking.

Local setup

cd baton
npm install
npm run dev          # the full product — everything runs locally
npm test             # regression tests (anatomy, state machines, stores)

Environment variables

FieldMD needs no environment variables to run. The table below only applies if you re-enable the disabled, experimental Featherless integration.

Variable Purpose
FEATHERLESS_API_KEY Experimental disabled flag only; server-side, never bundled.
FEATHERLESS_MODEL / FEATHERLESS_BASE_URL Experimental flag only; optional overrides.

Never commit .env or .env.local. .env.example documents the contract.

Production build

npm run build        # tsc (strict) + vite build → dist/
npm run preview      # serve the built app locally

Deployment (Vercel)

  1. Import the baton/ directory as a Vercel project (Vite is auto-detected; output dist/).
  2. Deploy. Hash-based routes (/#/app, …) work from the deployed site with no rewrite rules. The product is fully static — no environment variables, no database, no server-side user data.
  3. Custom .xyz domain: Project → Settings → Domains → Add → enter your domain → follow Vercel's DNS instructions at your registrar (A/CNAME records). HTTPS is provisioned automatically. (Domain purchase/configuration is manual and intentionally not automated.)

The experimental api/analyze.ts Edge function ships in the repo but is unused by the product (gated by the disabled FEATURE_FEATHERLESS flag). It only becomes active if you enable that flag and set FEATHERLESS_API_KEY.

The service worker is network-first for the app shell, so a new deploy is picked up on the next page load — users are never trapped on stale code.

iPhone PWA installation

  1. Open the deployed site in Safari on iOS.
  2. Tap Share → Add to Home Screen.
  3. Launch from the home-screen icon — FieldMD runs standalone (no browser chrome).

The app shows a small, dismissible install hint on iOS Safari. Note: the first load (including the pose model) requires a network connection; afterwards the runtime and model are cached.

Technology stack

  • Vite + strict TypeScript — no UI framework; hand-rolled hash router and DOM views
  • MediaPipe Tasks Vision (@mediapipe/tasks-vision) — BlazePose 33-landmark tracking, on device
  • Canvas 2D — camera rendering, skeleton + measurement overlays
  • Local guidance mapper (src/guidance.ts) — deterministic finding → advice, on device
  • localStorage — details + assessment history, per browser, never uploaded
  • PWA — manifest + service worker (installable; app shell cached)
  • Vitest — targeted regression tests
  • Experimental (disabled): Vercel Edge function + Featherless LLM coaching, behind FEATURE_FEATHERLESS — not used by the public product

Known limitations

  • Single 2D camera view: out-of-plane motion is approximated; true 3D angles are out of scope.
  • Thresholds are literature-informed defaults, not person-specific norms.
  • Landmark quality depends on lighting, clothing, and framing.
  • First load requires a network connection for the MediaPipe runtime/model (cached thereafter).
  • Details and history live only in this browser's localStorage — there is no cross-device sync, by design; clearing browser data removes them permanently.
  • iOS installation is Safari-only (Share → Add to Home Screen); there is no install prompt API on iOS.
  • Not clinically validated. Requires further validation with clinicians and athletes.

Safety / medical disclaimer

FieldMD provides educational movement observations from a camera-based screen. It is not a medical diagnosis, does not predict injuries, and must not be used to make treatment decisions. If you have pain, a prior injury, or any health concern, consult a qualified professional.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages