An abstract class that holds an entire surveillance system.
Methods
Method new()
Usage
SurveillanceSystem_v9$new(implementation_version = "unspecified")Method add_table()
Add a table
Usage
SurveillanceSystem_v9$add_table(
name_access,
name_grouping = NULL,
name_variant = NULL,
field_types,
keys,
indexes = NULL,
validator_field_types = csdb::validator_field_types_blank,
validator_field_contents = csdb::validator_field_contents_blank
)Arguments
name_accessFirst part of table name, corresponding to the database where it will be stored.
name_groupingSecond part of table name, corresponding to some sort of grouping.
name_variantFinal part of table name, corresponding to a distinguishing variant.
field_typesNamed character vector, where the names are the column names, and the values are the column types. Valid types are BOOLEAN, CHARACTER, INTEGER, DOUBLE, DATE, DATETIME
keysCharacter vector, containing the column names that uniquely identify a row of data.
indexesNamed list, containing indexes.
validator_field_typesFunction corresponding to a validator for the field types.
validator_field_contentsFunction corresponding to a validator for the field contents.
Examples
\dontrun{
global$ss$add_table(
name_access = c("anon"),
name_grouping = "example_weather",
name_variant = "data",
field_types = c(
"granularity_time" = "TEXT",
"granularity_geo" = "TEXT",
"country_iso3" = "TEXT",
"location_code" = "TEXT",
"border" = "INTEGER",
"age" = "TEXT",
"sex" = "TEXT",
"isoyear" = "INTEGER",
"isoweek" = "INTEGER",
"isoyearweek" = "TEXT",
"season" = "TEXT",
"seasonweek" = "DOUBLE",
"calyear" = "INTEGER",
"calmonth" = "INTEGER",
"calyearmonth" = "TEXT",
"date" = "DATE",
"temp_max" = "DOUBLE",
"temp_min" = "DOUBLE",
"precip" = "DOUBLE"
),
keys = c(
"granularity_time",
"location_code",
"date",
"age",
"sex"
),
validator_field_types = csdb::validator_field_types_csfmt_rts_data_v1,
validator_field_contents = csdb::validator_field_contents_csfmt_rts_data_v1
)
}
Method add_partitionedtable()
Usage
SurveillanceSystem_v9$add_partitionedtable(
name_access,
name_grouping = NULL,
name_variant = NULL,
name_partitions = "default",
column_name_partition = "partition",
value_generator_partition = NULL,
field_types,
keys,
indexes = NULL,
validator_field_types = csdb::validator_field_types_blank,
validator_field_contents = csdb::validator_field_contents_blank
)Method add_task()
add_task_from_config
Usage
SurveillanceSystem_v9$add_task(
name_grouping = NULL,
name_action = NULL,
name_variant = NULL,
cores = 1,
permission = NULL,
plan_analysis_fn_name = NULL,
for_each_plan = NULL,
for_each_analysis = NULL,
universal_argset = NULL,
upsert_at_end_of_each_plan = FALSE,
insert_at_end_of_each_plan = FALSE,
action_fn_name,
data_selector_fn_name = NULL,
tables = NULL
)Arguments
name_groupingName of the task (grouping)
name_actionName of the task (action)
name_variantName of the task (variant)
coresNumber of CPU cores
permissionA permission R6 instance
plan_analysis_fn_nameThe name of a function that returns a named list
list(for_each_plan = list(), for_each_analysis = NULL).for_each_planA list, where each unit corresponds to one data extraction. Generally recommended to use
plnr::expand_list.for_each_analysisA list, where each unit corresponds to one analysis within a plan (data extraction). Generally recommended to use
plnr::expand_list.universal_argsetA list, where these argsets are applied to all analyses univerally
upsert_at_end_of_each_planDo you want to upsert your results automatically at the end of each plan?
insert_at_end_of_each_planDo you want to insert your results automatically at the end of each plan?
action_fn_nameThe name of the function that will be called for each analysis with arguments
data,argset,schemadata_selector_fn_nameThe name of a function that will be called to obtain the data for each analysis. The function must have the arguments
argset,schemaand must return a named list.tablesA named list that maps
sc9::config$schemasfor use inaction_fn_nameanddata_selector_fn_name
Examples
## ------------------------------------------------
## Method `SurveillanceSystem_v9$add_table`
## ------------------------------------------------
if (FALSE) {
global$ss$add_table(
name_access = c("anon"),
name_grouping = "example_weather",
name_variant = "data",
field_types = c(
"granularity_time" = "TEXT",
"granularity_geo" = "TEXT",
"country_iso3" = "TEXT",
"location_code" = "TEXT",
"border" = "INTEGER",
"age" = "TEXT",
"sex" = "TEXT",
"isoyear" = "INTEGER",
"isoweek" = "INTEGER",
"isoyearweek" = "TEXT",
"season" = "TEXT",
"seasonweek" = "DOUBLE",
"calyear" = "INTEGER",
"calmonth" = "INTEGER",
"calyearmonth" = "TEXT",
"date" = "DATE",
"temp_max" = "DOUBLE",
"temp_min" = "DOUBLE",
"precip" = "DOUBLE"
),
keys = c(
"granularity_time",
"location_code",
"date",
"age",
"sex"
),
validator_field_types = csdb::validator_field_types_csfmt_rts_data_v1,
validator_field_contents = csdb::validator_field_contents_csfmt_rts_data_v1
)
}
