Skip to content

Commit

Permalink
Change progress print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavanba committed Jul 12, 2024
1 parent a49a388 commit 03f46af
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 27 deletions.
7 changes: 4 additions & 3 deletions scripts/egress/egress.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cat("Beginning egress: storing output concepts, input concept map, and input variable list in Synapse\n")
cat("\n----Beginning egress: storing output concepts,
input concept map, and input variable list in Synapse----\n")

synapser::synLogin()
login <- synapser::synLogin()

# Write the following to Synapse: 1) the final output concepts data, 2) the input data used in this pipeline
latest_commit <-
Expand Down Expand Up @@ -37,4 +38,4 @@ rm(latest_commit,
file_name
)

cat("Finished egress\n\n")
cat("\n----Finished egress----\n")
7 changes: 4 additions & 3 deletions scripts/fetch-data/fetch_data.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
library(tidyverse)

cat("Fetching data\n")
cat("\n----Fetching data and connecting to S3 bucket----\n")

synapser::synLogin()
login <- synapser::synLogin()

# Get input files from synapse
concept_map <-
Expand Down Expand Up @@ -61,4 +61,5 @@ if (!dir.exists(outputConceptsDir)) {
dir.create(outputConceptsDir)
}

cat("Finished fetching data\n\n")
cat("\n----Finished----\n")

4 changes: 2 additions & 2 deletions scripts/process-data/fitbitactivitylogs.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- "fitbitactivitylogs"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -93,7 +93,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"),"\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(dataset,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/fitbitdailydata.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- "fitbitdailydata"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -112,7 +112,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"), "\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(dataset,
Expand Down
6 changes: 3 additions & 3 deletions scripts/process-data/fitbitecg.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ecg_stat_summarize <- function(df) {

dataset <- "fitbitecg$"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand All @@ -116,7 +116,7 @@ df <-
select(all_of(c(vars))) %>%
filter(ResultClassification %in% c("Normal Sinus Rhythm", "Atrial Fibrillation")) %>%
rename(StartDate = StartTime) %>%
mutate(EndDate = base_s3_uri %>% stringr::str_extract("[0-9]{4}-[0-9]{2}-[0-9]{2}")) %>%
mutate(EndDate = bucket_path %>% stringr::str_extract("[0-9]{4}-[0-9]{2}-[0-9]{2}")) %>%
collect()

colnames(df) <- tolower(colnames(df))
Expand Down Expand Up @@ -193,7 +193,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"), "\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(ecg_stat_summarize,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/fitbitintradaycombined.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- "fitbitintradaycombined"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -126,7 +126,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"), "\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(dataset,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/fitbitsleeplogs.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ sleeplogs_stat_summarize <- function(df) {

dataset <- "fitbitsleeplogs$"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -432,7 +432,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"),"\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(sleeplogs_stat_summarize,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/healthkitv2electrocardiogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ecg_stat_summarize <- function(df) {

dataset <- "healthkitv2electrocardiogram$"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -196,7 +196,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"),"\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(ecg_stat_summarize,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/healthkitv2samples.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- "healthkitv2samples"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -116,7 +116,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"),"\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(dataset,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/healthkitv2statistics.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- "healthkitv2statistics"

cat(glue::glue("Transforming data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for {dataset}"), "----\n"))

# Get variables for this dataset
vars <-
Expand Down Expand Up @@ -96,7 +96,7 @@ output_concepts %>%
write.csv(file.path(outputConceptsDir, glue::glue("{dataset}.csv")), row.names = F)
cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, paste0(dataset, '.csv'))}"),"\n")

cat(glue::glue("Finished transforming data for {dataset}"),"\n\n")
cat(paste0("\n----", glue::glue("Finished transforming data for {dataset}"),"\n"))

# Remove objects created here from the global environment
rm(dataset,
Expand Down
4 changes: 2 additions & 2 deletions scripts/process-data/participant_devices.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dataset <- c("fitbitdevices", "healthkitv2samples")

cat(glue::glue("Transforming device data for {dataset}"),"\n")
cat(paste0("\n----", glue::glue("Transforming data for datasets: {dataset[1]}, {dataset[2]}"), "----\n"))

# Get variables for this dataset
vars <- list(fitbitdevices = c("ParticipantIdentifier",
Expand All @@ -13,7 +13,7 @@ vars <- list(fitbitdevices = c("ParticipantIdentifier",
df <-
lapply(dataset, function(x) {
tmp <- vars[[x]]
arrow::open_dataset(s3$path(str_subset(dataset_paths, dataset))) %>%
arrow::open_dataset(s3$path(str_subset(dataset_paths, x))) %>%
select(all_of(tmp)) %>%
dplyr::rename_with(tolower) %>%
collect()
Expand Down
4 changes: 2 additions & 2 deletions scripts/write-output/final-output-concepts.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cat("Creating final output concepts\n")
cat("\n----Creating final output concepts----\n")

# Read each dataset's (intermediate) i2b2 output concepts CSV file, combine
# them, and de-duplicate data if it already exists (fitbit data is highest
Expand Down Expand Up @@ -66,4 +66,4 @@ rm(datasets,
valid_participants
)

cat("Finished creating final output concepts\n\n")
cat("\n----Finished creating final output concepts----\n")

0 comments on commit 03f46af

Please sign in to comment.