-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert-tables.R
40 lines (27 loc) · 1 KB
/
convert-tables.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
library(arrow)
library(fst)
library(ricu)
list.files(file.path(data_dir(), "covid19", "single_timestamp"))
if (!dir.exists(file.path(data_dir(), "covid19")))
dir.create(file.path(data_dir(), "covid19"))
if (!dir.exists(file.path(data_dir(), "covid19")))
dir.create(file.path(data_dir(), "covid19"))
convert_names <- c(
'episodes', 'admissions',
'medications', 'intubations', 'range_measurements',
'diagnoses', 'parameters', 'comorbidities', 'outcomes'
)
convert_names <- c(
convert_names,
gsub(".parquet", "", paste0("single_timestamp/", list.files("single_timestamp")))
)
#convert_names <- grep("part_", list.files(), value = T)
#convert_names <- gsub(".parquet", "", convert_names)
for (tab_name in convert_names) {
if (file.exists(paste0(tab_name, ".parquet"))) {
tbl <- read_parquet(paste0(tab_name, ".parquet"))
file.remove(paste0(tab_name, ".parquet"))
write_fst(tbl, path = file.path(data_dir(), "covid19", paste0(tab_name, ".fst")))
}
print(tab_name)
}