TAK-70 diagnosis history

This commit is contained in:
Rafał Piskorski 2021-01-09 11:00:50 +01:00
parent ce5d63b0e7
commit 98dddc9f6e
4 changed files with 82 additions and 22 deletions

View File

@ -16,6 +16,11 @@ profilUI <- function(id) {
Shiny.onInputChange("token", token);
}
);'),
tags$script('Shiny.addCustomMessageHandler("profileActiveTabHandler",
function(arg) {
Shiny.onInputChange("profileActiveTab", 1);
}
);'),
tags$style(HTML("
@ -95,10 +100,18 @@ profilServer <- function(input, output,session) {
session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash)
})
output$profileData<-renderUI({
activeTab=input$profileActiveTab
session$clientData$url_hash
print(activeTab)
if(length(activeTab)==0 || is.null(activeTab) || activeTab!=1){
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 1);')
}
else if(activeTab==1){
r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" ")))
@ -132,6 +145,9 @@ profilServer <- function(input, output,session) {
}
# shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 1);')
}
})
output$btnEditProfile<-renderUI({
@ -151,6 +167,8 @@ profilServer <- function(input, output,session) {
fluidRow(
column(3,
tags$div("Panel sterowania") %>% tagAppendAttributes(class="panel-title")
@ -160,7 +178,7 @@ profilServer <- function(input, output,session) {
tabsetPanel(type = "tabs",
tabPanel("Dane profilowe", tags$div(uiOutput("profileData")
)%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Zakladka 2", tags$div(plotlyOutput("plot2",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Historia pomiarów",value='profileTabs', tags$div(DT::dataTableOutput("historyTable",height = "auto"))%>% tagAppendAttributes(id="profileTabs",class = 'content-wrapper')),
tabPanel("Zakladka 3", tags$div(plotlyOutput("plot3",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Zakladka 4", tags$div(plotlyOutput("plot4",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Zakladka 5", tags$div(DT::dataTableOutput("table1",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper'))
@ -174,25 +192,59 @@ profilServer <- function(input, output,session) {
})
observeEvent(input$profileTabs, {
shinyjs::runjs(' window.location.reload();')})
output$plot1 <- renderPlotly({
g<-ggplot(mpg) +
geom_point(mapping = aes(x = displ, y = hwy))
gg<-ggplotly(g)
gg
})
output$plot2 <- renderPlotly({
output$historyTable <- DT::renderDataTable({
activeTab = input$profileActiveTab
session$clientData$url_hash
print(activeTab)
if(activeTab!=2){
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 2);') }
else{
r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
g<-ggplot(data = mpg, mapping = aes(x = cty, y = hwy)) +
geom_jitter()
# print(typeof(do.call(c,(content(r)$predictions))))
# v<-do.call(c,(content(r)$predictions))
gg<-ggplotly(g)
df_historyTable<-as.data.frame(do.call(rbind, (content(r)$predictions)))
gg
# print(typeof(df_historyTable))
# print(df_historyTable)
df_historyTable<-df_historyTable %>%
select(name,resultValue,localDateTime) %>%
mutate(Akcja="TODO")%>%
rename(
Nazwa = name,
Wynik = resultValue,
Data = localDateTime
)
df_historyTable$Nazwa<-do.call(c, df_historyTable$Nazwa)
df_historyTable$Wynik<-do.call(c, df_historyTable$Wynik)
df_historyTable$Data<-do.call(c, df_historyTable$Data)
print(df_historyTable)
print(df_historyTable$Nazwa)
# as.character(df_historyTable$Nazwa)
# as.numeric(df_historyTable$Wynik)
# as.Date(df_historyTable$Data)
DT::datatable(df_historyTable,options = list(scrollX = TRUE,language=pl))}
})
@ -204,6 +256,8 @@ profilServer <- function(input, output,session) {
gg<-ggplotly(g)
gg
})

View File

@ -366,16 +366,29 @@ margin:0;
}
table.dataTable{
}
table.dataTable td{
color: white;
text-shadow: 1px 0 0.5px black, -1px 0 0.5px black, 0 1px 0.5px black, 0 -1px 0.5px black;
font-family: 'Fjalla One';
text-align:center!important;
}
table.dataTable tr:nth-child(even){
background-color:#C7F9CC!important;
background-color:#00A896!important;
}
table.dataTable tr:nth-child(odd){
background-color:#A7D7AC !important;
background-color:#00c7b2 !important;
}
table.dataTable th{
background-color:white !important;
text-align:center!important;
#color:#028090;
}
.datatables .dataTables_wrapper .dataTables_paginate a{
border:none;

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -27,7 +27,11 @@ public class GeneratorDTO implements Serializable {
List<Prediction> predictionList){
List<PredictionDTO> predictionDTOS = new ArrayList<>();
for (Prediction prediction:predictionList) {
predictionDTOS.add(new PredictionDTO(prediction));
PredictionDTO predictionDTO = new PredictionDTO();
predictionDTO.setName(prediction.getName());
predictionDTO.setLocalDateTime(prediction.getLocalDateTime());
predictionDTO.setResultValue(prediction.getResultValue());
predictionDTOS.add(predictionDTO);
}
return predictionDTOS;