Commit 027f9326 authored by Я's avatar Я

add "id" into Company: Data views

parent fc2fca2d
...@@ -291,7 +291,7 @@ df_company_data_all <- reactive({ ...@@ -291,7 +291,7 @@ df_company_data_all <- reactive({
mutate( mutate(
country = ifelse(country=="", "N/A", country), country = ifelse(country=="", "N/A", country),
description = paste0(substr(description, 1, 10), "...")) %>% description = paste0(substr(description, 1, 10), "...")) %>%
subset(select = c(name, url, description, country, city, founded_in, employees, total_raised)) subset(select = c(id, name, url, description, country, city, founded_in, employees, total_raised))
}) })
# 2. Table # 2. Table
...@@ -339,7 +339,7 @@ df_company_data_tags <- reactive({ ...@@ -339,7 +339,7 @@ df_company_data_tags <- reactive({
mutate( mutate(
country = ifelse(country=="", "N/A", country), country = ifelse(country=="", "N/A", country),
description = paste0(substr(description, 1, 20), "...")) %>% description = paste0(substr(description, 1, 20), "...")) %>%
subset(select = c(name, url, description, country, city, founded_in, employees, total_raised)) subset(select = c(id, name, url, description, country, city, founded_in, employees, total_raised))
} }
# 4.2. Select entities <AND> # 4.2. Select entities <AND>
...@@ -360,7 +360,7 @@ df_company_data_tags <- reactive({ ...@@ -360,7 +360,7 @@ df_company_data_tags <- reactive({
mutate( mutate(
country = ifelse(country=="", "N/A", country), country = ifelse(country=="", "N/A", country),
description = paste0(substr(description, 1, 20), "...")) %>% description = paste0(substr(description, 1, 20), "...")) %>%
subset(select = c(name, url, description, country, city, founded_in, employees, total_raised)) subset(select = c(id, name, url, description, country, city, founded_in, employees, total_raised))
} }
# 5. Get result # 5. Get result
......
No preview for this file type
#
# "News" tables analysis
#
# "wp_esi_news" # "wp_esi_news"
# "wp_esi_news_entity" # "wp_esi_news_entity"
...@@ -6,3 +9,44 @@ ...@@ -6,3 +9,44 @@
# "wp_esi_news_industry" # "wp_esi_news_industry"
# "wp_esi_tag_news" # "wp_esi_tag_news"
# "wp_esi_technology_news" # "wp_esi_technology_news"
library(shinydashboard)
library(RMySQL)
#library(sqldf)
library(feather)
library(ggplot2)
library(dplyr)
library(reshape2)
library(lubridate)
library(plotly)
# 1. Connect to db
mydb <- dbConnect(MySQL(), user='analyst', password='exa_analyst1&',
dbname='esi_management',
host='lecanaldb.c12hbxfn3xzn.eu-west-1.rds.amazonaws.com',
port=3306)
# 2. List of tables
dbListTables(mydb)
# 3. Load tables
db_load <- function(table){
rs = dbSendQuery(mydb, paste0("select * from ", table))
df = fetch(rs, n=-1)
write_feather(df, paste0("data/", table))
}
# 3.2. Load all tables
# <main>
df_entity <- db_load("wp_esi_entity")
# basic for cross
df_tag <- db_load("wp_esi_tag")
df_technology <- db_load("wp_esi_technology")
df_industry <- db_load("wp_esi_industry")
df_function <- db_load("wp_esi_function")
# news tables
df_news <- db_load("wp_esi_news")
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