
Monthly laboratory resolution of environmental samples
Source:R/es_performance.R
calc_es_resolution.RdCounts the environmental samples collected in each month up to as_of and
the share of them that carry a laboratory classification. A sample still at
the laboratory has no classification and is unresolved. A negative sample
has a classification but no virus type, so it counts as resolved.
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.- 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 tibble with one row per collection month, sorted by month:
month (the first day of the month), samples, resolved, pending
and resolved_share (resolved over samples, on a scale of 0 to 1).
Examples
es <- tibble::tibble(
collection_date = as.Date(c("2024-01-05", "2024-01-20", "2024-02-03")),
classification_all = c("NPEV", NA, "NEGATIVE")
)
calc_es_resolution(es, as_of = as.Date("2024-03-01"))
#> # A tibble: 2 × 5
#> month samples resolved pending resolved_share
#> <date> <int> <int> <int> <dbl>
#> 1 2024-01-01 2 1 1 0.5
#> 2 2024-02-01 1 1 0 1