vubiostat / redcapAPI

R interface to REDCap (http://www.project-redcap.org/)
21 stars 27 forks source link

exportLogging needs batching #383

Closed spgarbet closed 6 months ago

spgarbet commented 6 months ago

exportLogging as a project grows becomes too large. It needs a batchInterval parameter which specifies how many days to batch the call by and it defaults to NULL. If specified calls are batched up to the current time. It will require that the beginTime be specified if batchInterval is provided.

spgarbet commented 6 months ago
do.call(rbind,
  lapply(
    seq(as.Date(beginTime), to=Sys.Date(), by=batchInterval),
    function(x) exportLogging(rcon, 
                              beginTime=as.POSIXct(x),
                              endTime  =as.POSIXct(x+batchInterval))
  )
)
obregos commented 6 months ago

This looks to be working:

logs <- do.call(rbind,
        lapply(
          seq(as.Date(beginTime), to=Sys.Date(), by=batchInterval),
          function(x) exportLogging(rcon, beginTime=as.POSIXct(x), endTime=as.POSIXct(x+batchInterval))
        )
)
spgarbet commented 6 months ago

Complete and merged