
Calculate the stool specimen pathway for AFP cases
Source:R/afp_quality.R
calc_afp_specimen_pathway.RdThe share of AFP cases meeting each stool collection component, in the
order the adequacy definition builds it, ending on adequacy itself. The
components are those of afp_stool_components().
Arguments
- cases
Cleaned AFP cases, one row per case (data.frame or tibble).
- level
Administrative level to group by:
"adm0"(country, the default),"adm1"(province) or"adm2"(district). Cases with no identifier at that level are left out.- from, to
First and last onset date of the reporting window, or
NULLfor no bound.- 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
A tibble with one row per unit and step: level, guid, name,
step, met, cases and pct. pct is on a scale of 0 to 100.
Details
Steps:
first_in_window,both_in_window,apartandadequate.Numerator (
met): cases meeting the step.Denominator (
cases): every case in the unit and window.Threshold: stools count within
collection_days(default 14) of onset.
A case that adequacy cannot assess counts as not adequate here. The
default adequacy is the POLIS field, as on the rise-afg page; this differs
from stool_adequacy_cond_pct in calc_polio_indicators(), which applies
the "polished" rule and leaves unassessed cases out of its denominator.
Examples
cases <- tibble::tibble(
adm0_guid = "G0",
adm0 = "Country",
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")
)
calc_afp_specimen_pathway(cases)
#> # A tibble: 4 × 7
#> level guid name step met cases pct
#> <chr> <chr> <chr> <chr> <int> <int> <dbl>
#> 1 adm0 G0 Country first_in_window 2 2 100
#> 2 adm0 G0 Country both_in_window 1 2 50
#> 3 adm0 G0 Country apart 1 2 50
#> 4 adm0 G0 Country adequate 1 2 50