Python client for the GlucoGuard diabetes and cardiovascular risk prediction API
Project description
glucoguard — Python SDK
Tiny Python client for the GlucoGuard REST API.
Install
pip install glucoguard
Or vendor it directly — the whole client is one file (glucoguard/client.py)
with only requests as a dependency.
Quick start
from glucoguard import GlucoGuard
gg = GlucoGuard(api_key="sk_live_...")
result = gg.predict_diabetes(
age=55, gender=0, bmi=30,
systolic_bp=140, diastolic_bp=88,
hba1c=6.5,
)
print(f"Risk: {result.risk_score}% ({result.risk_category})")
for factor in result.top_factors[:3]:
print(f" {factor.feature}: {factor.direction} ({factor.shap_value:+.3f})")
Batch predictions
patients = [
{"age": 55, "gender": 0, "bmi": 30, "systolic_bp": 140, "diastolic_bp": 88},
{"age": 35, "gender": 1, "bmi": 22, "systolic_bp": 118, "diastolic_bp": 72},
]
batch = gg.predict_batch(patients)
print(f"Processed {batch.total} patients in {batch.processing_time_ms:.0f}ms")
Webhook batch jobs
For long-running jobs, provide a webhook URL and GlucoGuard will POST the results to your endpoint when the batch completes:
job = gg.predict_batch(patients, webhook_url="https://your-server.com/glucoguard-hook")
print(job["job_id"], job["status"]) # "queued"
The webhook receives JSON with {job_id, status, completed_at, result}.
The X-GlucoGuard-Job-Id header is set on the delivery request.
PDF reports
from pathlib import Path
pdf_bytes = gg.generate_pdf_report(
patient={"age": 55, "gender": 0, "bmi": 30, ...},
diabetes_result={"risk_score": 52.3, "risk_category": "moderate", ...},
cvd_result={"risk_score": 38.1, "risk_category": "low", ...},
patient_name="Jane Smith",
)
Path("report.pdf").write_bytes(pdf_bytes)
Error handling
Every failure raises GlucoGuardError with a status_code attribute.
from glucoguard import GlucoGuard, GlucoGuardError
gg = GlucoGuard(api_key="sk_live_...")
try:
result = gg.predict_diabetes(age=55, gender=0, bmi=30, systolic_bp=140, diastolic_bp=88)
except GlucoGuardError as exc:
if exc.status_code == 401:
print("Bad API key")
elif exc.status_code == 429:
print("Rate limited — back off and retry")
else:
print(f"API error: {exc}")
Ops endpoints
gg.health() # liveness probe
gg.status() # full status with model versions and uptime
gg.model_info("diabetes")
gg.sample_patients()
Links
- API docs: https://glucoguard.analyticadss.com/docs
- Homepage: https://glucoguard.analyticadss.com
- Issues: mailto:api@analyticadss.com
Built by Analytica Data Science Solutions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glucoguard-0.1.0.tar.gz.
File metadata
- Download URL: glucoguard-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39fddcfbb630ff7cd46ca06ccfdba74f0fb7759fa2a61c94e2b3d38f40cef7af
|
|
| MD5 |
22bacab642e2ae329d101c71e6c05638
|
|
| BLAKE2b-256 |
310e4acc720ea31291fb41c9af105d5de1bd8eec304dde1d56cdd7c1d69ee479
|
File details
Details for the file glucoguard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: glucoguard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0e6cf97f8c008133fcd1eaffa64531551530feebabe9c41a6802dd51166c43e
|
|
| MD5 |
a692cce3193bfcaaedd4db652bdbde60
|
|
| BLAKE2b-256 |
55910e6c0d849e331d72817a7ea51b80fa153d1eae28c569aaecc80f0dd125a5
|