Skip to content

Commit

Permalink
prepared shiny app scripts for execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ZorzArg committed Mar 8, 2024
1 parent 6cde002 commit 789f5c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
1 change: 0 additions & 1 deletion shiny/R/fn.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ plotKM2 <- function(dat) {
plot_colors <- unname(grafify::graf_palettes$kelly)

p <- ggplot(dat, aes(x = time, y = estimate, color = outcomeCohortId)) +
#ggsurvfit::add_risktable(risktable_stats = c("n.risk", "cum.censor", "cum.event")) + ## ADDED
geom_step(linewidth = 1.5) +
scale_color_manual(values = plot_colors) + #scale colors to kelly
scale_y_continuous(labels = scales::percent_format()) + # convert y axis to percent
Expand Down
2 changes: 1 addition & 1 deletion shiny/R/loadData.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library(readr)
source(here::here("shiny", "R", "fn.R"))
source(here::here("shiny", "migration", "helpers.R"))

dataPath <- here::here("shiny", "data_0603")
dataPath <- here::here("shiny", "data")


# About -----------------
Expand Down
10 changes: 5 additions & 5 deletions shiny/migration/dataMigration.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ library(readr)
source("shiny/migration/helpers.R")


appDataPath <- here::here("shiny", "data_0603") # Path to place app data
appDataPath <- here::here("shiny", "data") # Path to place app data

appDataPath %>% fs::dir_create() # Create new directory

resultsPath <- here::here("results_0603") # Set path to the execution results
resultsPath <- here::here("results") # Set path to the execution results

listOfDatabase <- fs::dir_ls(resultsPath) %>% # List the databases used in the execution
basename()
Expand Down Expand Up @@ -920,7 +920,7 @@ for (i in 1:length(listOfDatabase)) {

listOfFiles <- list.files(path, full.names = FALSE, pattern = ".rds", recursive = TRUE)

inputPath <- here::here("results_0603", db, listOfTasks[11])
inputPath <- here::here("results", db, listOfTasks[11])

fs::file_copy(here::here(inputPath, listOfFiles),
here::here(outputPath, listOfFiles), overwrite = TRUE)
Expand All @@ -945,7 +945,7 @@ for (i in 1:length(listOfDatabase)) {

listOfFiles <- list.files(path, full.names = FALSE, pattern = ".rds", recursive = TRUE)

inputPath <- here::here("results_0603", db, listOfTasks[12])
inputPath <- here::here("results", db, listOfTasks[12])

fs::file_copy(here::here(inputPath, listOfFiles),
here::here(outputPath, listOfFiles), overwrite = TRUE)
Expand Down Expand Up @@ -1000,7 +1000,7 @@ for (i in 1:length(listOfDatabase)) {

listOfFiles <- list.files(path, full.names = FALSE, pattern = ".rds", recursive = TRUE)

inputPath <- here::here("results_0603", db, listOfTasks[14])
inputPath <- here::here("results", db, listOfTasks[14])

fs::file_copy(here::here(inputPath, listOfFiles),
here::here(outputPath, listOfFiles), overwrite = TRUE)
Expand Down
11 changes: 0 additions & 11 deletions shiny/migration/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,6 @@ getSurvProbTab <- function(kmData,
}


#test
# getSurvProbTab(kmData = kmData,
# targetCohortId = 1L,
# database = "cprdAurum",
# era = "era_30")

getTimeTab <- function(kmData,
targetCohortId, # select target cohort
database, # select database
Expand Down Expand Up @@ -479,8 +473,3 @@ getTimeTab <- function(kmData,
return(timeTab)
}


# getTimeTab(kmData = kmData,
# targetCohortId = 1L,
# database = "cprdAurum",
# era = "era_30")

0 comments on commit 789f5c9

Please sign in to comment.