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,12 +44,9 @@ server <- function(input, output) {
})
output$lastLoadedNut<- renderText({
lastCoConUT
})
#CoCOQuest Data import and showing into data site
output$lastLoadedQuest <- renderText({
if (is.null(input$nut))
return(NULL)
else lastCoConUT
})
......@@ -64,28 +61,40 @@ server <- function(input, output) {
json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
#print("json_data_qest")
#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_endtime <- as.numeric(json_data_quest$endTime)/1000
starttime <- anytime(json_data_quest$unix_starttime)
endtime <- anytime(json_data_quest$unix_endtime)
totalStarttime <<- anytime(json_data_quest$unix_starttime)
totalEndtime <<- anytime(json_data_quest$unix_endtime)
#unix parsed
questTimes <<- c(starttime ,endtime)
print("questTime")
print(questTimes)
mat <- matrix(questTimes,1,2)
#mat <- matrix(as.Date(questTimes),1,2)
dat <- do.call(rbind, json_data_quest$tasks$data)
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
datatable(
cbind(mat),
cbind(tasks, endtimes),
options = list(
searching = FALSE,
#autoWidth = TRUE,
......@@ -99,36 +108,20 @@ server <- function(input, output) {
)
})
#TODO: CoCoQuest Output --> Ansätze data[] raus nehmen oder flatten richtig funken
##output$file2 <- renderDataTable({
# inFile <- input$file2
#if (is.null(inFile))
# return(NULL)
#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 )
#CoCOQuest Data import and showing into data site
output$lastLoadedQuest <- renderText({
if (is.null(input$quest))
return(NULL)
else lastCoCoQuest
#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
......
......@@ -48,14 +48,16 @@ ui <- dashboardPage(
tabItem(tabName = "data",
h2("CoConUT Data here:"),
"Last Loaded CoConUT Data: ",
h4("Last Loaded CoConUT Data: "),
textOutput("lastLoadedNut"),
dataTableOutput("nut"),
h2("CoCoQuest Data here:"),
"Last Loaded CoCoQuest Data: ",
h4("Last Loaded CoCoQuest Data: "),
textOutput("lastLoadedQuest"),
h4("Starttime: "),
textOutput("totalStarttime"),
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