Skip to main content

Babon kinematics-as-a-service client. Video in, movement data out.

Project description

babon

Kinematics-as-a-service client. Video in, movement data out.

pip install babon
from babon import Babon

client = Babon()                                              # picks up BABON_API_KEY
analysis = client.analyses.create(video="trial.mp4", wait=True)
print(analysis.metrics["gait_speed_m_s"])                     # 1.32
print(analysis.angles)                                        # DataFrame

That's it. Three lines.

A bit more

# Fire and forget, retrieve later
analysis = client.analyses.create(video="trial.mp4")
# ... save analysis.id somewhere, exit, come back ...
analysis = client.analyses.retrieve("YOUR_ANALYSIS_ID")
print(analysis.status)                                        # queued|processing|completed|failed|canceled

# Cohort
batch = client.batches.create(requests=[
    {"video": "a.mp4"},
    {"video": "b.mp4", "label": "cohort-3"},
    {"video": "c.mp4", "model": "gemx"},
])
for analysis in batch.results(as_completed=True):             # yields as each finishes
    save(analysis.angles)

# Lazy projections (each is one cheap HTTP GET, cached per instance)
analysis.angles                       # DataFrame, all joints
analysis.angles(joint="knee_R")       # filtered
analysis.grf                          # GRF waveform, None for non-walking clips
analysis.events                       # heel-strike / toe-off
analysis.metrics                      # cadence, gait_speed, symmetry_index, ...
analysis.quality                      # tier + z-scores
analysis.skeleton                     # 3D viewer payload
analysis.download("out.zip", include=["angles", "grf"])

# Big files? The SDK auto-switches to presigned PUT above 100 MB.
client.analyses.create(video="4gb_video.mp4")                 # transparent

CLI

babon login                                                   # interactive: paste key
babon analyses create trial.mp4 --wait
babon analyses get YOUR_ANALYSIS_ID
babon analyses list --status completed --limit 20
babon batches create ./study/ --label baseline
babon usage                                                   # seconds used this month

Errors

The client raises typed exceptions:

  • BabonAuthError — bad key, wrong environment, DPA not accepted.
  • BabonQuotaExceeded — monthly limit, concurrent limit, or rate-limited.
  • BabonInvalidVideo — file is not a recognised container.
  • BabonInvalidLabel — label looks like a real name (ADR-0002).
  • BabonRunFailed — pipeline failed.
  • BabonTimeoutwait() exceeded its timeout.

All carry .code (the API error code) and .request_id (the support handle).

The HTTP transport retries 429 (honoring Retry-After), 5xx, and network errors with exponential backoff. POST requests are only retried when sent with Idempotency-Key (the SDK auto-generates one per file). 4xx errors raise immediately.

What we are and are not

  • Measurement only. Output is kinematics; clinical interpretation is yours.
  • EU-cloud (Scaleway fr-par). Videos never leave the EU.
  • Don't put real patient names in label or in your filenames. We reject name-shaped labels server-side.

Configure

client = Babon(
    key="YOUR_KEY",                       # optional, else BABON_API_KEY env
    base_url="https://api.babon.eu",      # optional, override for staging
    timeout_s=600,                        # optional, per-request timeout
    max_retries=5,                        # optional, set 0 to disable retries
)

v0.x → v1.0 migration

The v0.x surface (bb.submit, bb.runs.list, Run.data, Run.angles("knee")) is preserved as a thin shim — your existing code keeps working — but new code should target the v1 resource verbs (client.analyses.create, client.analyses.list, Analysis.metrics, Analysis.angles(joint="knee_R")). The v0.x shims will be removed in v2.0.

Contact

daan@babon.eu — onboarding, quota, bugs.

Docs: https://app.babon.eu/developers/docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

babon-1.0.0.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

babon-1.0.0-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file babon-1.0.0.tar.gz.

File metadata

  • Download URL: babon-1.0.0.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for babon-1.0.0.tar.gz
Algorithm Hash digest
SHA256 74f5312077ef5115122d0572f231f329eb21b53cb8bd74c0902b0144fc76c328
MD5 a12f86750b1d797481e39c1e21b154ae
BLAKE2b-256 ce737f32a89053e08b88c28a32897092b525e39855d7c13ee8f5e2fdbf231af0

See more details on using hashes here.

File details

Details for the file babon-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: babon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for babon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 890bc589a87f6a717a4f1e94866495773ee880fbd9e1abafa67ae0657cf5556f
MD5 a21150d56d9f361f3de956b230218d02
BLAKE2b-256 fa2b6da34d9827af80143c5764ede94b2b806cced0bba6d3923175e777500b1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page