Skip to content

Commit

Permalink
updates - 01/03/2024
Browse files Browse the repository at this point in the history
  • Loading branch information
EVANSTATS committed Mar 1, 2024
1 parent 16a3782 commit f744293
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
14 changes: 11 additions & 3 deletions EFM_loading_data.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#devtools::install_github("IDEMSInternational/postgresr")
#devtools::install_github("IDEMSInternational/plhR")

data_l <- import_list("EFM_shiny (1).xlsx")

# Functions
# function to fix up namings to make it a bit prettier!
Expand Down Expand Up @@ -32,12 +33,18 @@ add_na_variable <- function(data = contacts_unflat, variable){

# Download data ----------------------------------------------------------------
# download EFM app data from Metabase as an RDS file?
plhdata_org <- get_user_data(filter_variable = "app_deployment_name",
filter_variable_value = "early_family_math",
site = plh_con, merge_check = FALSE, filter = TRUE)

plhdata_org <- postgresr::get_user_data(site = plh_con, filter = FALSE)

# plhdata_org <- get_user_data(filter_variable = "app_deployment_name",
# filter_variable_value = "early_family_math",
# site = plh_con, merge_check = FALSE, filter = TRUE)
#names(plhdata_org) <- gsub(x = names(plhdata_org), pattern = "\\-", replacement = ".")
#View(plhdata_org)

mydate <- "2023-12-15"
plhdata_org <- plhdata_org %>% filter(as.Date(createdAt) > as.Date(mydate))


# COUNTING the number of clicks --------------------------------------------------------------------
### Creating counts
Expand Down Expand Up @@ -86,6 +93,7 @@ count_dates <- function(x) {
# ! Column `rp-contact-field.efm_sb_Cat_And_Dog_And_The_Ball_book_click_history` not found in `.data`.

# lets check if these variables exist

vars_to_check <- data_l$storybooks$variable
plhdata_org <- add_na_variable(data = plhdata_org, variable = vars_to_check)

Expand Down
Binary file modified EFM_shiny (1).xlsx
Binary file not shown.
10 changes: 5 additions & 5 deletions Personal Setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ library(DBI)

#Connect to Database to get original data
plh_con <- DBI::dbConnect(RPostgres::Postgres(),
dbname = 'plh',
host = 'apps-server.idems.international',
port = 5432,
user = 'parent_app',
password = 'parent_app')
dbname = 'early_family_math',
host = 'apps-server.idems.international',
port = 5432,
user = 'early_family_math',
password = 'nPmtPjhi2HuQDz')

# TODO: explore do a query (filter)
#DBI::dbReadTable(conn = plh_con, name = "app_users")
Expand Down
8 changes: 2 additions & 6 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ library(ggthemes)

# R file where we call and tidy the data
source("Personal Setup.R")
data_l <- import_list("EFM_shiny (1).xlsx")
source("EFM_loading_data.R")


# Excel file with the specifications in it
data_l <- import_list("EFM_shiny (1).xlsx")
data_l$contents <- data_l$contents[1:3,]

#data_l <- import_list("EFM_shiny (1).xlsx")
#data_l$contents <- data_l$contents[1:4,]

# Run the shiny dashboard
PLH_shiny(title = "EFM Research",
data_list = data_l,
data_frame = plhdata_org,
status = "primary")

2 changes: 1 addition & 1 deletion rsconnect/shinyapps.io/evansodhiambo/EFMDataScripts.dcf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ account: evansodhiambo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 11297311
bundleId: 8297731
bundleId: 8312595
url: https://evansodhiambo.shinyapps.io/EFMDataScripts/
version: 1
asMultiple: FALSE
Expand Down

0 comments on commit f744293

Please sign in to comment.