A time-series forecasting extension for pydexcom using Google's TimesFM
Project description
forecose
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
>>> predictions = DexcomForecast().get_forecast(dexcom)
>>> print(predictions)
timestamp predicted_glucose q10 q25 q50 q75 q90
0 2026-06-26 11:41:22.163000+01:00 123.036758 122.259880 114.010910 121.040176 126.698639 130.737625
1 2026-06-26 11:46:22.163000+01:00 117.917084 119.255325 103.586609 114.847458 124.962013 130.337677
2 2026-06-26 11:51:22.163000+01:00 112.936745 114.285713 93.414429 108.460175 122.032082 130.147263
3 2026-06-26 11:56:22.163000+01:00 108.864471 111.334473 85.159195 103.118362 120.449158 129.664490
4 2026-06-26 12:01:22.163000+01:00 105.268646 110.067360 77.075996 98.538086 119.166481 129.867401
5 2026-06-26 12:06:22.163000+01:00 102.510818 108.663223 71.013176 94.973129 118.314079 130.784134
6 2026-06-26 12:11:22.163000+01:00 100.653397 106.934074 66.480339 92.466553 119.067230 132.150269
7 2026-06-26 12:16:22.163000+01:00 100.558281 107.133316 64.823494 91.983261 119.827232 135.091919
8 2026-06-26 12:21:22.163000+01:00 100.579796 109.257736 61.783752 91.251221 122.283157 138.308975
9 2026-06-26 12:26:22.163000+01:00 100.584198 108.955002 59.392654 90.392227 124.204987 140.372147
10 2026-06-26 12:31:22.163000+01:00 100.988571 111.358139 57.296143 89.819542 125.757668 143.972672
11 2026-06-26 12:36:22.163000+01:00 101.895081 112.446609 58.076065 89.992996 128.253937 146.511047
>>> print(predictions.mmol_l)
timestamp predicted_glucose q10 q25 q50 q75 q90
0 2026-06-26 11:41:22.163000+01:00 6.8 6.8 6.3 6.7 7.0 7.3
1 2026-06-26 11:46:22.163000+01:00 6.5 6.6 5.7 6.4 6.9 7.2
2 2026-06-26 11:51:22.163000+01:00 6.3 6.3 5.2 6.0 6.8 7.2
3 2026-06-26 11:56:22.163000+01:00 6.0 6.2 4.7 5.7 6.7 7.2
4 2026-06-26 12:01:22.163000+01:00 5.8 6.1 4.3 5.5 6.6 7.2
5 2026-06-26 12:06:22.163000+01:00 5.7 6.0 3.9 5.3 6.6 7.3
6 2026-06-26 12:11:22.163000+01:00 5.6 5.9 3.7 5.1 6.6 7.3
7 2026-06-26 12:16:22.163000+01:00 5.6 5.9 3.6 5.1 6.7 7.5
8 2026-06-26 12:21:22.163000+01:00 5.6 6.1 3.4 5.1 6.8 7.7
9 2026-06-26 12:26:22.163000+01:00 5.6 6.0 3.3 5.0 6.9 7.8
10 2026-06-26 12:31:22.163000+01:00 5.6 6.2 3.2 5.0 7.0 8.0
11 2026-06-26 12:36:22.163000+01:00 5.7 6.2 3.2 5.0 7.1 8.1
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.2.1.tar.gz.
File metadata
- Download URL: forecose-0.2.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3e5f32eb73042f4dc1328087838b3c17bbb33d5fb191dc3826318e7441ed014
|
|
| MD5 |
4992bdc45cf7543dd71bf456a5c12733
|
|
| BLAKE2b-256 |
73e5a21db9ad042b760230cfa3d1405ffc7699e13747a2523f76ae5019fcc151
|
Provenance
The following attestation bundles were made for forecose-0.2.1.tar.gz:
Publisher:
publish.yml on aes21/forecose
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forecose-0.2.1.tar.gz -
Subject digest:
e3e5f32eb73042f4dc1328087838b3c17bbb33d5fb191dc3826318e7441ed014 - Sigstore transparency entry: 1967717226
- Sigstore integration time:
-
Permalink:
aes21/forecose@34dc7e912e2001efae2c0bb5f08bd82ab7674f9f -
Branch / Tag:
refs/tags/v.0.2.1 - Owner: https://github.com/aes21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@34dc7e912e2001efae2c0bb5f08bd82ab7674f9f -
Trigger Event:
release
-
Statement type:
File details
Details for the file forecose-0.2.1-py3-none-any.whl.
File metadata
- Download URL: forecose-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21eec997b1ea1a68d37e94dc0b92b11173ea7cff876b1c57f2ae8b5d1e94b832
|
|
| MD5 |
edc225a1d74b9d17f80276bfa9d9cde5
|
|
| BLAKE2b-256 |
9eed1118ad0d29266259eb92339c2764c23006c2712e76cc60fc53266461e2aa
|
Provenance
The following attestation bundles were made for forecose-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on aes21/forecose
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forecose-0.2.1-py3-none-any.whl -
Subject digest:
21eec997b1ea1a68d37e94dc0b92b11173ea7cff876b1c57f2ae8b5d1e94b832 - Sigstore transparency entry: 1967717298
- Sigstore integration time:
-
Permalink:
aes21/forecose@34dc7e912e2001efae2c0bb5f08bd82ab7674f9f -
Branch / Tag:
refs/tags/v.0.2.1 - Owner: https://github.com/aes21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@34dc7e912e2001efae2c0bb5f08bd82ab7674f9f -
Trigger Event:
release
-
Statement type: