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.1.0.tar.gz (48.9 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.1.0-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for babon-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5cf60dd6da87fb4089403a46bf514ef0d3bbc8ec8f3eec5b0865e2c5cb9bae84
MD5 cdb864d0c8da5c99349703afdab6c07b
BLAKE2b-256 13920c5bed4eab0b6eeca29a3b909ea1a46a4063ab0c6e3467169a83a7149817

See more details on using hashes here.

File details

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

File metadata

  • Download URL: babon-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 56.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bf06956adf670e6c72cd0018a47784cf8d99d606b668ccd3b82ddc68352c6bd
MD5 72dde44693ef741eca6733917674efa1
BLAKE2b-256 a1050735d7364981e60453ce7bf45440470e5e1ad5472d79afb8c93db824179b

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