CGMac (CGM Metrics Calculator)
Overview
This code calculates key metrics from Continuous Glucose Monitoring (CGM) data for multiple individuals. It processes time series glucose data and calculates various statistical measures including mean glucose levels, standard deviation and temporal autocorrelation properties.
Function description
The main function cgmac processes CGM data and returns the following measures for each individual
- Mean glucose level
- Standard deviation of the glucose levels
- Mean of autocorrelation values
- Variance of autocorrelation values
These measures are particularly useful for
- Predicting glucose control abilities including insulin sensitivity, insulin secretion, and insulin clearance
- Prediction of diabetic complications
Lag Parameter Selection
Default Recommendations
For a typical CGM analysis, we recommend the following lag settings based on sampling interval:
- 5-minute sampling interval: lag = 30 (covers 150 minutes)
- 15-minute sampling interval: lag = 10 (covers 150 minutes)
These recommendations are based on capturing temporal correlations over a 150-minute window, which often provides meaningful insights into glucose dynamics. The lag parameter is fully customisable as optimal lag values may vary depending on your research objectives.
Examples of use with different sampling intervals:
import cgmac
# For 5-minute interval data
results_5min = cgmac.cgmac(data=cgm_data_5min, lag=30)
# For 15-minute interval data
results_15min = cgmac.cgmac(data=cgm_data_15min, lag=10)
# Custom lag for specific research needs
results_custom = cgmac.cgmac(data=cgm_data, lag=your_custom_lag)
Prerequisites
Required Python libraries:
- pandas
- statsmodels
- numpy
Input data format
The input DataFrame should be structured as follows
- First column: Individuals IDs
- Second column onwards: Glucose readings (time series data)
- Each row represents a different individual's CGM readings.
Example input data structure:
ID Reading1 Reading2 Reading3 ...
0 1 120 125 118 ...
1 2 115 118 121 ...
Metadata
Release files for cgmac 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cgmac-0.1.0.tar.gz | 8.3 kB | Without provenance | Details for cgmac-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cgmac-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cgmac-0.1.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / cgmac-0.1.0.tar.gz
| Download URL | cgmac-0.1.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02d627677d5eebc2405acbaa19440fc34e470e6333e2472cabbd320093746b48
|
|
BLAKE2b-256 checksum How to use checksums |
dd5a2787720cd2478cfaf1ed7c95f7dffdc65c10e4b6a696acecbfcd8cf42091
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.5
|
Release files / cgmac-0.1.0-py3-none-any.whl
| Download URL | cgmac-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61fc1aad692cc319ccac039a79feb83f11d3e7a847a8649bc7c30e324dcc1c8a
|
|
BLAKE2b-256 checksum How to use checksums |
4882c67e4e0c5682eb81675371c2d2a3d1099c99db052776d0a68d7f431c4137
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.5
|
Security for cgmac 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.