Database Summary Graphs

Users

figWidth = min(10, max(usageTotals$protocol+2.4, 5))
if (is.null(history)) {
  cat("No statistics to display")
} else {
  plot <- ggplot(history, aes(recorded_by, fill = isOld)) + 
    geom_bar(width = 0.95*usageTotals$protocol/(usageTotals$protocol+3))
  plot <- plot + guides(fill = guide_legend(title = NULL))
  plot <- plot + scale_fill_manual(drop = FALSE, values = c("blue", "#56B4E9"), 
                                     labels = c(paste("Newer than \n", 
                                     numWeeks, "Weeks", sep = " "),
                                     paste("Older than \n", numWeeks, "Weeks", sep = " ")))
  plot <- plot + labs(title = "Experiment Age", 
                        x = NULL, y = "Number of Expermients")
  plot <- plot + theme(axis.title = element_text(size = rel(1.3)), 
                         plot.title = element_text(size = rel(2)),
                         axis.text = element_text(size = rel(1.1)))
  if (usageTotals$protocol > 29) {
    plot <- plot + scale_x_discrete(labels = NULL)
  } else {
    plot <- plot + theme(axis.text.x = element_text(angle = 40, vjust = 1, hjust = 1))
  }
  plot
}
if (is.null(history)) {
  # pass -- we don't want to print this chart if it's empty
  cat("")
} else {
  plot1 <- ggplot(history, aes(recorded_by, fill = finalizationStatus)) + 
    geom_bar(width = 0.95*usageTotals$protocol/(usageTotals$protocol+3))
  plot1 <- plot1 + guides(fill = guide_legend(title = NULL))
  plot1 <- plot1 + scale_fill_manual(drop = FALSE, values = c("blue", "#56B4E9"))
  plot1 <- plot1 + labs(title = "Experiment Progress", 
                        x = NULL, y = "Number of Expermients")
  plot1 <- plot1 + theme(axis.title = element_text(size = rel(1.3)), 
                         plot.title = element_text(size = rel(2)),
                         axis.text = element_text(size = rel(1.1)))
  if (usageTotals$protocol > 29) {
    plot1 <- plot1 + scale_x_discrete(labels = NULL)
  } else {
    plot1 <- plot1 + theme(axis.text.x = element_text(angle = 40, vjust = 1, hjust = 1))
  }
  plot1
}

Procedures

weeklyStatisticsDat <- copy(weeklyStatisticsData)
noise <- capture.output(weeklyStatisticsDat[ , cumsum := cumsum(protocol)])
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("No statistics to display")
} 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 = paste0(racas::applicationSettings$client.protocol.label," Creation"), x = NULL, 
                        y = paste0("Number of ",racas::applicationSettings$client.protocol.label,"s\nRecorded 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
}
weeklyStatisticsDat <- copy(weeklyStatisticsData)
noise <- capture.output(weeklyStatisticsDat[ , cumsum := cumsum(experiment)])
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("No statistics to display")
} 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 = "Experiment Creation", x = NULL, 
                        y = "Number of Experiments\nRecorded 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
}

Data

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("No statistics to display")
} 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
}
weeklyStatisticsDat <- copy(weeklyStatisticsData)
noise <- capture.output(weeklyStatisticsDat[ , cumsum := cumsum(subject_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("No statistics to display")
} else if (is.null(weeklyStatisticsDat)) {
  cat("")
} else {
  plot4 <- ggplot(weeklyStatisticsDat, aes(date, cumsum)) 
  plot4 <- plot4 + geom_step(colour = "blue", size = rel(1.3))
  plot4 <- plot4 + labs(title = "Raw Data Points Acquired Over Time", x = NULL, 
                        y = "Number of Points\nAcquired to Date")
  plot4 <- plot4 + theme(axis.title = element_text(size = rel(1.3)), 
                         plot.title = element_text(size = rel(2)),
                         axis.text = element_text(size = rel(1.1)))
  plot4
}
link <- paste(getSSLString(), racas::applicationSettings$client.host, ":", 
          file.path(racas::applicationSettings$client.port,
          "dataFiles", "summaryStatistics", "summaryStatistics.csv"), 
          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 April 19, 2024, 1:12 p.m.