
Process Weekly Cholera Data from JHU: Convert to MOSAIC Format
Source:R/process_JHU_data.R
process_JHU_weekly_data.RdThis function processes raw weekly cholera surveillance data from the JHU Public Surveillance Dataset, aggregates to country level, parses ISO-weeks, computes week start/end dates, and prepares the data for the MOSAIC framework.
Value
Invisibly returns NULL. Side effects:
Reads raw data with
readRDS().Writes processed data to
PATHS$DATA_JHU_WEEKLY/cholera_country_weekly_processed.csvviawrite.csv().
Details
Steps performed:
Load
Public_surveillance_dataset.rdsand keep onlyspatial_scale == "country".Drop rows flagged
phantom: weeks the archive zero-fills without a report (noobservation_collection_id). They are unobserved, not zeros.Extract
iso_codefromlocation_name(suffix after “::”) and convert to full country name.Split
epiweek(e.g. "2017-15") intoyearandweek.Create
date_start(Monday) anddate_stop(Sunday) for each ISO week viaISOweek::ISOweek2date().Compute
monthfromdate_startusinglubridate::month().Define
casesusing suspected (sCh) if present, else confirmed (cCh), elseNA.Keep
deathsas reported; a missing death count staysNA(it is not an observed zero – about three quarters of country-level rows in the OSF archive carry no death count).Drop rows where both
casesanddeathsareNA(no observation).Save a data.frame with columns:
country, iso_code, year, month, week, date_start, date_stop, cases, deaths.
Examples
if (FALSE) { # \dontrun{
PATHS <- list(
DATA_RAW = "data/raw",
DATA_JHU_WEEKLY = "data/processed/jhu_weekly"
)
process_JHU_weekly_data(PATHS)
} # }