alan-turing-institute / eider

eider: an R package for processing health records declaratively
https://alan-turing-institute.github.io/eider/
Other
2 stars 0 forks source link

Input validation #31

Closed yongrenjie closed 7 months ago

yongrenjie commented 8 months ago

Things to check:

This is tedious but important...

Probably any line that looks like

grouping_column <- spec$grouping_column

needs to be reworked to use a function instead

grouping_column <- get_grouping_column(spec, table, context)

get_grouping_column <- function(spec, table, context = NULL) {
    if (!(spec$grouping_columns %in% colnames(table))) {
        error_context(..., context)
    }
    if (length(spec$grouping_columns) != 1) {
        error_context(..., context)
    }
    # any other checks here

    spec$grouping_columns
}