Skip to contents

Adds the stool adequacy, the follow-up status and the review screen of the CDC desk review to each case. Every day count runs to as_of.

Usage

afp_followup_status(
  cases,
  as_of = Sys.Date(),
  due_days = 60,
  on_time_days = c(60, 90),
  adequacy = "followup",
  adequacy_args = list(),
  compatible_classes = "COMPATIBLE",
  review_classes = c("NPAFP", "PENDING", "LAB PENDING"),
  review_findings = c("Residual weakness/paralysis", "Died before follow-up",
    "Lost to follow-up"),
  review_max_age_months = 60,
  review_min_doses = 3,
  dose_unknown = 99,
  dose_reason_labels = c(no_opv = "0 OPV doses", no_routine =
    "0 routine OPV doses, SIA doses missing", no_sia =
    "0 SIA OPV doses, routine doses missing", few_doses = paste0("Fewer than ",
    review_min_doses, " doses"), no_history = "Dose history missing"),
  cols = list()
)

Arguments

cases

Cleaned AFP cases, one row per case (data.frame or tibble).

as_of

The reporting date, as a Date or a string that as.Date() reads. Defaults to Sys.Date(). Every day count runs to it.

due_days

Days after onset from which follow-up of an inadequate case is due (default 60).

on_time_days

First and last day after onset at which a follow-up is on time (default c(60, 90)).

adequacy

Stool adequacy definition passed to afp_stool_adequacy() (default "followup").

adequacy_args

Named list of further arguments for afp_stool_adequacy(), for example list(adequate_value = "YES").

compatible_classes

Classifications counted as compatible, matched ignoring case (default "COMPATIBLE").

review_classes

Classifications the review screen keeps, matched ignoring case (default c("NPAFP", "PENDING", "LAB PENDING")). A blank classification is always kept.

review_findings

Follow-up findings that keep a case under review (default residual weakness or paralysis, died before follow-up, and lost to follow-up, in POLIS wording).

review_max_age_months

Age in months at and above which the screen drops a case (default 60).

review_min_doses

Fewest doses that count as vaccinated when routine and campaign OPV counts are missing (default 3).

dose_unknown

Dose value that means unknown (default 99).

dose_reason_labels

Named character vector of the dose_reason texts, with elements no_opv, no_routine, no_sia, few_doses and no_history.

cols

Named list overriding default column names, in the style of calc_polio_indicators(), for example list(cases = list(stool1_condition = "s1_cond")). The defaults are the polished defaults plus the module columns listed under Details of calc_afp_timeliness().

Value

cases as a tibble with adequate, onset_month, days_since, followup_days, finding, due, followed, on_time, no_followup, overdue, compatible, dose_reason and review added.

Details

  • adequate: afp_stool_adequacy() under adequacy (default "followup", as on the rise-afg follow-up page).

  • days_since: days from onset to as_of.

  • followup_days: days from onset to the follow-up date.

  • finding: the follow-up finding, NA when blank.

  • due: inadequate, and at least due_days (default 60) days since onset.

  • followed: a follow-up date or a finding is recorded.

  • on_time: followed up on_time_days[1] to on_time_days[2] days after onset (default 60 to 90).

  • no_followup: due and not followed up.

  • overdue: no follow-up and more than on_time_days[2] days since onset.

  • compatible: classified in compatible_classes.

  • dose_reason: why the dose history keeps the case under review, or NA. No OPV dose recorded keeps it; where the routine and campaign OPV counts are both missing, fewer than review_min_doses doses by the reported total, or failing that by the calculated total, keeps it.

  • review: due, not compatible, classified in review_classes or not yet classified, with a finding in review_findings or overdue, with a dose_reason, and younger than review_max_age_months (or of unknown age).

A case adequacy cannot assess is never due.

Examples

cases <- tibble::tibble(
  paralysis_onset_date = as.Date("2025-01-10"),
  onset_to_stool1 = 20,
  onset_to_stool2 = 21,
  stool1_to_stool2 = 1,
  stool1condition = "Good",
  stool2condition = "Good",
  classification_all = "NPAFP",
  followup_date = as.Date(NA),
  followup_findings = NA_character_,
  age_months = 24,
  doses_opv_routine = 0,
  doses_opvsia = 0,
  total_number_of_doses = 0,
  calc_doses_risi = 0
)
afp_followup_status(cases, as_of = "2025-06-30")
#> # A tibble: 1 × 27
#>   paralysis_onset_date onset_to_stool1 onset_to_stool2 stool1_to_stool2
#>   <date>                         <dbl>           <dbl>            <dbl>
#> 1 2025-01-10                        20              21                1
#> # ℹ 23 more variables: stool1condition <chr>, stool2condition <chr>,
#> #   classification_all <chr>, followup_date <date>, followup_findings <chr>,
#> #   age_months <dbl>, doses_opv_routine <dbl>, doses_opvsia <dbl>,
#> #   total_number_of_doses <dbl>, calc_doses_risi <dbl>, adequate <lgl>,
#> #   onset_month <date>, days_since <int>, followup_days <int>, finding <chr>,
#> #   due <lgl>, followed <lgl>, on_time <lgl>, no_followup <lgl>, overdue <lgl>,
#> #   compatible <lgl>, dose_reason <chr>, review <lgl>