Skip to main content

Python client and import tools for the BioModelle API

Project description

Biomodels Client

Python tools for importing wearable sensor data and interacting with the Biomodels API.

The package provides utilities for importing, querying and analysing sensor data, preparing API payloads, and submitting requests to the BioModelle API.

https://biomodels.tkimhofer.dev/docs

Features

  • Import Apple Health exports ("export.xml" or .zip)
  • Query and explore sensor data using pandas and SQL
  • Prepare API payloads directly from sensor measurements
  • Submit requests to the BioModelle API

Installation

pip install biomodels-client

Quick Start

Apple Health Export

Open the Health app on iPhone, tap the profile picture, select Export All Health Data. The generated ZIP archive contains an export.xml file that can be imported by biomodels-client.

1. Import Apple Health data

The importer accepts both export.xml files and Apple Health ZIP exports.

from biomodels_client.database import SensorStore
from biomodels_client.importers.apple_health import AppleHealthImporter

db = SensorStore("wearables.sqlite")

AppleHealthImporter(
    "/path/to/apple_health_export/export.xml"
).write_to(db)

2. Explore sensor data

from biomodels_client.database import SensorStore

db = SensorStore("wearables.sqlite")

sources = db.query("""
SELECT
    source_name,
    COUNT(*) AS n,
    MIN(time_start) AS date_min,
    MAX(time_end) AS date_max
FROM measurements
GROUP BY source_name
ORDER BY n DESC
""")

print(sources)

3. Calculate TRIMP from wearable data

from biomodels_client.client import BioModelleClient
from biomodels_client.database import SensorStore

db = SensorStore("wearables.sqlite")

hr_ruhe = db.estimate_hr_rest(months=12)
hr_max = db.estimate_hr_max(months=24)

payload = db.trimp_payload(
    start="2026-06-17 06:00",
    end="2026-06-18 23:00",
)

client = BioModelleClient()

result = client.trimp(
    **payload,
    geschlecht="m",
    hr_ruhe=hr_ruhe,
    hr_max=hr_max,
)

print(result)

Example Scripts

Wearable Sensor Workflow

examples/
└── wearable_to_trimp/
    ├── 01_import_apple_health.py
    ├── 02_inspect_sensor_store.py
    ├── 03_sensor_to_trimp.py
    └── 04_submit_trimp.py

API Reference

examples/
└── api_reference/
    └── all_endpoints.py

SensorStore

The SensorStore class provides:

db.select_heart_rate(...)
db.select_best_heart_rate_source(...)

db.estimate_hr_rest(...)
db.estimate_hr_max(...)

db.trimp_payload(...)

db.query(...)
de.execute(...)

for exploration and preparation of wearable sensor data.

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

biomodels_client-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

biomodels_client-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file biomodels_client-0.1.0.tar.gz.

File metadata

  • Download URL: biomodels_client-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for biomodels_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11a8b8fd2e66d40908fb53fd184fb041e74e851d750faa86d0a75ece678e3c56
MD5 019b7e0258c82985844661a09750e79f
BLAKE2b-256 4a8cb9a15980f11746eeb652f65a375ef0fb460e3420d468e076a0c975fc2bfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for biomodels_client-0.1.0.tar.gz:

Publisher: python-publish.yml on tkimhofer/biomodels-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biomodels_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for biomodels_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46aea5b16cdf6a4895fedf64149bef580f57625d29d7dc3c15ec69b3d1351321
MD5 988281ec001b7d28a9b5fae622bca244
BLAKE2b-256 b8c6f83af5c485c3a5ba3524c1199954a7473e88590ad6768c495104476936f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for biomodels_client-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on tkimhofer/biomodels-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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