Builds one row per poliovirus detection from the positive AFP cases and
the positive environmental samples, shaped like the cleaned POLIS virus
table (polished_virus) that rise-afg reads. No new values are drawn:
each detection carries the place, dates and virus fields of the case or
sample it comes from, so the three tables agree with each other.
Usage
simulate_detections(
afp_cases,
es_samples,
positive_pattern = "WPV|VDPV",
environmental_source = "Environmental",
surveillance_types = c(human = "human", environmental = "environmental"),
source_system = "POLIS"
)Arguments
- afp_cases
A table from
simulate_afp_cases().- es_samples
A table from
simulate_es_samples().- positive_pattern
Regular expression a
classification_alllabel must match to count as a detection. Default"WPV|VDPV".- environmental_source
Value of
sourcefor a sample. Default"Environmental".- surveillance_types
Values of
surveillance_typefor a case and a sample. Defaultc(human = "human", environmental = "environmental").- source_system
Value of
source_systemon every row. Default"POLIS".
Value
A tibble with one row per detection, ordered by virus_date.
Dates are Date, year_onset and month_onset are integer,
latitude and longitude are double, virus_is_orphan is logical
and the remaining columns are character.
Details
A case contributes its onset as virus_date and its notification date;
a sample contributes its collection date and its notification to
headquarters. report_date is the notification date for a wild virus
and the vaccine-derived classification date for a vaccine-derived
virus, each falling back on the other, as the cleaning derives it.
Column names and the source and surveillance_type labels follow how
rise-afg reads polished_virus in
02_scripts/2c_indicators/2ci_detections.R, 2cii_priority.R,
2cxxi_detection_context.R, 2cxxvi_region_profile.R and
2cxxvii_detection_history.R, and the reader in
02_scripts/00_helper_functions/0a_polis_helpers.R, which adds
source_system.
Examples
admin <- simulate_admin_frame(n_provinces = 2, n_districts = 3)
cases <- simulate_afp_cases(admin, n_positive = 2)
samples <- simulate_es_samples(admin, n_sites = 3)
simulate_detections(cases, samples)
#> # A tibble: 8 × 26
#> epid surveillance_type source country_iso3code adm0 adm1 adm2 adm0_guid
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 2 QZA-P02… human AFP QZA COUN… PROV… DIST… {83601C6…
#> 3 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 4 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 5 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 6 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 7 ENV-QZA… environmental Envir… QZA COUN… PROV… DIST… {83601C6…
#> 8 QZA-P02… human AFP QZA COUN… PROV… DIST… {83601C6…
#> # ℹ 18 more variables: adm1_guid <chr>, adm2_guid <chr>, latitude <dbl>,
#> # longitude <dbl>, vtype <chr>, classification_all <chr>, measurement <chr>,
#> # emergence_group <chr>, nt_changes <chr>, virus_cluster <chr>,
#> # virus_is_orphan <lgl>, vdpv_classification_change_date <date>,
#> # virus_date <date>, year_onset <int>, month_onset <int>,
#> # notification_date <date>, report_date <date>, source_system <chr>
