irinagain / iglu Goto Github PK
View Code? Open in Web Editor NEWR package for Interpreting GLUcose data from CGMs (Continuous Glucose Monitors)
Home Page: https://irinagain.github.io/iglu/
R package for Interpreting GLUcose data from CGMs (Continuous Glucose Monitors)
Home Page: https://irinagain.github.io/iglu/
I tried to run the gri() function from iglu on my dataset (see below), but got the following error:
"Error:
! Failed to evaluate glue component {label}
Caused by error in vapply()
:
! values must be length 1,
but FUN(X[[1]]) result is length 0"
I suspect that it is because the data does not contain readings on neither hypoglycemic nor hyperglycemic range? But I might be wrong about it. Would it be possible for you to solve the issue? Thank you
Hello,
Thanks for the great library! :)
Can anyone clarify if this is a bug?
The if statement here https://github.com/irinagain/iglu/blob/master/R/mage_ma_single.R#L211 has the same instructions as the else statement
Line 214 in ccbfe50
Thanks in advance
Are you sure this is the equation
\sum(glucose) * n /30?
https://github.com/stevebroll/iglu/blob/master/R/hypo_index.R#L19
The real issue is that single raises to 2 power:
https://github.com/stevebroll/iglu/blob/master/R/hypo_index.R#L50
but multi is 1.1:
https://github.com/stevebroll/iglu/blob/master/R/hypo_index.R#L60
Hello again.
I'm reporting a new bug in the MAGE algorithm.
In both these lines:
Line 167 in baaf291
Line 171 in baaf291
You're assuming that in both of them (.data$gl[s1:s2], na.rm = TRUE) will always return at least one value that's not NA but in some datasets this will return an empty vector because all values in that range s1:s2 are NA and the min and max of an empty vector is always infinite, resulting in a NA result for the overall MAGE calculation.
I'm attaching a dataset where this occurs, I have a few more in case you need them. Just run the MAGE algorithm in this dataset and you'll see that the final result is NA due to the issue I pointed above.
Thanks for looking into this, I would submit a PR myself but I don't know what the algorithm should do when it encounters an edge case like this.
mage-error.csv
grade_hypo_single doesn't exist, where does this come from in
https://github.com/stevebroll/iglu/blob/master/R/grade_hypo.R#L77
where data is the clean data and subj is created as follows:
subj = data[data$id == data$id[1,] #Get only the first subject
subj$time = as.POSIXct(subj$time) #Force time format
call:
iglu:::CGMS2DayByDay(subj)
Error message:
Error in rep(dt0, ndays * 24 * 60/dt0) : invalid 'times' argument
agp function, works properly in rendering t1 object, Only on using strings as factors=FALSE , on systems with R 3.6 (probably changed with R 4.0). At least this is the case with my system
tableStat = data.frame("Glucose statistics", "Value")
Hi Wondering if there is any plan to implement the ability to process data using glucose values in mmol/L and report on these in mmol/L for the relevant metrics? This would be useful for users in countries that use mmol/l and not mg. Metrics related to time in ranges would require the thresholds and the units to be specified. Thanks Mitch
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5467104/
This is a relatively new metric, that is very useful. Hence, it is increasingly popular. Dexcom, xdrip+ , nightscout et al already support it.
Unfortunately, iglu currently lacks support .
In https://github.com/stevebroll/iglu/blob/master/R/hbgi.R#L22, the power is grouped together (aka it's all to the power of the difference), but in
https://github.com/stevebroll/iglu/blob/master/R/hbgi.R#L49 it's not that calculation
Hi,
My current dataframe is for single participant and I am getting the following error. Not sure what could be the issue
> mage(glucose_data,
+ version = c("ma"),
+ sd_multiplier = 1,
+ short_ma = 5,
+ long_ma = 32,
+ return_type = "num",
+ dt0 = 15,
+ direction = "avg",
+ inter_gap = 45,
+ max_gap = 180,
+ plot = FALSE,
+ title = NA,
+ xlab = NA,
+ ylab = NA,
+ show_ma = FALSE,
+ show_excursions = TRUE
+ )
Error in `[.default`(tr, timeindex - 1) :
only 0's may be mixed with negative subscripts
> colnames(glucose_data)
[1] "time" "gl" "id"
Hi there,
The current definition of level 1 hypoglycemia as per the international consensus (https://pubmed.ncbi.nlm.nih.gov/29162583/) is any cgm reading of <70โ54 mg/dL (3.9โ3.0 mmol/L) for at least 15 min. If I use the episode_calculation function to calculate frequency of level 1 hypoglycemia with lvl1_hypo and lvl2_hypo threshold set at the aforementioned threshold, does the level 1 frequency calculated include all of the cgm reading below 70 mg/dL or only the ones within 70-54 mg/dL range? Thank you
Dear Authors,
would it be possible to contribute to Iglu? I have some ideas for integrating more metrics. Best,
Nico
# HYPO OR HYPER DURATION LENGTH CALCULATION
hyp_result = hyp_episode[2:length(hyp_episode)] - hyp_episode[1:length(hyp_episode)-1]
hyp_end_point = which(hyp_result %in% -1) + 1
hyp_starting_point = which(hyp_result %in% 1) + 1
if (is_hypo){
if(gl_by_id_ip[length(gl_by_id_ip)] <= params[[2]]){
hyp_end_point = c(hyp_end_point, length(hyp_result)) # wrong
hyp_end_point= sort(hyp_end_point)
}
if(gl_by_id_ip[1] <= params[[2]] ) {
hyp_starting_point = c(hyp_starting_point, 1)
hyp_starting_point= sort(hyp_starting_point)
}
}else{
if(gl_by_id_ip[length(gl_by_id_ip)] >= params[[3]]){
hyp_end_point = c(hyp_end_point, length(hyp_result))
hyp_end_point= sort(hyp_end_point)
}
if(gl_by_id_ip[1] >= params[[3]] ) {
hyp_starting_point = c(hyp_starting_point, 1)
hyp_starting_point= sort(hyp_starting_point)
}
}
hyp_dur_length = hyp_end_point - hyp_starting_point
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.