diametrics
A Python package for calculating the metrics for diabetes control from CGM and FGM data
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Repository
A Python package for calculating the metrics for diabetes control from CGM and FGM data
Basic Info
Statistics
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
- Releases: 9
Metadata Files
README.md
Diametrics
Diametrics is a Python package and associated WebApp designed for analyzing Continuous Glucose Monitoring (CGM) data. This package enables researchers and clinicians to streamline their workflow by providing tools for data preprocessing, metric calculation, and visualization, following international standards for diabetes control.
Features
- Data Preprocessing: Convert raw CGM data from multiple device formats (Libre, Dexcom, Medtronic) into a standardized format. Fill missing data, handle outliers, and set time windows for focused analysis.
- Glycemic Metrics: Calculate a comprehensive set of glycemic control metrics including averages, variability, time in range (TIR), glycemic risk index (GRI), estimated A1c (eA1c), and hypoglycemic/hyperglycemic episodes.
- Visualizations: Generate interactive plots and graphs, such as glucose traces, pie charts for TIR distribution, and ambulatory glucose profiles, using Plotly.
Installation
Install Diametrics using pip:
bash
pip install diametrics
Quick Start
1. Load Your Data
The package supports multiple file formats and devices. Use the provided functions to standardize your CGM data: ```python from diametrics.transform import openfile, convertlibre, convertdexcom, convertmedtronic
data = openfile("data.csv") standardizeddata = convert_libre(data) # For Libre device ```
2. Preprocess Your Data
Use preprocessing functions to clean and format your data: ```python from diametrics.preprocessing import replacecutoffs, fillmissing_data
cleandata = replacecutoffs(standardizeddata, cap=True) filleddata = fillmissingdata(clean_data) ```
3. Calculate Metrics
Leverage the metrics module to calculate all glycemic control metrics: ```python from diametrics.metrics import allstandardmetrics
results = allstandardmetrics(filled_data, units='mmol') ```
4. Visualize Your Results
Generate interactive plots to explore your data: ```python from diametrics.visualizations import glucosetrace, tirpie
glucoseplot = glucosetrace(filleddata) glucoseplot.show()
piechart = tirpie(filleddata) piechart.show() ```
Functionalities
Data Preprocessing
replace_cutoffs: Handle outlier glucose values by capping or replacing them.fill_missing_data: Interpolate missing CGM readings using customizable methods.set_time_frame: Filter data by specific time windows.detect_units&change_units: Automatically identify and convert glucose units (mmol/L or mg/dL).
Metric Calculations
- Averages & Variability: Mean glucose, standard deviation, and coefficient of variation (CV).
- Time in Range (TIR): Calculate the percentage of time spent in normal, hyperglycemic, and hypoglycemic ranges.
- Estimated A1c (eA1c): Predict HbA1c levels based on average glucose.
- Hypoglycemic/Hyperglycemic Episodes: Identify and summarize episodes with level 1 and level 2 thresholds.
- Glycemic Risk Index (GRI): Score for risk associated with glucose levels.
Visualization
- Glucose Trace: A line graph representing glucose trends over time.
- TIR Pie Chart: A breakdown of the time spent in different glycemic ranges.
- Ambulatory Glucose Profile (AGP): Percentile-based summary of glucose patterns.
- Box and Violin Plots: Display glucose distribution across subjects.
Documentation
Comprehensive documentation is currently under development. In the meantime, please refer to this README and the inline comments within the code for guidance on using the package.
Contributing
We welcome contributions! Please follow these steps:
1. Fork the repository.
2. Create a feature branch: git checkout -b feature-name
3. Commit your changes: git commit -m 'Add feature'
4. Push to the branch: git push origin feature-name
5. Create a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For support, please contact cr591@exeter.ac.uk.
Owner
- Login: cafoala
- Kind: user
- Repositories: 2
- Profile: https://github.com/cafoala
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Russon
given-names: Catherine
orcid: https://orcid.org/0000-0001-6785-6477
title: "Diametrics: an open-source Python package for calculating common metrics of glycemic control"
version: 1.1.
doi: 10.5281/zenodo.1234
date-released: 2021-08-11
GitHub Events
Total
- Release event: 2
- Watch event: 1
- Push event: 6
- Fork event: 2
- Create event: 6
Last Year
- Release event: 2
- Watch event: 1
- Push event: 6
- Fork event: 2
- Create event: 6
Dependencies
- numpy ~= 1.24.2
- pandas ~= 2.0.0
- scikit-learn ~= 1.2.2
- scipy ~= 1.10.1
- statistics ~= 1.0.3.5