A time-series forecasting extension for pydexcom using Google's TimesFM
Project description
A time-series forecasting extension for pydexcom using Google's TimesFM. Used to predict immediate, short term blood glucose readings.
All modelling and forecasting is performed locally on your device. The only external connections made are with:
- Dexcom Share API: fetching CGM readings following the
pydexcomapproach.- HuggingFace: one-time download of the forecasting model weights on the first run.
Quick Start
- Ensure that you have installed the pydexcom package and enabled the Share service within your Dexcom G7 / G6 / G5 / G4.
pip install pydexcom
- Initialise
pydexcomwith your Dexcom credentials (below shows the simplist route, refere to pydexcom for further instruction).
>>> from pydexcom import Dexcom
>>> dexcom = Dexcom(username="username", password="password")
- Generate a prediction.
>>> from forecose import DexcomForecast
>>> forecaster = DexcomForecast.from_dexcom(
dexcom=dexcom, # pull recent readings from your active 'Dexcom' session
context_len=288, # uses prior day's readings as context
horizon=12 # predicts the next hour
)
>>> predictions = forecaster.forecast()
>>> print(predictions.head())
timestamp predicted_glucose q10 q25 q50 q75 q90
0 2026-06-25 11:01:19.199000+01:00 8.243370 8.244899 8.125346 8.214749 8.266071 8.309934
1 2026-06-25 11:06:19.199000+01:00 8.050682 8.073329 7.738788 8.018662 8.208736 8.303193
2 2026-06-25 11:11:19.199000+01:00 7.897943 7.879324 7.332723 7.783697 8.082028 8.256586
3 2026-06-25 11:16:19.199000+01:00 7.767045 7.738261 6.965607 7.621467 8.026337 8.236394
4 2026-06-25 11:21:19.199000+01:00 7.615633 7.667328 6.668064 7.442780 7.972524 8.216294
What do these predictions mean?
forecose applies the TimesFM PyTorch model to blood glucose values retrieved from the pydexcom Python API interface for Dexcom. The predicted_glucose details a point prediction from the resulting probabilistic distribution over the next hour (12x 5 minute interval readings).
The probability quantiles (from q10 to q90) highlights the prediction confidence band and boundaries for the immediate upcoming glucose readings.
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
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 forecose-0.1.1.tar.gz.
File metadata
- Download URL: forecose-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.18 30 Sep 2025","python":"3.14.3","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d53898eb3e3c615948c53b1e527d5d08ee859c8af493a293f7bed795c0d93a2
|
|
| MD5 |
f4ff257433cf3ef58b773be9643e1ee4
|
|
| BLAKE2b-256 |
d25a80b2774cba2fd24e92096c3b120b79592d9dc03ae07043c9ace9904904e7
|
File details
Details for the file forecose-0.1.1-py3-none-any.whl.
File metadata
- Download URL: forecose-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.18 30 Sep 2025","python":"3.14.3","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abdf54365a4109af7bbb5a91465d75b0f6334816e306634414cdb97e9c0a6f6f
|
|
| MD5 |
16ab5327618e13ce44fe3600db8c00e5
|
|
| BLAKE2b-256 |
68a50ce0967f2c77c3bdd3f1accc01c533463b3e56c54e05bab16c8470491873
|