Commit 5d69fcdb authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

work around getting data

parent 592039b3
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny) library(shiny)
library(jsonlite) library(jsonlite)
...@@ -25,8 +17,62 @@ server <- function(input, output) { ...@@ -25,8 +17,62 @@ server <- function(input, output) {
coconut.df <<- json_data_coco[["data"]] coconut.df <<- json_data_coco[["data"]]
lastCoConUT <<- inFile$name lastCoConUT <<- inFile$name
print("coconut:")
print(coconut.df)
if(is.null(coconut.df$timestamp)){}
else{unixTime<<-coconut.df$timestamp}
if(is.null(coconut.df$gps.latitude)){}
else{latitude<<-coconut.df$gps.latitude}
if(is.null(coconut.df$gps.longitude)){}
else{longitude<<-coconut.df$gps.longitude}
if(is.null(coconut.df$gps.speed)){}
else{speed<<-coconut.df$gps.speed}
if(is.null(coconut.df$gps.accuracy)){}
else{gpsAcc<<-coconut.df$gps.accuracy}
if(is.null(coconut.df$light.lux)){}
else{lux<<-coconut.df$light.lux}
if(is.null(coconut.df$acc.coordinates)){}
else{accCoord<<-coconut.df$acc.coordinates}
if(is.null(coconut.df$acc.accuracy)){}
else{accAcc<<-coconut.df$acc.accuracy}
if(is.null(coconut.df$bluetooth.numOfBTDevices)){}
else{bluetooth<<-coconut.df$bluetooth.numOfBTDevices}
if(is.null(coconut.df$ble.bpm)){}
else{bleBpm<<-coconut.df$ble.bpm}
if(is.null(coconut.df$ble.bpmlist)){}
else{bleBpmList<<-coconut.df$ble.bpmlist}
if(is.null(coconut.df$ble.hrv)){}
else{bleHrv<<-coconut.df$ble.hrv}
if(is.null(coconut.df$ble.hrvlist)){}
else{bleHrvList<<-coconut.df$ble.hrvlist}
if(is.null(coconut.df$activity.name)){}
else{activityName<<-coconut.df$activity.name}
if(is.null(coconut.df$activity.confidence)){}
else{activityConf<<-coconut.df$activity.confidence}
if(is.null(coconut.df$screen.status)){}
else{screenstatus<<-coconut.df$screen.status}
if(is.null(coconut.df$interaction.touch)){}
else{touch<<-coconut.df$interaction.touch}
# setting the table style # setting the table style
datatable( datatable(
cbind(coconut.df), cbind(coconut.df),
...@@ -41,6 +87,8 @@ server <- function(input, output) { ...@@ -41,6 +87,8 @@ server <- function(input, output) {
class = 'cell-border stripe' class = 'cell-border stripe'
) )
) )
}) })
output$lastLoadedNut<- renderText({ output$lastLoadedNut<- renderText({
...@@ -59,8 +107,7 @@ server <- function(input, output) { ...@@ -59,8 +107,7 @@ server <- function(input, output) {
#loading CoCoQuest data #loading CoCoQuest data
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_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
...@@ -70,7 +117,6 @@ server <- function(input, output) { ...@@ -70,7 +117,6 @@ server <- function(input, output) {
#unix parsed #unix parsed
dat <- do.call(rbind, json_data_quest$tasks$data) dat <- do.call(rbind, json_data_quest$tasks$data)
endtimes <<- c(anytime(dat$endtime/1000)) endtimes <<- c(anytime(dat$endtime/1000))
...@@ -97,12 +143,7 @@ server <- function(input, output) { ...@@ -97,12 +143,7 @@ server <- function(input, output) {
cbind(tasks, endtimes), cbind(tasks, endtimes),
options = list( options = list(
searching = FALSE, searching = FALSE,
#autoWidth = TRUE,
rownames = TRUE, rownames = TRUE,
#scroller = TRUE,
#scrollX = TRUE,
# scrollY = "500px",
class = 'cell-border stripe' class = 'cell-border stripe'
) )
) )
...@@ -125,36 +166,54 @@ server <- function(input, output) { ...@@ -125,36 +166,54 @@ server <- function(input, output) {
#TODO: Getting HEADER out of json to select it #TODO: Getting HEADER out of json to select it
#Not sure if so smart but it should work that way
output$input_hist_x <- renderUI({ output$input_hist_x <- renderUI({
selectInput("in1", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in1", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE)
}) })
output$input_hist_y <- renderUI({ output$input_hist_y <- renderUI({
selectInput("in1", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in2", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_time_x <- renderUI({ output$input_time_x <- renderUI({
selectInput("in1", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in3", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_time_y <- renderUI({ output$input_time_y <- renderUI({
selectInput("in1", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in4", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_map_x <- renderUI({ output$input_map_x <- renderUI({
selectInput("in1", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in5", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_map_y <- renderUI({ output$input_map_y <- renderUI({
selectInput("in1", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in6", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_line_x <- renderUI({ output$input_line_x <- renderUI({
selectInput("in1", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in7", "x-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
output$input_line_y <- renderUI({ output$input_line_y <- renderUI({
selectInput("in1", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE) if (is.null(input$nut))
return(NULL)
selectInput("in8", "y-axis:", as.list(coconut.df),multiple=TRUE, selectize=TRUE)
}) })
......
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