Giter Site home page Giter Site logo

iglu's People

Contributors

ashoksteelers12 avatar david-a-buchanan avatar irinagain avatar jdreyf avatar johnschwenck avatar jshih08 avatar lylchun avatar marbhic avatar marymartin16 avatar moshimor91 avatar muschellij2 avatar nathaniel-fernandes avatar nhannguyen993 avatar olivroy avatar stevebroll avatar sylvanxu avatar thepratik99 avatar williamsonw avatar

Stargazers

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

Watchers

 avatar  avatar

iglu's Issues

error in gri function

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

gri_error_dataframe.xlsx

Another bug in MAGE algorithm

Hello again.

I'm reporting a new bug in the MAGE algorithm.

In both these lines:

minmax <- append(minmax, min(.data$gl[s1:s2], na.rm = TRUE))

minmax <- append(minmax, max(.data$gl[s1:s2], na.rm = TRUE))

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

Interpolate function fails on BGM data.

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

Backward compatibility of agp function

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

Calculate metrics

tableStat = data.frame("Glucose statistics", "Value")

allow relevant metrics to be calculated in mmol/l and report in mmol/l

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

Unable to calculate MAGE

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"  

Definition of hypoglycemia episode

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

bug in episode_calculation

      # 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

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.