Commit 592039b3 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

cocoQuest Import and tableview now right, PROBLEM: showing date/time in shiny GUI

parent a11186f4
...@@ -44,17 +44,14 @@ server <- function(input, output) { ...@@ -44,17 +44,14 @@ server <- function(input, output) {
}) })
output$lastLoadedNut<- renderText({ output$lastLoadedNut<- renderText({
lastCoConUT if (is.null(input$nut))
return(NULL)
else lastCoConUT
}) })
#CoCOQuest Data import and showing into data site
output$lastLoadedQuest <- renderText({
})
output$questTimes <- renderDataTable({ output$questTimes <- renderDataTable({
inFile <- input$quest inFile <- input$quest
if (is.null(inFile)) if (is.null(inFile))
...@@ -64,28 +61,40 @@ server <- function(input, output) { ...@@ -64,28 +61,40 @@ server <- function(input, output) {
json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
#print("json_data_qest") #print("json_data_qest")
#print(json_data_quest) #print(json_data_quest)
#lastCoCoQuest <<- inFile$name lastCoCoQuest <<- inFile$name
json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000 json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000 json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
starttime <- anytime(json_data_quest$unix_starttime) totalStarttime <<- anytime(json_data_quest$unix_starttime)
endtime <- anytime(json_data_quest$unix_endtime) totalEndtime <<- anytime(json_data_quest$unix_endtime)
#unix parsed #unix parsed
questTimes <<- c(starttime ,endtime)
print("questTime")
print(questTimes)
mat <- matrix(questTimes,1,2) dat <- do.call(rbind, json_data_quest$tasks$data)
#mat <- matrix(as.Date(questTimes),1,2)
endtimes <<- c(anytime(dat$endtime/1000))
tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
#count<<-0
# y <<-1
# x<<-1
#numOfTasks <<- if(tasks[x]!=y)
# {
# count<<-count+1
# y<<-y+1
# x<<-x+1
#}
#else{x<<-x+1}
together <<- c(tasks, endtimes)
#all <<- matrix(c(tasks,endtimes),byrow=FALSE,nrow=length(tasks))
all <- rbind(together)
print("mat")
print(mat)
colnames(mat)<-c("Starttime", "Endtime")
#setting the table style #setting the table style
datatable( datatable(
cbind(mat), cbind(tasks, endtimes),
options = list( options = list(
searching = FALSE, searching = FALSE,
#autoWidth = TRUE, #autoWidth = TRUE,
...@@ -99,36 +108,20 @@ server <- function(input, output) { ...@@ -99,36 +108,20 @@ server <- function(input, output) {
) )
}) })
#TODO: CoCoQuest Output --> Ansätze data[] raus nehmen oder flatten richtig funken #CoCOQuest Data import and showing into data site
##output$file2 <- renderDataTable({ output$lastLoadedQuest <- renderText({
# inFile <- input$file2 if (is.null(input$quest))
#if (is.null(inFile)) return(NULL)
# return(NULL) else lastCoCoQuest
#simplifyVector <- c("studyID", "studyName", "description", "tasks$endTime" , "id", "startTime", "endTime")
#json_data_quest <- fromJSON(paste(inFile$datapath, sep = ""), simplifyVector = TRUE, simplifyDataFrame = simplifyVector,
# simplifyMatrix = simplifyVector, flatten = TRUE)
#lastLoadedQuest<<-inFile$name
#print("with simplify: ")
#print(json_data_quest)
## ANSATZ zum rauslesen der Times: --> not working now
#questLength <<- length(json_data_quest)
#print("length")
#print(questLength)
#data <- c(json_data_quest$tasks[[1]]$`data`[[1]]$endtime, json_data_quest$tasks[[1]]$`data`[[2]]$endtime, json_data_quest$tasks[[1]]$startTime, json_data_quest$tasks[[1]]$endTime, json_data_quest$tasks[[2]]$`data`[[1]]$endtime, json_data_quest$tasks[[2]]$`data`[[2]]$endtime, json_data_endtime$tasks[[2]]$`data`[[3]]$endtime)
#data<-c(json_data_quest$tasks[[1]]$startTime, json_data_quest$tasks[[1]]$endTime, json_data_quest$tasks[[2]]$startTime, json_data_quest$tasks[[2]]$endTime )
#x<<-0
#for(x in x:questLength)
#{data<<-c(json_data_quest$tasks[[x]]$startTime, json_data_quest$tasks[[x]]$endTime)
#x=x+1}
#print("data: ")
#print(data)
##}) })
output$totalStarttime <- renderText({
if (is.null(input$quest))
return(NULL)
else as.POSIXct(totalStarttime)
print(totalStarttime)
})
#TODO: Getting HEADER out of json to select it #TODO: Getting HEADER out of json to select it
......
...@@ -48,14 +48,16 @@ ui <- dashboardPage( ...@@ -48,14 +48,16 @@ ui <- dashboardPage(
tabItem(tabName = "data", tabItem(tabName = "data",
h2("CoConUT Data here:"), h2("CoConUT Data here:"),
"Last Loaded CoConUT Data: ", h4("Last Loaded CoConUT Data: "),
textOutput("lastLoadedNut"), textOutput("lastLoadedNut"),
dataTableOutput("nut"), dataTableOutput("nut"),
h2("CoCoQuest Data here:"), h2("CoCoQuest Data here:"),
"Last Loaded CoCoQuest Data: ", h4("Last Loaded CoCoQuest Data: "),
textOutput("lastLoadedQuest"), textOutput("lastLoadedQuest"),
h4("Starttime: "),
textOutput("totalStarttime"),
dataTableOutput("questTimes") dataTableOutput("questTimes")
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment