Metadata-Version: 2.4
Name: modelhealth
Version: 0.4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Dist: pytest>=8 ; extra == 'test'
Requires-Dist: pytest-cov>=5 ; extra == 'test'
Provides-Extra: test
Summary: Python SDK for biomechanical analysis from smartphone videos
Keywords: biomechanics,motion-capture,analysis,modelhealth
Author-email: Model Health <support@modelhealth.io>
License: Apache-2.0
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://docs.modelhealth.io/python-api
Project-URL: Repository, https://github.com/model-health/model-health/examples/python

# Model Health Python SDK

Python SDK for the [Model Health](https://modelhealth.io) biomechanical analysis API.

## Installation

```bash
pip install modelhealth
```

Requires Python 3.11 or later.

## Quick Start

```python
import time
from modelhealth import (
    ModelHealthService,
    ActivityStatus,
    ActivityStatusUploading,
    AnalysisStatus,
)

service = ModelHealthService("your_api_key")

# List sessions created via the mobile app
sessions = service.session_list()
session = sessions[0]

# Get activities for a subject
subjects = service.subject_list()
activities = service.activities_for_subject(
    str(subjects[0].id), start_index=0, count=20
)
activity = activities[0]

# Poll until processing is complete
status = service.activity_status(activity)
while isinstance(status, ActivityStatusUploading) or status == ActivityStatus.processing:
    time.sleep(10)
    status = service.activity_status(activity)

# Run analysis
task = service.start_analysis("gait", activity, session)
analysis_status = service.analysis_status(task)
while analysis_status == AnalysisStatus.processing:
    time.sleep(10)
    analysis_status = service.analysis_status(task)

# Download results
import json
results = service.analysis_data_for_activity(activity, ["metrics"])
metrics = json.loads(results[0].data)
```

## Documentation

Full documentation: [docs.modelhealth.io](https://docs.modelhealth.io)

## License

Apache 2.0

