Skip to contents

Lists every component of one district's simple SPI for one year, in the order of the calculation: current reporting, previous reporting, the expected count, the SPI and the data checks. Each value can be checked by hand from the ones above it. When the SPI cannot be calculated, the breakdown says so and gives the reason.

Usage

spi_simple_explain(x, district, year = NULL, language = "en", print = TRUE)

Arguments

x

An spi_simple object from spi_simple().

district

The district identifier.

year

Assessment year. Default: the last assessment year.

language

Character. Language of the labels, as a two-letter code such as "fr". Default "en". Other languages are translated with sntutils::translate_text_vec(), which calls Google Translate through the gtranslate package. Both packages and an internet connection are needed; labels that cannot be translated stay in English. Numbers and check_ flags are not translated.

print

Logical. Print the breakdown. Default TRUE.

Value

Invisibly, a tibble with section, component and value, in the language requested.

See also

Examples

annual <- synth_surveillance$cases |>
  dplyr::mutate(year = as.integer(format(month, "%Y"))) |>
  dplyr::summarise(count = sum(count), .by = c(adm2_guid, year))
res <- spi_simple(
  data = annual,
  population = synth_surveillance$population,
  id_col = "adm2_guid",
  count_col = "count",
  pop_col = "pop_u15",
  verbose = FALSE
)
spi_simple_explain(res, res$summary$adm2_guid[1])
#> 
#> ── District {01325AA0-BEA1-66FE-9B5C-88AA603382F3}, 2024 ───────────────────────
#> 
#> ── Current reporting ──
#> 
#> Observed NPAFP cases                  0
#> Current population under 15     207 836
#> NPAFP rate                         0.00
#> 
#> ── Previous reporting ──
#> 
#> Previous years                        9
#> Previous NPAFP cases                 17
#> Previous child-years          1 732 685
#> Previous rate                      0.98
#> 
#> ── Expected reporting ──
#> 
#> Expected NPAFP cases               2.04
#> 
#> ── SPI ──
#> 
#> District observed / expected       0.00
#> National observed / expected       1.28
#> SPI                                0.00
#> 
#> ── Data checks ──
#> 
#> Population check                no flag