
Reporting window for environmental surveillance indicators
Source:R/es_performance.R
es_reporting_window.RdSets the window the ES indicators are computed over. The window ends on the
last day of the month in which es_complete_end() falls, and starts
window_months - 1 months before that month, so it spans window_months
whole collection months. Running the window to as_of instead would count
samples still at the laboratory as if they had no enterovirus.
Arguments
- samples
Cleaned environmental samples, one row per sample, as returned by
clean_es().- as_of
The reporting date, as a
Dateor a string thatas.Date()reads. Defaults toSys.Date(). Samples collected after it, or with no collection date, are left out.- window_months
Number of collection months in the window. Default
12.- resolved_min
Share of a month's samples that must be resolved for the month to count as complete. Default
0.80.- settle_months
Number of months after which a month still below
resolved_minis taken as final. Default3.- cols
Named list overriding the default column names, keyed by table, in the same shape as in
calc_polio_indicators(), for examplelist(samples = list(vtype = "virus_type")). Thesamplesdefaults are the polished ES columns, withsite_name = "site_name", plusvtype = "vtype",site_guid = "site_guid",longitude = "site_x_coordinate",latitude = "site_y_coordinate"anddistrict_key = "adm2_guid", the column samples are counted by district on.
Value
A one-row tibble with window_start, window_end, last_month
(the first day of the last month in the window) and lag_months (how many
whole months the last month in the window sits behind the month of
as_of). Pass window_start and window_end as from and to to
calc_es_district_performance() or calc_es_site_performance().
Examples
es <- tibble::tibble(
collection_date = as.Date(c("2024-01-05", "2024-02-03", "2024-03-10")),
classification_all = c("NPEV", "NEGATIVE", NA)
)
es_reporting_window(es, as_of = as.Date("2024-03-20"), window_months = 2)
#> # A tibble: 1 × 4
#> window_start window_end last_month lag_months
#> <date> <date> <date> <int>
#> 1 2024-01-01 2024-02-29 2024-02-01 1