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(...)
db.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.1.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.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: biomodels_client-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 86cb75135f653c942a482c6129b5e10844571c0772251a900effd215049745af
MD5 9b691d8bf62948bf7c0a0def66c83727
BLAKE2b-256 9b7745cfaf2e51c1b506b10c68bd69c9b2047d534fed4d750f1593a8d6f5586b

See more details on using hashes here.

Provenance

The following attestation bundles were made for biomodels_client-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for biomodels_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1460c10c8ce3c7e3f8cbcddf42aae7e7331d2eb3a0e5afd8589a29d4dc13738d
MD5 2cb738bc4effc58c6e3446db0a587ce4
BLAKE2b-256 defbd8f2163ab8ea9a5ec0c06097a01cdef05735d7b784caf1311736926bf29d

See more details on using hashes here.

Provenance

The following attestation bundles were made for biomodels_client-0.1.1-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