A class that creates the indicator in SQL form which evaluates whether all of the target columns match the specified definition codes, ensuring that the indicator is TRUE only if every target column has a match.

MatchAll(
  rule_engine,
  indicator_name,
  target_columns,
  definition_codes,
  regex_prefix_search = FALSE
)

Arguments

rule_engine

Object of class RuleEngine.The rule engine containing the dataset where indicators will be applied.

indicator_name

Character. A string representing the name of the indicator, assigned to the `name` field.

target_columns

List of characters. Column names where the match is evaluated. Searches are performed across all target columns.

definition_codes

List of characters. A set of codes used to define the matching criteria for the target columns.

Logical. Logical value indicating whether to perform prefix-based regex matches (`TRUE`) or exact matches (default) (`FALSE`).

Value

Returns an instance of MatchAll with a generated SQL rule.

Examples

if (FALSE) { # \dontrun{
hosp_dataframe <- data.frame(
  episode_id = c(1, 2, 3),
  age = c(45, 60, 32),
  sex = c("M", "F", "M"),
  diagnosis1 = c("F10.10", "I20", "I60"),
  diagnosis2 = c("E11", "J45", "I25"),
  diagnosis3 = c("I60", "K35", "F10.120")
)

target_columns <- c("diagnosis1")

definition_codes <- c("F10.10","F10.11","F10.120","F10.121")

alcohol_indicator <- IndicR4Health::MatchAll(
                reng,
                "alcohol_i",
                target_columns,
                definition_codes
                )
} # }