
Flag the stool collection components of each AFP case
Source:R/afp_quality.R
afp_stool_components.RdAdds one logical column per component of stool collection, computed from the collection dates rather than the cleaned intervals, so a stool collected long after onset is still seen as late.
Arguments
- cases
Cleaned AFP cases, one row per case (data.frame or tibble).
- collection_days
Latest day after onset at which a stool counts as collected in time (default 14).
- min_days_apart
Fewest days between the two collection dates for
apart(default 1).- adequacy
Stool adequacy definition passed to
afp_stool_adequacy()(default"polis_field", which the rise-afg stool collection page used).- adequacy_args
Named list of further arguments for
afp_stool_adequacy(), for examplelist(adequate_value = "YES").- cols
Named list overriding default column names, in the style of
calc_polio_indicators(), for examplelist(cases = list(stool1_condition = "s1_cond")). The defaults are the polished defaults plus the module columns listed under Details ofcalc_afp_timeliness().
Value
cases as a tibble with the seven columns above added; existing
columns of the same names are replaced.
Details
two: both collection dates are recorded.first_in_window: stool 1 was collected 0 tocollection_daysdays after onset.both_in_window: both stools were collected 0 tocollection_daysdays after onset.apart: both stools are recorded at leastmin_days_apartdays apart.adequate: the result ofafp_stool_adequacy()underadequacy.late: either stool was collected more thancollection_daysdays after onset.one_or_none: fewer than two collection dates are recorded.
Examples
cases <- tibble::tibble(
paralysis_onset_date = as.Date("2025-03-01"),
stool1collection_date = as.Date("2025-03-03"),
stool2collection_date = as.Date(c("2025-03-04", NA)),
adequate_stool_with_condition = c("Yes", "No")
)
afp_stool_components(cases)
#> # A tibble: 2 × 11
#> paralysis_onset_date stool1collection_date stool2collection_date
#> <date> <date> <date>
#> 1 2025-03-01 2025-03-03 2025-03-04
#> 2 2025-03-01 2025-03-03 NA
#> # ℹ 8 more variables: adequate_stool_with_condition <chr>, two <lgl>,
#> # first_in_window <lgl>, both_in_window <lgl>, apart <lgl>, adequate <lgl>,
#> # late <lgl>, one_or_none <lgl>