Metadata-Version: 2.1
Name: diametrics
Version: 0.4.3
Summary: A package for calculating the metrics of glycemic control for Diabetes from CGM data
License: MIT
Author: Catherine Russon
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: ipykernel (>=6.29.4,<7.0.0)
Requires-Dist: nbformat (>=5.10.4,<6.0.0)
Requires-Dist: numpy (>=1.26.4,<2.0.0)
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: plotly (>=5.21.0,<6.0.0)
Requires-Dist: pytest (>=8.1.1,<9.0.0)
Requires-Dist: scikit-learn (>=1.4.2,<2.0.0)
Requires-Dist: scipy (>=1.13.0,<2.0.0)
Requires-Dist: statistics (>=1.0.3.5,<2.0.0.0)
Description-Content-Type: text/markdown

# Diametrics
Diametrics is a Python package and associated [WebApp](https://diametrics.org) designed for the analysis of Continuous Glucose Monitoring (CGM) data. 

The goal of this package is to enable researchers to quickly calculate the metrics of diabetes control outlined in the [international consensus on the use of continuous glucose monitors](https://diabetesjournals.org/care/article/40/12/1631/37000/International-Consensus-on-Use-of-Continuous) in Python.
 

Diametrics has functionality for data preprocessing, calculating standard metrics of glycemic control and data visualization, using Plotly.


## Contents 
The diametrics functions are contained within a metrics.py file. The functions are

`all_metrics` calculates all of the below metrics

`average_glucose` mean glucose data given

`time_in_range` % time spent in normal (3.9-10mmol/L), hyperglycaemia (>10) and hypoglycaemia (<3.9). Hyper- and hypo-glycaemia are also broken down to % time in level 1 and level 2

`glycemic_variability` standard deviation (SD), coefficient of variation (CV) and min and max glucose

`ea1c` estimated A1c

`hypoglycemic_episodes` the number of level 1 and level 2 hypoglycemic episodes, plus an optional breakdown of every episode with start and end times

`percent_missing` percentage of data missing between two timepoints

## How to use?
 The functions take Pandas dataframes as the arguments along with the column names for the glucose readings and time. The functions can be used on datasets with only one person's data or can be used on a combined dataframe with an ID column, whose name can be specified if present.

For some of the functions there is an option to switch the thresholds to exercise thresholds, rather than normal ones.

