cat("Total number of protocols: ", prettyNum(usageTotals$protocol, big.mark = ","))
cat("Total number of experiments: ", prettyNum(usageTotals$experiment, big.mark = ","))
cat("Total number of users who have uploaded experiments: ", prettyNum(usageTotals$user, big.mark = ","))
cat("Total number of samples measured: ", prettyNum(usageTotals$subject_value, big.mark = ","))
cat("<p style='margin-bottom:20px;'>", "Total number of calculated results: ", prettyNum(usageTotals$analysis_group_value, big.mark = ","), "</p>")
weeklyStatisticsDat <- copy(weeklyStatisticsData)
noise <- capture.output(weeklyStatisticsDat[ , cumsum := cumsum(analysis_group_value)])
sumZero <- which(weeklyStatisticsDat$cumsum == 0)
if(length(sumZero) > 0) {
  maxZeroCumSumRow <- max(sumZero)
  weeklyStatisticsDat <- weeklyStatisticsDat[maxZeroCumSumRow:nrow(weeklyStatisticsDat)]
}
if (is.null(weeklyStatisticsDat) | nrow(weeklyStatisticsDat) == 1) {
  cat("Not enough statistics yet to display chart")
} else if (is.null(weeklyStatisticsDat)) {
  cat("")
} else {

  plot3 <- ggplot(weeklyStatisticsDat, aes(date, cumsum)) 
  plot3 <- plot3 + geom_step(colour = "blue", size = rel(1.3))
  plot3 <- plot3 + labs(title = "Calculated Results Over Time", x = NULL, 
                        y = "Number of Results\nCalculated to Date")
  plot3 <- plot3 + theme(axis.title = element_text(size = rel(1.3)), 
                         plot.title = element_text(size = rel(2)),
                         axis.text = element_text(size = rel(1.1)))
  plot3
}
link <- paste(getSSLString(), racas::applicationSettings$client.host, ":", 
          file.path(racas::applicationSettings$client.port,
          "dataFiles", "summaryStatistics", "summaryStatistics.csv"), 
          sep = "")
graphLink <- paste(getSSLString(), racas::applicationSettings$client.host, ":", 
          file.path(racas::applicationSettings$client.port,
          "dataFiles", "summaryStatistics", "summaryStatisticsGraphs.html"), 
          sep = "")
cat("<p style='margin-top:30px;'>For more graphs, <a href='",
    graphLink, "' target='_blank' >click here</a>", "</p>", sep="")
if (is.na(Sys.timezone())) {
  timezone <- ""
} else {
  timezone <- Sys.timezone()
}
cat("Summary statistics generated on ", date(), " ", timezone, ". Data can be downloaded at <a href='",
    link, "' target='_blank' >this link</a>", sep="")


mcneilco/racas documentation built on Feb. 22, 2024, 10:07 p.m.