This repository has been archived by the owner on Apr 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check on date time formats in site upload
- Loading branch information
1 parent
26de567
commit 4949538
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) |