brinnaebent / cgmquantify Goto Github PK
View Code? Open in Web Editor NEWcgmquantify-python package for analyzing glucose and glucose variability
Home Page: https://pypi.org/project/cgmquantify/
License: MIT License
cgmquantify-python package for analyzing glucose and glucose variability
Home Page: https://pypi.org/project/cgmquantify/
License: MIT License
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
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
Hello! Looking forward to working with this package.
However, the initial indentation of the docstring (
cgmquantify/cgmquantify/__init__.py
Line 7 in d4a788c
IndentationError
when attempting a basic from cgmquantify import *
:
Should be an easy fix :)
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.
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.
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
Thank you for this package! I encountered two issues.
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?
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.
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
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.
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
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):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.