Browse Source

ver 0.0.000

master
Asitav Sen 3 years ago
commit
6b7553069d
  1. 4
      .gitignore
  2. 108
      app.R
  3. BIN
      cred.sqlite
  4. 12
      data/questions.csv
  5. 29
      data/use_cases.csv
  6. 35
      helper_server.R
  7. 72
      helper_ui.R
  8. 13
      priority.Rproj
  9. 70
      utilities.R
  10. BIN
      www/jadslogo.png
  11. BIN
      www/kh.png
  12. BIN
      www/logo.png

4
.gitignore

@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

108
app.R

@ -0,0 +1,108 @@
#
#Shiny web application
# ::Asitav Sen::
# ******Important*******
# Please check the template. This code supports only single select option. In the csv, separate the answer options with "/"
#
library(shiny)
library(DBI)
library(shinymanager)
library(DT)
library(excelR)
library(bslib)
library(dplyr)
library(shinydashboard)
library(shinydashboardPlus)
library(dbplyr)
source("utilities.R")
source("helper_ui.R")
source("helper_server.R")
# Define UI
ui <- secure_app(uidet, enable_admin = TRUE)
# Define server logic
server <- function(input, output) {
onStop(db.disc, session = getDefaultReactiveDomain())
res_auth <- secure_server(
check_credentials = check_credentials("cred.sqlite",
passphrase = "kJuyhG657Hj&^%gshj*762hjsknh&662")
)
output$menu <- renderMenu({
if (res_auth$admin == FALSE) {
survey.menu
} else
admin.menu
})
output$grouptable <- renderUI({
tablelist <- lapply(1:no.of.dims, function(i) {
tablename <-
paste("table", i, unique(question.dfs[[i]]$segment), sep = "")
list(tabPanel(
unique(question.dfs[[i]]$segment),
h2(unique(question.dfs[[i]]$segment)),
excelOutput(tablename, height = "900px")
))
})
do.call(tabsetPanel, unlist(tablelist, recursive = FALSE))
})
for (i in 1:no.of.dims) {
local({
mdf <- question.dfs[[i]]
tablename <-
paste("table", i, unique(question.dfs[[i]]$segment), sep = "")
output[[tablename]] <- renderExcel({
nrmdf <- nrow(mdf)
dat <-
data.frame(matrix(nrow = nrow(use_cases), ncol = nrow(mdf) + 2))
colnames(dat) <- c("Strategic Pillar","Use Cases", mdf$question)
dat[, 1] <- use_cases$strategy
dat[, 2] <- use_cases$use_cases
qlist <- list(0,0)
olist <- strsplit(mdf$answers, split = "/")
excelTable(
data = dat,
columns = data.frame(
title = c("Strategic Pillar","Use Cases", mdf$question),
type = c("text","text", rep("dropdown", nrow(mdf))),
source = I(append(qlist, olist))
),
#autoWidth = TRUE,
#autoFill = TRUE,
#wordWrap = TRUE,
columnSorting = FALSE,
rowDrag = FALSE,
allowDeleteColumn = FALSE,
allowRenameColumn = FALSE,
allowInsertRow = FALSE,
allowInsertColumn = FALSE,
allowDeleteRow = FALSE,
tableHeight = 400
)
})
})
}
}
# Run the application
shinyApp(ui = ui, server = server)

BIN
cred.sqlite

Binary file not shown.

12
data/questions.csv

@ -0,0 +1,12 @@
segment,question,answers
Value,For which Internal stakeholder(s) would this use case bring the most value,"Sales/Marketing/Supply Chain/Finance/R&D/Staff department (IT, HR, etc)"
Value,The business added value of this use case will be very high,strongly disagree/disagree/neutral/agree/strongly agree
Value,This use case will deliver a direct and high impact/value on the R&D strategic objectives,strongly disagree/disagree/neutral/agree/strongly agree
People,We have the relevant human resources (people) available to facilite and support the execution of the use case,strongly disagree/disagree/neutral/agree/strongly agree
People,Our resources have sufficient data science skills and competencies to support this use case,strongly disagree/disagree/neutral/agree/strongly agree
Process,This use case will have a high impact on the execution of key process(es) of our organization,strongly disagree/disagree/neutral/agree/strongly agree
Process,The insights generated by this use case will support decision making or help to automate our process(es),strongly disagree/disagree/neutral/agree/strongly agree
Technology,We have the relevant IT Infrastructuure and Data Science Applications in place to support this use case,strongly disagree/disagree/neutral/agree/strongly agree
Data,The required internal and/or external data to support this use case are available and accessible,strongly disagree/disagree/neutral/agree/strongly agree
Data,The required internal data for this use case is complete and reliable,strongly disagree/disagree/neutral/agree/strongly agree
Risk,"The organizational risks (complexity, chance of failure, etc.) involved in this use case are very high",strongly disagree/disagree/neutral/agree/strongly agree

29
data/use_cases.csv

