
Create Binary Environmental Suitability Indicator from Epidemic Peaks
Source:R/get_cases_binary_from_peaks.R
get_cases_binary_from_peaks.RdThis function creates a deterministic binary indicator of environmental suitability for cholera
transmission based on epidemic peak periods identified by the est_epidemic_peaks() function.
It uses the exact peak_start and peak_stop dates without any modifications or lead-up periods.
Value
A function that takes a data frame and returns it with an additional cases_binary
column containing the binary environmental suitability indicator (0 = unsuitable, 1 = suitable).
The input data frame must contain columns: iso_code and date.
Details
This function implements a deterministic approach for creating environmental suitability indicators:
Deterministic Epidemic Peak Method:
Loads epidemic peak periods from
param_epidemic_peaks.csvMarks all weeks from
peak_starttopeak_stopas suitable (1)Uses exact dates without any lead-up periods or duration filters
Countries without epidemic peaks have cases_binary = 0 for all periods
Key Features:
Deterministic behavior - no parameters that can alter the peak periods
Direct use of peak_start and peak_stop dates from epidemic analysis
No fallback methods or threshold-based logic
Preserves missing data periods (NA) as non-suitable
Note
Requires param_epidemic_peaks.csv file generated by est_epidemic_peaks().
If this file is missing, the function will stop with an error.
See also
est_epidemic_peaks for epidemic peak detection
compile_suitability_data for the main data processing pipeline
Examples
if (FALSE) { # \dontrun{
# Load and apply epidemic peaks to data
PATHS <- get_paths()
peak_function <- get_cases_binary_from_peaks(PATHS)
data_with_binary <- peak_function(data)
} # }