feat: препроверка схемы перед загрузкой
This commit is contained in:
@@ -5,6 +5,7 @@ scheme_R6 <- R6::R6Class(
|
||||
public = list(
|
||||
|
||||
initialize = function(scheme_file_path = NULL) {
|
||||
|
||||
private$scheme_file_path <- scheme_file_path
|
||||
|
||||
# make list of schemas
|
||||
@@ -33,6 +34,9 @@ scheme_R6 <- R6::R6Class(
|
||||
|
||||
# extract main key
|
||||
private$main_key_id <- self$get_key_id("main")
|
||||
|
||||
box::use(modules/utils)
|
||||
private$testest <- utils$make_list_of_pages(private$schemes_list[["main"]], private$main_key_id)
|
||||
},
|
||||
|
||||
get_all_ids = function(table_name) {
|
||||
@@ -96,6 +100,9 @@ scheme_R6 <- R6::R6Class(
|
||||
},
|
||||
nested_tables_names = function() {
|
||||
private$nested_forms_names
|
||||
},
|
||||
get_main_form_ui = function() {
|
||||
private$testest
|
||||
}
|
||||
),
|
||||
private = list(
|
||||
@@ -103,6 +110,7 @@ scheme_R6 <- R6::R6Class(
|
||||
schemes_list = NULL,
|
||||
main_key_id = NA,
|
||||
nested_forms_names = NA,
|
||||
testest = NA,
|
||||
exluded_types = c("inline_table", "nested_forms","description", "description_header"),
|
||||
|
||||
load_scheme_from_xlsx = function(sheet_name) {
|
||||
@@ -112,7 +120,7 @@ scheme_R6 <- R6::R6Class(
|
||||
c("subgroup", "form_id", "form_label", "form_type")
|
||||
)
|
||||
|
||||
readxl::read_xlsx(FILE_SCHEME, sheet = sheet_name) |>
|
||||
readxl::read_xlsx(private$scheme_file_path, sheet = sheet_name) |>
|
||||
# fill NA down
|
||||
tidyr::fill(all_of(colnames), .direction = "down") |>
|
||||
dplyr::group_by(form_id) |>
|
||||
@@ -121,4 +129,18 @@ scheme_R6 <- R6::R6Class(
|
||||
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
# schm <- scheme_R6$new(fs::path("configs/schemas", "schema.xlsx"))
|
||||
# object.size(schm)
|
||||
# schm$get_key_id("main")
|
||||
# schm$get_forms_ids("main")
|
||||
# schm$get_all_ids("main")
|
||||
|
||||
# schm$get_schema("main")
|
||||
|
||||
# schm$get_id_type_list("allergo_anamnesis")
|
||||
|
||||
# # active
|
||||
# schm$get_main_key_id
|
||||
# schm$all_tables_names
|
||||
Reference in New Issue
Block a user