GithubHelp home page GithubHelp logo

brinnaebent / cgmquantify Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 18.0 1.01 MB

cgmquantify-python package for analyzing glucose and glucose variability

Home Page: https://pypi.org/project/cgmquantify/

License: MIT License

Python 10.53% Jupyter Notebook 87.43% TeX 2.04%

cgmquantify's Introduction

Brinnae Bent | @RunsData

I am currently a faculty member in Artificial Intelligence at Duke University, an AI/ML research scientist, and a startup advisor.

As a leader in bridging the gap between research and industry in machine learning, I have led projects and developed algorithms for the largest companies in the world. More importantly, I have built algorithms that have meaningful impacts - from helping people walk to noninvasively monitoring glucose.

My current research interests are in XAI (Explainable AI) and AI in digital health.

cgmquantify's People

Contributors

brinnaebent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cgmquantify's Issues

pip installation issues README.md

I'm installing on Ubuntu and pip throws an error on install due to a missing readme file. Here is the error I am gettting:

Collecting cgmquantify
Using cached cgmquantify-0.5.tar.gz (4.6 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-ms784f7n/cgmquantify_3fb9c5805f8f448fb3aface6a99b80a1/setup.py", line 9, in
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-ms784f7n/cgmquantify_3fb9c5805f8f448fb3aface6a99b80a1/README.md'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

Import functions for Abbott freestyle libre CGM

  • I can provide my personal libre cgm data to build off of

To do:

Build function importlibre (filename)

Test importlibre () function with other functions and test file

Update package and re-release on PyPI

Update user guide instructions

Import functions for Medtronic CGM

Would like importmedtronic(filename) for importing and formatting of Medtronic CGM. Need: data file from Medtronic CGM.
To do:

  • Reach out to Medtronic to get sample CGM file for testing

  • Build function importmedtronic(filename)

  • Test importmedtronic() function with other functions and test file

  • Update package and re-release on PyPI

  • Update user guide instructions

Package as an easily deplorable web service

It would be handy to package this as a one-click deployable web service (perhaps using docker) to easily spin this up on heroku, digital ocean, etc.
The thought being that a user can just drag and drop a cgm file and the service parses it and runs analyses

Incorporate food log into visualization

Would like to include a visualization integrating CGM data with data from food log. Integration with myFitnessPal?

  • Look into integrating with myFitnessPal API, determine feasibility of using myFitnessPal data (timestamps?)

  • Use sample food log and test CGM data, develop visualization that is clear

  • Develop function for visualization

  • Update package on PyPI

  • Update user guide

MAGE calculation

Have you confirmed that the MAGE calculation is working as expected? Maybe my data format is wrong, but it seems like the use of "k" to index the data here is not correct. Shouldn't it be df['Time'][peaks[I]]?

for i in range(len(peaks)):
            excursion_points.loc[k] = [peaks[i]] + [df['Time'][k]] + [df['Glucose'][k]] + ["P"]
            k+=1

Also, I'm confused by the use of stdev here:
for i in range(stdev,len(excursion_points.Index)-stdev):

Installation Issues (won't install)

Trying to install this into Jupyter Notebook running on Sonoma, Python 3.9
error: subprocess-exited-with-error

× git clone --quiet git://github.com/brinnaebent/cgmquantify.git /private/var/folders/bj/1_r114hd37x86dvdcxj7z_8h0000gp/T/pip-req-build-ffsue6al did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --quiet git://github.com/brinnaebent/cgmquantify.git /private/var/folders/bj/1_r114hd37x86dvdcxj7z_8h0000gp/T/pip-req-build-ffsue6al did not run successfully.
│ exit code: 128
╰─> See above for output.

Neither Install 1 or 2 works PIP version is newest

Calculation of % time inside the range is incorret

Describe the bug
I have gone through the python code of the function PIR, there is a typo error, | should be replaced by & in line 210 of the script. As the function is calculating time inside the range.

Warning from Panda DF using cgmquantify with latest versions

I am getting a warning while calculating mean functions in cgmquantify with the latest version of Python. The warning message is as follows:

WARNING:
FutureWarning: In a future version, DataFrame.mean(axis=None) will return a scalar mean over the entire DataFrame. To retain the old behavior, use 'frame.mean(axis=0)' or just 'frame.mean()'
return mean(axis=axis, dtype=dtype, out=out, **kwargs)
SOLUTION:
Correct the CGMQUANTIFY functions as below:

The warning is indicating that in the future, the behavior of DataFrame.mean() will change, and it will return a scalar mean over the entire DataFrame instead of the current behavior of calculating the mean along the specified axis. To avoid this warning, you can modify the code as follows:

import numpy as np

def MGE(df, sd=1):
    up = np.mean(df['Glucose']) + sd * np.std(df['Glucose'])
    dw = np.mean(df['Glucose']) - sd * np.std(df['Glucose'])
    MGE = np.mean(df.loc[(df['Glucose'] >= up) | (df['Glucose'] <= dw), 'Glucose'])
    return MGE

Changes made:

Instead of using np.mean(df[(df['Glucose']>= up) | (df['Glucose']<= dw)]), we use np.mean(df.loc[(df['Glucose']>= up) | (df['Glucose']<= dw), 'Glucose']) to calculate the mean only on the 'Glucose' column.
The loc method is used to access the rows based on the condition (df['Glucose'] >= up) | (df['Glucose'] <= dw) and the 'Glucose' column simultaneously.
By making these changes, the warning related to the DataFrame mean behavior will be avoided.

References Missing & Potentially Incorrect Formula to Calculate MAGE

Thank you for this package! I encountered two issues.

  1. I can't seem to find the references on the page where you give to formulas for each metric: https://github.com/brinnaebent/cgmquantify/blob/master/paper.md. Maybe it was deleted accidentally?

  2. I believe the formula used to calculate MAGE is inaccurate. You give mean glucose outside +- x SD of mean. Which paper is this from? I read the Rawlings:2011; Kovatchev:2019; ADA:2018; and Service 2013 papers and all seem to say mage = mean( AGE ) where AGE is the amplitudes from peak to nadir (or vice versa) that are > 1 SD.

If there is a paper that calculates MAGE using the formula in the package, PLEAAAAAASSSSEEEE send me the link or doi!! I need it for a paper I'm writing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.