Returns one logical value per case: TRUE when the stools are adequate,
FALSE when they are not, and NA when the definition cannot assess the
case. Three definitions are in use and definition selects one.
Usage
afp_stool_adequacy(
cases,
definition = c("polished", "polis_field", "followup"),
cols = list(),
first_stool_days = c(0, 13),
second_stool_days = c(1, 14),
min_days_apart = 1,
good_condition = "Good",
poor_condition = "Poor",
unknown_condition = "Unknown",
good_onset_quality = "Good",
adequate_value = "Yes"
)Arguments
- cases
Cleaned AFP cases, one row per case (data.frame or tibble).
- definition
One of
"polished","polis_field"or"followup".- 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().- first_stool_days
Earliest and latest day after onset at which stool 1 counts (default
c(0, 13)).- second_stool_days
Earliest and latest day after onset at which stool 2 counts (default
c(1, 14)).- min_days_apart
Fewest days between stool 1 and stool 2 (default 1).
- good_condition, poor_condition, unknown_condition
Condition values for a stool in good condition, in poor condition and of unknown condition (defaults
"Good","Poor","Unknown").- good_onset_quality
Onset date quality value that lets a case be assessed under
"polished"(default"Good"). A missing onset date quality column or value does not exclude the case.- adequate_value
Value of the POLIS field that means adequate under
"polis_field"(default"Yes").
Details
"polished"(the default) is the rule behind theadq_codethatcalc_polio_indicators()uses forstool_adequacy_cond_pct. A case is adequate when stool 1 was collected 0 to 13 days after onset, stool 2 was collected 1 to 14 days after onset, the two were at least one day apart, and both were recorded in good condition. A stool outside its window, a missing stool 1 to stool 2 interval, stools less than a day apart or a stool in poor condition makes the case inadequate. A case is not assessed (NA) when either condition is missing or unknown, or when the onset date quality is recorded as anything other than good.TRUEhere corresponds to code 1 andFALSEto code 0 of that engine."polis_field"reads the adequacy POLIS writes itself, in the fieldadequate_stool_with_condition: a case is adequate when the field equalsadequate_value, inadequate when it holds any other value, andNAwhen it is empty. The rise-afg stool collection page and its SPI code used this definition."followup"is the rule of the CDC desk review that the rise-afg 60-day follow-up page used. The timing windows are the same as"polished", and a stool outside them or a missing stool makes the case inadequate. A condition counts as good when it matchesgood_condition(ignoring case) or is blank, so a case is never left unassessed.
Timing uses the interval columns clean_afp() writes (onset_to_stool1,
onset_to_stool2, stool1_to_stool2), in days.
Examples
cases <- tibble::tibble(
onset_to_stool1 = c(2, 2, 20),
onset_to_stool2 = c(3, 3, 21),
stool1_to_stool2 = c(1, 1, 1),
stool1condition = c("Good", NA, "Good"),
stool2condition = c("Good", "Good", "Good"),
adequate_stool_with_condition = c("Yes", "Yes", "No")
)
afp_stool_adequacy(cases)
#> [1] TRUE NA FALSE
afp_stool_adequacy(cases, definition = "followup")
#> [1] TRUE TRUE FALSE
afp_stool_adequacy(cases, definition = "polis_field")
#> [1] TRUE TRUE FALSE
