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 | |
|---|---|---|---|
| cgmac-0.1.0.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cgmac-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
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
|