From 46594b9d390d7d882cc1b61ef160a7fb408abe68 Mon Sep 17 00:00:00 2001 From: Pranav Anbarasu Date: Thu, 3 Oct 2024 23:55:08 +0000 Subject: [PATCH] Upload intermediate summaries (output concepts) files to internal Synapse location for use in validation of staging i2b2 summaries data --- config/config.yml | 1 + .../upload-intermediate-summaries-files.R | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 scripts/write-output/upload-intermediate-summaries-files.R diff --git a/config/config.yml b/config/config.yml index 865e102..bc42486 100644 --- a/config/config.yml +++ b/config/config.yml @@ -18,6 +18,7 @@ staging: s3basekey: main/archive/2024-06-13/ selectedVarsFileID: syn53503994 outputConceptsDir: ./temp-output-concepts + tempOutputConceptSynID: syn53822708 prod: inherits: staging diff --git a/scripts/write-output/upload-intermediate-summaries-files.R b/scripts/write-output/upload-intermediate-summaries-files.R new file mode 100644 index 0000000..45d9556 --- /dev/null +++ b/scripts/write-output/upload-intermediate-summaries-files.R @@ -0,0 +1,24 @@ +# Generate a TSV manifest file of intermediate summaries files (intermediate output concepts files) +synapserutils::generate_sync_manifest( + directory_path = outputConceptsDir, + parent_id = tempOutputConceptSynID, + manifest_path = "temp-output-concepts-manifest.tsv" +) + +# Exclude the final output_concepts.csv file from the manifest and write the +# modified manifest file to a CSV file +read.delim("temp-output-concepts-manifest.tsv") %>% + dplyr::filter(!grepl("output_concepts.csv", path)) %>% + write.csv(file = "temp-output-concepts-manifest.csv", row.names = FALSE, quote = FALSE) + +login <- synapser::synLogin() + +# Store each file listed in the CSV manifest file at its specified parent Synapse ID +synapserutils::syncToSynapse(manifestFile = "temp-output-concepts-manifest.csv") + +# synclient <- reticulate::import("synapseclient") +# syn_temp <- synclient$Synapse() +# syn <- syn_temp$login() +# +# synutils <- reticulate::import("synapseutils") +# synutils$syncToSynapse(syn = syn, manifestFile = "temp-output-concepts-manifest.csv")