Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
check on date time formats in site upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hhunterzinck committed Oct 4, 2021
1 parent 26de567 commit 4949538
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions 2021-10-04_michele_vicc_panc_upload_date_formats.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Description: Check date formats marked as incorrect in the QA report.
# Author: Haley Hunter-Zinck
# Date: 2021-10-04

# setup ----------------------------

tic = as.double(Sys.time())

library(glue)
library(dplyr)
library(synapser)
synLogin()

# synapse
synid_file_vicc_panc <- "syn25541702"

# functions ----------------------------

get_synapse_entity_data_in_csv <- function(synapse_id,
version = NA,
sep = ",",
na.strings = c("NA"),
header = T) {

if (is.na(version)) {
entity <- synGet(synapse_id)
} else {
entity <- synGet(synapse_id, version = version)
}

data <- read.csv(entity$path, stringsAsFactors = F,
na.strings = na.strings, sep = sep, check.names = F,
header = header)
return(data)
}

# read ----------------------------

data_curr <- get_synapse_entity_data_in_csv(synid_file_vicc_panc, version = 3)
data_prev <- get_synapse_entity_data_in_csv(synid_file_vicc_panc, version = 2)

# main ----------------------------

column_names <- c("qa_full_date", "curation_dt", "pt_start_time", "drugs_stop_time")

print("Current version date formats:")
for (column_name in column_names) {
print(column_name)
print(head(data_curr[[column_name]][data_curr[[column_name]] != ""]))
print("-----")
}

print("Previous version date formats:")
for (column_name in column_names) {
print(column_name)
print(head(data_curr[[column_name]][data_curr[[column_name]] != ""]))
print("-----")
}

# close out ----------------------------

toc = as.double(Sys.time())
print(glue("Runtime: {round(toc - tic)} s"))

0 comments on commit 4949538

Please sign in to comment.