Counts the AFP cases in each district and month that are not classified
as poliovirus or compatible. Cases still awaiting a laboratory result
count as non-polio AFP. Each case is placed in the month of
spi_case_date(). The panel is complete: a district and month with no
case carries a count of zero, as spi_expected() requires.
Usage
spi_case_panel(
cases,
districts,
months,
cols = list(),
polio_pattern = "WPV|VDPV|COMPATIBLE",
surveillance_types = "AFP"
)Arguments
- cases
Data frame of AFP cases, one row per case, with POLIS column names by default.
- districts
Character. District identifiers the panel covers, usually those of the boundaries the model is fitted on.
- months
Date. First-of-month dates the panel covers, usually
spi_panel_months().- cols
Named list overriding the column names:
id(default"adm2_guid"),class(default"classification_all"),surveillance_type(default"surveillance_type_name") and the dates read byspi_case_date().- polio_pattern
Character. Regular expression matched against the upper-cased classification. A match is a poliovirus or compatible case and is not counted. Default:
"WPV|VDPV|COMPATIBLE".- surveillance_types
Character. Surveillance types kept.
NULLkeeps every row. Default:"AFP".
Value
Tibble with one row per district and month: the district column
(named as cols$id), month and an integer count, sorted by district
and month. This is the cases input of spi_expected().
See also
Other spi preparation functions:
spi_case_date(),
spi_pop_index(),
spi_window()
Examples
cases <- tibble::tibble(
adm2_guid = c("D1", "D1", "D2"),
classification_all = c("NPAFP", "WPV1", "PENDING"),
surveillance_type_name = "AFP",
paralysis_onset_date = as.Date(c("2024-01-03", "2024-01-09", NA)),
case_date = as.Date(NA),
stool1collection_date = as.Date(c(NA, NA, "2024-02-11"))
)
spi_case_panel(
cases, c("D1", "D2"),
seq(as.Date("2024-01-01"), by = "month", length.out = 2)
)
#> # A tibble: 4 × 3
#> adm2_guid month count
#> <chr> <date> <int>
#> 1 D1 2024-01-01 1
#> 2 D1 2024-02-01 0
#> 3 D2 2024-01-01 0
#> 4 D2 2024-02-01 1