@ -0,0 +1,29 @@
strategy,use_cases
Customer centric capabilities,Legislation driven consumer behavior Prediction
Customer centric capabilities,Legislation driven Product Development
Customer centric capabilities,Legislation driven Waste Management
Customer centric capabilities,Package preference analysis
Customer centric capabilities,Package Costing Analysis
Customer centric capabilities,Packaging Alternative or Substitute Analysis
Customer centric capabilities,Complaint driven product/process improvement
Customer centric capabilities,Sentiment Aalysis
Customer centric capabilities,Quality Control automation
Grow KH into leading plan(e)t based brand,Cluster recipes within core products / product group
Grow KH into leading plan(e)t based brand,Consumer pref. for core design
Grow KH into leading plan(e)t based brand,Process core design
Grow KH into leading plan(e)t based brand,Raw material optimization against scarcity
Grow KH into leading plan(e)t based brand,Collection emerging trends consumer
Grow KH into leading plan(e)t based brand,Collection disruption in food
Grow KH into leading plan(e)t based brand,Predictive tool to create a new unknown combinations
Grow KH into leading plan(e)t based brand,Raw Material Lifecycle Analysis
Grow KH into leading plan(e)t based brand,End-product Lifecycle Analysis
Grow KH into leading plan(e)t based brand,Consumer Lifecycle Analysis
Grow KH into leading plan(e)t based brand,Lifecycle driven shelf-time and storage time definition
Grow KH into leading plan(e)t based brand,Lifecycle driven production planning
Grow KH into leading plan(e)t based brand,Lifecycle driven distribution planning
Innovation that scales bigger and faster,Food Tekst Scanning and Structuring
Innovation that scales bigger and faster,Food Picture scanning and Structuring
Innovation that scales bigger and faster,"Trend Prediction by using social, seasonal and weather parameters"
Innovation that scales bigger and faster,Digital twin to simulate scenarios
Innovation that scales bigger and faster,Prediction of future trends and impact on production and recipy
Innovation that scales bigger and faster,Human behaviour analysis

35
helper_server.R

@ -0,0 +1,35 @@
admin.menu<-sidebarMenu(
id="m",
menuItem(
"dashboard",
tabName = "Dashboard",
icon=icon("dashboard")
),
menuItem(
"input",
tabName = "Input",
icon=icon("dashboard")
),
menuItem("Contact us", icon=icon("id-card"), href="https://lanubia.com/contact/")
)
survey.menu<-sidebarMenu(
id="m",
menuItem(
"survey",
tabName = "Survey",
icon = icon("clipboard-list")
),
menuItem(
"personal",
tabName = "Personal",
icon = icon("user")
),
menuItem("Contact us", icon=icon("id-card"), href="https://lanubia.com/contact/")
)

72
helper_ui.R

@ -0,0 +1,72 @@
sdbar<-dashboardSidebar(
collapsed = FALSE,
sidebarMenuOutput("menu")#,
# p(style = "text-align: center;", "An Initiative by"),
# lanubialogo,
# p(style = "text-align: center;", "&"),
# jadslogo,
# p(style = "text-align: center;", "For"),
# clientlogo,
# actionButton("submit", "Submit All")
)
uidet <- shinydashboardPlus::dashboardPage(
title = "Clotho",
skin = "black-light",
header = shinydashboardPlus::dashboardHeader(title = "Clotho"),
sidebar = sdbar,
body = dashboardBody(tabItems(
tabItem(
tabName = "Survey",
shinydashboardPlus::box(
width = 12,
solidHeader = T,
title = "Instructions",
fluidRow(column(
width = 10,
h5(
"Please double click the cells and select the desired value. Once all the tabs are done, please click the submit button."
)
),
column(
width = 2,
actionButton("submitdata", "Submit All")
))
),
shinydashboardPlus::box(title = "Survey",
width = 12,
uiOutput("grouptable")
)
),
tabItem(
tabName = "Personal",
shinydashboardPlus::box(
width = 6,
title = "Other info",
sel.depp,
sel.func,
sel.gender,
sel.age,
timeondata,
footer = actionButton("submitinfo", "Submit")
)
),
tabItem(tabName = "Dashboard"),
tabItem(
tabName = "Input"
)
)),
footer = shinydashboardPlus::dashboardFooter(left = "LaNubia Consulting", right = "Built for Kraft Heinz R & D, Netherlands"),
controlbar = dashboardControlbar(collapsed = TRUE, tagList("Change Skin",
skinSelector()))
)

13
priority.Rproj

@ -0,0 +1,13 @@
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX

70
utilities.R

@ -0,0 +1,70 @@
df <- NULL
questions <- read.csv("./data/questions.csv")
use_cases <- read.csv("./data/use_cases.csv")
dsn_database <- "priority"
dsn_hostname <- "priority-lanubia.postgres.database.azure.com"
dsn_port <- "5432"
dsn_uid <- "lanubia"
dsn_pwd <- "kjHuye98837*&38hjksmk((7hksakjd0nk"
connec <- dbConnect(
RPostgres::Postgres(),
dbname = dsn_database,
host = dsn_hostname,
port = dsn_port,
user = dsn_uid,
password = dsn_pwd
)
db.tables <- dbListTables(connec)
db.disc<-function(){
dbDisconnect(connec)
}
q_dfs <- function(dimension) {
questions |>
filter(segment == dimension)
}
question.dfs<-lapply(unique(questions$segment), q_dfs)
no.of.dims<-length(question.dfs)
sel.depp<-selectizeInput(
"deptt",
"Business Area",
choices = c(
"R&D",
"Supply Chain",
"Marketing",
"Sales",
"Finance",
"IT",
"HR",
"Other"
)
)
sel.func<-selectizeInput(
"func",
"Function Level",
choices = c("Board", "Director",
"Manager", "Expert", "Staff", "Other")
)
sel.gender<- selectizeInput("gender", "Gender", choices =
c("Male", "Female", "Other"))
sel.age<-selectizeInput(
"age",
"Age",
choices = c("18-24", "25-30", "31-40", "41-50", "51-60", "60+")
)
timeondata<-selectizeInput(
"timeondata",
"How much time do you spend on average per day working with data in your current role?",
choices = c("About 1 hour", "About 2 hours", "Most of the time")
)

BIN
www/jadslogo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
www/kh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
www/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save