Commit 98028c83 authored by Andrii's avatar Andrii

UI updates

parent 84460177
......@@ -13,6 +13,14 @@ library(DT)
path_temp_files <- "data"
# 2. Functions ------------------------------------------------------------
# Function
createLink <- function(value) {
sprintf('<a href="%s" target="_blank" class="btn btn-primary">Info</a>', value)
}
# Country code ------------------------------------------------------------
country_name <- function(code){
......@@ -124,6 +132,7 @@ if (exist_cash()){
df_type <- read_df("wp_esi_type")
df_news <- read_df("wp_esi_news")
df_tag <- read_df("wp_esi_tag")
df_radar <- read_df("wp_esi_radar")
# tags cross-tables
df_tag_entity <- read_df("wp_esi_tag_entity")
......@@ -131,6 +140,7 @@ if (exist_cash()){
# news cross-tables
df_news_entity <- read_df("wp_esi_news_entity")
df_news_radar <- read_df("wp_esi_news_radar")
# Packages management
detach("package:RMySQL", unload=TRUE)
......@@ -145,7 +155,7 @@ if (exist_cash()){
# Connect db
db <- dbConnect(MySQL(), user='analyst', password='exa_analyst1&',
dbname='esi_management',
dbname='eis_prod', #'esi_management',
host='lecanaldb.c12hbxfn3xzn.eu-west-1.rds.amazonaws.com',
port=3306)
......@@ -170,6 +180,7 @@ if (exist_cash()){
df_type <- db_table_load(db, "wp_esi_type")
df_news <- db_table_load(db, "wp_esi_news")
df_tag <- db_table_load(db, "wp_esi_tag")
df_radar <- db_table_load(db, "wp_esi_radar")
# tags cross-tables
df_tag_entity <- db_table_load(db, "wp_esi_tag_entity")
......@@ -177,6 +188,7 @@ if (exist_cash()){
# news cross-tables
df_news_entity <- db_table_load(db, "wp_esi_news_entity")
df_news_radar <- db_table_load(db, "wp_esi_news_radar")
# Disconnect
dbDisconnect(db)
......@@ -201,24 +213,18 @@ sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("About", tabName = "about", icon = icon("dashboard")),
menuItem("Companies", icon = icon("dashboard"),
menuSubItem("Data all", tabName = "company_data_all"),
menuSubItem("Data by tags", tabName = "company_data_tags"),
p(),
menuSubItem("Analysis by countries", tabName = "company_analysis_countries"),
menuSubItem("Analysis by tags", tabName = "company_analysis_tags"),
menuSubItem("Analysis by size per tags", tabName = "company_analysis_size_tags"),
menuSubItem("Analysis by age per tags", tabName = "company_analysis_age_tags")
menuSubItem("Data", tabName = "company_data"),
menuSubItem("Search", tabName = "company_search"),
menuSubItem("Analysis", tabName = "company_analysis")
),
menuItem("Investments", icon = icon("money"),
menuSubItem("Data all", tabName = "invest_data_all"),
menuSubItem("Data by tags", tabName = "invest_data_tags"),
menuSubItem("Data by tags and dates", tabName = "invest_data_tags_date_fund"),
p(),
menuSubItem("Analysis by tags", tabName = "invest_analysis_tags")
menuSubItem("Data", tabName = "invest_data"),
menuSubItem("Search", tabName = "invest_search"),
menuSubItem("Analysis", tabName = "invest_analysis")
),
menuItem("News", icon = icon("file"),
menuSubItem("Data all", tabName = "news_data_all"),
menuSubItem("Data by tags", tabName = "news_data_tags"))
menuSubItem("Data", tabName = "news_data"),
menuSubItem("Search", tabName = "news_search"))
)
)
......@@ -236,136 +242,199 @@ body <- dashboardBody(
# 2. Companies ----
tabItem(tabName = "company_data_all",
tabItem(tabName = "company_data",
fluidPage(
fluidRow(h2("All data about companies")),
fluidRow(checkboxInput("dt_company_data_all_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_company_data_all"))
)),
tabItem(tabName = "company_data_tags",
fluidPage(
fluidRow(h2("Data about companies by tags")),
fluidRow(selectizeInput('company_data_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("company_data_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_company_data_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_company_data_tags")),
fluidRow(downloadButton('btn_download_company_data_tags', 'Download'))
)),
tabItem(tabName = "company_analysis_countries",
fluidPage(
fluidRow(h2("Analysis of companies by countries")),
fluidRow(p(tags$b("Number of companies"))),
fluidRow(
column(3, textInput("company_analysis_countries_entities_min", "Min", "100")),
column(3, textInput("company_analysis_countries_entities_max", "Max", "10000"))),
fluidRow(plotlyOutput("company_analysis_countries")),
fluidRow(dataTableOutput("dt_company_analysis_countries")),
fluidRow(downloadButton('btn_download_company_analysis_countries', 'Download'))
)
tabItem(tabName = "company_search",
tabsetPanel(
tabPanel("Tags",
fluidPage(
fluidRow(selectizeInput('company_data_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("company_data_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_company_data_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_company_data_tags")),
fluidRow(downloadButton('btn_download_company_data_tags', 'Download'))
) # Tags
) # tabPanel
) #tabsetPanel
),
tabItem(tabName = "company_analysis_tags",
fluidPage(
fluidRow(h2("Analysis of companies by tags")),
fluidRow(selectInput("company_analysis_tags_choice", "Number of tags",
c("> 100", "50:100", "10:50", "5:10", "3:5", "1:3", "1: Max"))),
fluidRow(plotlyOutput("company_analysis_tags")),
fluidRow(dataTableOutput("dt_company_analysis_tags")),
fluidRow(downloadButton('btn_download_company_analysis_tags', 'Download'))
)
tabItem(tabName = "company_analysis",
tabsetPanel(
tabPanel("Tags",
fluidPage(
fluidRow(h2("Analysis of companies by tags")),
fluidRow(selectInput("company_analysis_tags_choice", "Number of tags",
c("> 100", "50:100", "10:50", "5:10", "3:5", "1:3", "1: Max"))),
fluidRow(plotlyOutput("company_analysis_tags")),
fluidRow(dataTableOutput("dt_company_analysis_tags")),
fluidRow(downloadButton('btn_download_company_analysis_tags', 'Download'))
)
),
tabPanel("Country",
fluidPage(
fluidRow(h2("Analysis of companies by countries")),
fluidRow(p(tags$b("Number of companies"))),
fluidRow(
column(3, textInput("company_analysis_countries_entities_min", "Min", "100")),
column(3, textInput("company_analysis_countries_entities_max", "Max", "10000"))),
fluidRow(plotlyOutput("company_analysis_countries")),
fluidRow(dataTableOutput("dt_company_analysis_countries")),
fluidRow(downloadButton('btn_download_company_analysis_countries', 'Download'))
)
),
tabPanel("Size per tags",
fluidPage(
fluidRow(h2("Analysis of companies by average size per tags")),
fluidRow(selectInput("company_analysis_size_tags_choice", "Average size",
c("> 1000", "500 : 1000", "250 : 500", "100 : 250", "50 : 100", "25 : 50", "1 : 25", "1 : Max"))),
fluidRow(plotlyOutput("company_analysis_size_tags")),
fluidRow(dataTableOutput("dt_company_analysis_size_tags")),
fluidRow(downloadButton('btn_download_company_analysis_size_tags', 'Download'))
)
),
tabPanel("Age per tags",
fluidPage(
fluidRow(h2("Analysis of companies by average age per tags")),
fluidRow(selectInput("company_analysis_age_tags_choice", "Average age",
c("> 20", "15 : 20", "10 : 15", "7 : 10", "5 : 7", "3 : 5", "1 : 3", "1 : Max"))),
fluidRow(plotlyOutput("company_analysis_age_tags")),
fluidRow(dataTableOutput("dt_company_analysis_age_tags")),
fluidRow(downloadButton('btn_download_company_analysis_age_tags', 'Download'))
)
)
) # tabsetPanel
),
tabItem(tabName = "company_analysis_size_tags",
fluidPage(
fluidRow(h2("Analysis of companies by average size per tags")),
fluidRow(selectInput("company_analysis_size_tags_choice", "Average size",
c("> 1000", "500 : 1000", "250 : 500", "100 : 250", "50 : 100", "25 : 50", "1 : 25", "1 : Max"))),
fluidRow(plotlyOutput("company_analysis_size_tags")),
fluidRow(dataTableOutput("dt_company_analysis_size_tags")),
fluidRow(downloadButton('btn_download_company_analysis_size_tags', 'Download'))
)),
tabItem(tabName = "company_analysis_age_tags",
fluidPage(
fluidRow(h2("Analysis of companies by average age per tags")),
fluidRow(selectInput("company_analysis_age_tags_choice", "Average age",
c("> 20", "15 : 20", "10 : 15", "7 : 10", "5 : 7", "3 : 5", "1 : 3", "1 : Max"))),
fluidRow(plotlyOutput("company_analysis_age_tags")),
fluidRow(dataTableOutput("dt_company_analysis_age_tags")),
fluidRow(downloadButton('btn_download_company_analysis_age_tags', 'Download'))
)),
# 3. Investments ----
tabItem(tabName = "invest_data_all",
tabItem(tabName = "invest_data",
fluidPage(
fluidRow(h2("Data about all investments")),
fluidRow(checkboxInput("dt_invest_data_all_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_invest_data_all"))
)
),
tabItem(tabName = "invest_data_tags",
fluidPage(
fluidRow(h2("Data about investments by tags")),
fluidRow(selectizeInput('invest_data_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("invest_data_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_invest_data_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_invest_data_tags")),
fluidRow(downloadButton('btn_download_invest_data_tags', 'Download'))
)),
tabItem(tabName = "invest_analysis_tags",
fluidPage(
fluidRow(h2("Analysis of investments per tags")),
fluidRow(uiOutput('invest_analysis_tags_slider')),
fluidRow(plotlyOutput("invest_analysis_tags")),
fluidRow(dataTableOutput("dt_invest_analysis_tags")),
fluidRow(downloadButton('btn_download_invest_analysis_tags', 'Download'))
tabItem(tabName = "invest_search",
tabsetPanel(
tabPanel("Tags",
fluidPage(
fluidRow(selectizeInput('invest_data_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("invest_data_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_invest_data_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_invest_data_tags")),
fluidRow(downloadButton('btn_download_invest_data_tags', 'Download'))
)
),
tabPanel("Tags and Date",
fluidPage(
fluidRow(selectizeInput('invest_data_tags_date_fund_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("invest_data_tags_date_fund_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(
dateRangeInput("invest_data_tags_date_fund_dates", label = h3("Date range"),
start = min(as.Date(df_investment$investment_date)),
end = max(as.Date(df_investment$investment_date)))),
fluidRow(checkboxInput("dt_invest_data_tags_date_fund_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_invest_data_tags_date_fund")),
fluidRow(downloadButton('btn_download_invest_data_tags_date_fund', 'Download'))
)
)
)
),
tabItem(tabName = "invest_data_tags_date_fund",
fluidPage(
fluidRow(h2("Data about investments by tags and dates")),
fluidRow(selectizeInput('invest_data_tags_date_fund_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("invest_data_tags_date_fund_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(
dateRangeInput("invest_data_tags_date_fund_dates", label = h3("Date range"),
start = min(as.Date(df_investment$investment_date)),
end = max(as.Date(df_investment$investment_date)))),
fluidRow(checkboxInput("dt_invest_data_tags_date_fund_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_invest_data_tags_date_fund")),
fluidRow(downloadButton('btn_download_invest_data_tags_date_fund', 'Download'))
)),
tabItem(tabName = "invest_analysis",
tabsetPanel(
tabPanel("Tags",
fluidPage(
fluidRow(h2("Analysis of investments per tags")),
fluidRow(uiOutput('invest_analysis_tags_slider')),
fluidRow(plotlyOutput("invest_analysis_tags")),
fluidRow(dataTableOutput("dt_invest_analysis_tags")),
fluidRow(downloadButton('btn_download_invest_analysis_tags', 'Download'))
)
)
)
),
# 4. News ----
tabItem(tabName = "news_data_all",
tabItem(tabName = "news_data",
fluidPage(
fluidRow(h2("Data about all news")),
fluidRow(checkboxInput("dt_news_data_all_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_news_data_all"))
fluidRow(h2("News")),
fluidRow(checkboxInput("dt_news_data_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_news_data"))
)),
tabItem(tabName = "news_data_tags",
fluidPage(
fluidRow(h2("Data about news by tags")),
fluidRow(selectizeInput('news_data_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("news_data_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_news_data_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_news_data_tags")),
fluidRow(downloadButton('btn_download_news_data_tags', 'Download'))
))
tabItem(tabName = "news_search",
tabsetPanel(
tabPanel("Tags",
fluidPage(
fluidRow(selectizeInput('news_search_tags_tags', 'Tags', choices = df_tag$name, multiple = TRUE)),
fluidRow(radioButtons("news_search_tags_tags_filter", "Tags filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_news_search_tags_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_news_search_tags")),
fluidRow(downloadButton('btn_download_news_search_tags', 'Download'))
)), # Tags
tabPanel("Entity",
fluidPage(
fluidRow(selectizeInput('news_search_entity', 'Entity',
choices = sort(unique(df_entity$name), decreasing = F),
multiple = TRUE)),
fluidRow(radioButtons("news_search_entity_tags_filter", "Entity filter",
choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
fluidRow(checkboxInput("dt_news_search_entity_filter", "Filter", FALSE)),
fluidRow(dataTableOutput("dt_news_search_entity")),
fluidRow(downloadButton('btn_download_news_entity', 'Download'))
)),
tabPanel("Radar",
fluidPage(
fluidRow(selectizeInput('news_search_radar', 'Radar',
choices = sort(unique(df_radar$name), decreasing = F),
multiple = TRUE))
)
),
# tabPanel("Radar",
# fluidPage(
# fluidRow(h2("Select news by Radar")),
# fluidRow(selectizeInput('news_search_radar', 'Radar',
# choices = sort(unique(df_radar$name), decreasing = F),
# multiple = TRUE)),
# fluidRow(radioButtons("news_search_entity_tags_filter", "Entity filter",
# choices = list("OR" = 1, "AND" = 2), selected = 1, inline = T)),
# fluidRow(checkboxInput("dt_news_search_entity_filter", "Filter", FALSE)),
# fluidRow(dataTableOutput("dt_news_search_entity")),
# fluidRow(downloadButton('btn_download_news_entity', 'Download'))
# )),
tabPanel("Industry",
fluidPage(
fluidRow(h2("Select news by Industry"))
)),
tabPanel("Function",
fluidPage(
fluidRow(h2("Select news by Function"))
)),
tabPanel("Technology",
fluidPage(
fluidRow(h2("Select news by Technology"))
))
) # tabsetPanel
) #tabItem
)
)
ui <- dashboardPage(
dashboardHeader(title = "ESI Analytics"),
dashboardHeader(title = "EIS Dashboard"),
sidebar,
body
)
......@@ -434,7 +503,7 @@ server <- function(input, output, session) {
# Packages management
detach("package:RMySQL", unload=TRUE)
library(sqldf)
# 3. show message
output$txt_process <- renderUI({
HTML("Database updated")
......@@ -489,7 +558,7 @@ server <- function(input, output, session) {
filter = "none")
}
)
# 2.2. company_data_tags ---------------------------------------------
# 1. Table
......@@ -1608,8 +1677,8 @@ server <- function(input, output, session) {
# 3.4. invest_data_tags_date_fund ---------------------------------------------
# 1. Table
output$dt_invest_data_tags_date_fund <- renderDataTable(
if(input$dt_invest_data_tags_date_fund_filter){
......@@ -1744,23 +1813,18 @@ server <- function(input, output, session) {
# 5. Get result
return(entities_selected)
})
#
# 4. NEWS ---------------------------------------------
#
# Function
createLink <- function(value) {
sprintf('<a href="%s" target="_blank" class="btn btn-primary">Info</a>', value)
}
# 3.1. news_data_all ---------------------------------------------
# 3.1. news_data ---------------------------------------------
# 1. Table
output$dt_news_data_all <- renderDataTable(
if(input$dt_news_data_all_filter){
datatable(df_news_data_all_view(), options = list(
output$dt_news_data <- renderDataTable(
if(input$dt_news_data_filter){
datatable(df_news_data_view(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
......@@ -1774,7 +1838,7 @@ server <- function(input, output, session) {
escape = FALSE,
filter = 'top')
} else {
datatable(df_news_data_all_view(), options = list(
datatable(df_news_data_view(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
......@@ -1794,7 +1858,7 @@ server <- function(input, output, session) {
)
# 2. Data frame
df_news_data_all <- reactive({
df_news_data <- reactive({
# 1. Feature engineering
df_result <- df_news %>%
......@@ -1818,19 +1882,19 @@ server <- function(input, output, session) {
})
# View for DT table
df_news_data_all_view <- reactive({
df_news_data_all() %>%
df_news_data_view <- reactive({
df_news_data() %>%
subset(select = c(url, title, publish_date, entity_name, # id,
media_name, type_name, region_name))
})
# 3.2. news_data_tags ---------------------------------------------
# 3.2. news_search_tags ---------------------------------------------
# 1. Data frame
df_news_data_tags <- reactive({
df_news_search_tags <- reactive({
# 1. get list of selected tags from input
list_of_selected_tags <- input$news_data_tags_tags
list_of_selected_tags <- input$news_search_tags_tags
# 2. pipeline
tags_selected <- df_tag %>%
......@@ -1849,7 +1913,7 @@ server <- function(input, output, session) {
# Check type of filter
#
# 4.1. Select entities <OR>
if (input$news_data_tags_tags_filter == "1"){
if (input$news_search_tags_tags_filter == "1"){
# 4.1.1. Feature Engineering
news_selected <- df_news %>%
......@@ -1874,7 +1938,7 @@ server <- function(input, output, session) {
}
# 4.2. Select entities <AND>
if (input$news_data_tags_tags_filter == "2"){
if (input$news_search_tags_tags_filter == "2"){
# 4.2.1. Select news by tags
news_selected <- news_tags_selected %>%
......@@ -1913,9 +1977,9 @@ server <- function(input, output, session) {
})
# 1. Table
output$dt_news_data_tags <- renderDataTable(
if(input$dt_news_data_tags_filter){
datatable(df_news_data_tags(), options = list(
output$dt_news_search_tags <- renderDataTable(
if(input$dt_news_search_tags_filter){
datatable(df_news_search_tags(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
......@@ -1929,7 +1993,7 @@ server <- function(input, output, session) {
escape = FALSE,
filter = 'top')
} else {
datatable(df_news_data_tags(), options = list(
datatable(df_news_search_tags(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
......@@ -1946,13 +2010,148 @@ server <- function(input, output, session) {
)
output$btn_download_news_data_tags <- downloadHandler(
# 3. Download
output$btn_download_news_search_tags <- downloadHandler(
filename = "news_by_tags.csv",
content = function(file) {
write.csv(df_news_data_tags(), file)
write.csv(df_news_search_tags(), file)
}
)
# 3.3. news_search_entity ---------------------------------------------
# 1. Data frame
df_news_search_entity <- reactive({
# 1. get list of selected entities from input
list_of_selected_entity <- input$news_search_entity
# 2. pipeline
entity_selected <- df_entity %>%
filter(name %in% list_of_selected_entity)
# 3. get news with selected entities
news_entity_selected <- df_news_entity %>%
filter(entity_id %in% entity_selected$id)
# write_feather(news_tags_selected, "entities_tags_selected")
# 4. list of unique tags
unique_entity <- unique(news_entity_selected$entity_id)
#
# Check type of filter
#
# 4.1. Select entities <OR>
if (input$news_search_entity_tags_filter == "1"){
news_selected <- df_news %>%
# 1. select news by entity
filter(id %in% news_entity_selected$news_id) %>%
# 2. join
left_join(df_news_entity, by = c("id" = "news_id")) %>%
left_join(df_entity, by = c("entity_id" = "id")) %>%
left_join(df_media, by = c("media_id" = "id")) %>%
left_join(df_type, by = c("type_id" = "id")) %>%
left_join(df_region, by = c("region_id" = "id")) %>%
# 3. subset
subset(select = c(url.x, title, publish_date, name.x,
name.y, name.x.x, name.y.y)) %>%
# 4. rename
rename(url = url.x, entity_name = name.x, media_name = name.y,
type_name = name.x.x, region_name = name.y.y) %>%
# 5. mutate
mutate(url = createLink(url),
publish_date = as.Date(publish_date))
}
# 4.2. Select entities <AND>
if (input$news_search_entity_tags_filter == "2"){
# 4.2.1. Select news by entities
news_selected <- news_entity_selected %>%
group_by(news_id) %>%
summarise(n = n()) %>%
filter(n == length(unique_entity))
# 4.2.2. Selected entities from news
news_selected_ids <- unique(news_selected$news_id)
# 4.2.3. Feature Engineering
news_selected <- df_news %>%
# 1. filter
filter(id %in% news_selected_ids) %>%
# 2. join
left_join(df_news_entity, by = c("id" = "news_id")) %>%
left_join(df_entity, by = c("entity_id" = "id")) %>%
left_join(df_media, by = c("media_id" = "id")) %>%
left_join(df_type, by = c("type_id" = "id")) %>%
left_join(df_region, by = c("region_id" = "id")) %>%
# 3. subset
subset(select = c(url.x, title, publish_date, name.x,
name.y, name.x.x, name.y.y)) %>%
# 4. rename
rename(url = url.x, entity_name = name.x, media_name = name.y,
type_name = name.x.x, region_name = name.y.y) %>%
# 5. mutate
mutate(url = createLink(url),
publish_date = as.Date(publish_date))
}
# 5. Get result
return(news_selected)
})
# 2. Table
output$dt_news_search_entity <- renderDataTable(
if(input$dt_news_search_entity_filter){
datatable(df_news_search_entity(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
targets = 2,
render = JS(
"function(data, type, row, meta) {",
"return type === 'display' && data.length > 40 ?",
"'<span title=\"' + data + '\">' + data.substr(0, 40) + '...</span>' : data;",
"}")
))), callback = JS('table.page(3).draw(false);'),
escape = FALSE,
filter = 'top')
} else {
datatable(df_news_search_entity(), options = list(
searchHighlight = TRUE,
pageLength = 25,
columnDefs = list(list(
targets = 2,
render = JS(
"function(data, type, row, meta) {",
"return type === 'display' && data.length > 40 ?",
"'<span title=\"' + data + '\">' + data.substr(0, 40) + '...</span>' : data;",
"}")
))), callback = JS('table.page(3).draw(false);'),
escape = FALSE,
filter = 'none')
}
# datatable(df_news_search_entity(), options = list(pageLength = 10, searching = TRUE), rownames= FALSE)
)
# 3. Download data
output$btn_download_news_entity <- downloadHandler(
filename = "news_by_entity.csv",
content = function(file) {
write.csv(df_news_search_entity(), file)
}
)
# 3.4. news_search_radar ---------------------------------------------
}
......
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