polished (development version)
Repeated API IDs no longer abort year downloads or revision checks. Both use the existing latest-revision rule, with the first row retained on ties. Invalid IDs and non-advancing cursors still stop without advancing the checkpoint.
Added AFP case quality indicators.
calc_afp_timeliness()reports onset to notification, notification to investigation and investigation to first stool, each over the cases whose interval is recorded.calc_afp_specimen_pathway()reports the stool collection steps over every case in the unit and window, andcalc_afp_specimen_reasons()splits the inadequate cases by reason over the cases classed inadequate.calc_afp_specimen_receipt_monthly()andcalc_afp_specimen_receipt_by_area()give percentiles of days from collection to laboratory receipt among the specimens received, with no threshold.calc_afp_followup()counts 60-day follow-up, with completion and timeliness over the inadequate cases due for follow-up. The building blocks areafp_stool_adequacy(), now the single stool adequacy classifier with three named definitions,afp_stool_components(),afp_specimen_receipt()andafp_followup_status().Added the pending classification stage ladder.
calc_pending_stage()counts open cases by month of onset and by the furthest laboratory stage their specimens reached, withopen_shareover all cases in the month and each stage share over the open cases.afp_pending_open(),afp_pending_dates(),afp_specimen_rung()andafp_pending_stage()are the steps it is built from.Added environmental surveillance performance indicators.
calc_es_resolution()gives the share of samples resolved by collection month, over all samples collected.calc_es_district_performance()andcalc_es_site_performance()give the enterovirus and poliovirus shares over resolved samples, so samples still at the laboratory are left out, and site regularity over the months a site was open.es_reporting_window(),es_complete_end()andes_sample_state()set the window and the minimum-sample rule.Added counts of virus detections in comparison windows.
calc_detection_windows()counts detections, reported cases, positive environmental samples, provinces and clusters in each window, andcalc_detection_comparison()compares window pairs with the direction rule indetection_direction(). These are counts, with no denominator.detection_slice(),detection_default_windows()anddetection_default_pairs()prepare the input and the windows.Added the environmental site scorecard.
calc_es_scorecard()judges each active site on campaign response, over the samples collected within the weeks after the latest campaign in its district, and on neighbour recovery, over the months the site was sampled while a site nearby found target virus.calc_es_score_network()pools numerators and denominators across sites, andcalc_es_score_profile()gives the share of samples with Sabin virus over all samples in each band of weeks since a campaign.es_score_settings()andes_score_cols()hold the settings and column map. Retention isNAfor a site whose campaign response rate is zero.The five indicator modules share one set of conventions. Input tables are named
cases,specimens,samples,campaignsanddetections, andcolsis a list keyed by those table names, with the same role name for the same column in every module. Functions that group by administrative level takelevel("adm0","adm1"or"adm2") and returnlevel,guidandname. The reporting date isas_of, defaulting toSys.Date(), and a window given by dates isfromandto. A column ending_pctis on a scale of 0 to 100, and one ending_shareor_rateon a scale of 0 to 1.Added a generator of synthetic surveillance tables, moved here from the stand-alone polioindicators package.
simulate_admin_frame(),simulate_population(),simulate_afp_cases(),simulate_es_samples(),simulate_detections(),simulate_human_specimens()andsimulate_campaigns()build invented geography, population, cases, samples, detections, stool specimens and campaign rounds, andsimulate_polio_data()builds them all on one geography. Every rate, share, delay and label is an argument, results are the same for a seed, and the caller’s random state is left as it was. Tests run every indicator module on these tables.dplyr 1.1.0 or later is now required, and rlang is now imported. # polished 0.3.0
Population rate denominators now include districts without reported cases when a complete administrative lookup is supplied. Explicit year-specific parent mappings take precedence; ambiguous mappings are rejected.
SIA deduplication selects the latest subactivity revision and preserves timestamp precision. ES coordinate and human-specimen collection checks now use the cleaner output names. Unavailable checks report
not_runand their missing columns instead of disappearing from the summary.polis_config(reference_date = ...)controls date-dependent cleaning, indicators and checks consistently. Population years and the calculation date invalidate caches. Disabled caches avoid input hashing; enabled caches reuse reference fingerprints within a run.Download caches track query scope and revisions. Same-count edits, replacements and deletions are reconciled. Changed scopes and legacy caches with unknown filters require a fresh pull. Failed pulls retain the previous complete file and resumable checkpoints.
Downloads write immutable pages followed by one year compaction. Progress uses validated metadata. Failed file renames abort without advancing the committed cursor. Unchanged revision-based snapshots avoid full data reads and partition rebuilding.
Population snapshots expire after one day by default; set
reference_refresh_days = 0for every-call refresh. Tables with only event dates are refreshed in full because those dates cannot identify edits.Downloading, directory discovery, cleaning and output loading share format support, including
.rda. Output writes use atomic replacement. Download documentation now states the actual memory requirements andraw_*paths.
polished 0.2.2
-
get_polis_data()gainsverify_years(default3L). The post-download completeness check, the slowest step on large tables, now covers only the most recent calendar years instead of the whole range back tomin_date. Passverify_years = NULLfor the full-range check. - Read timeouts are now retried.
httr2::req_retry()defaultsretry_on_failure = FALSE, somax_triesnever covered transport errors and a single timeout aborted the run.POLIS_TIMEOUT_SECONDSoverrides the 120-second default. - A year whose worker fails is requeued up to three times instead of ending the download outright. Parts are checkpointed, so each retry resumes from the last Id.
- A local copy slightly ahead of the declared row count keeps its cache; rows POLIS retires between pulls are not corruption. Only an excess beyond 1% clears the year parts, and the canonical file now survives until its replacement is written.
polished 0.2.1
-
get_polis_data()no longer treats a local copy that is larger than the server’s declared row count as up to date. That test used>=, so a table carrying rows POLIS had since retired, or duplicates from an interrupted merge, reported itself complete and was skipped on every subsequent run – the surplus kept the condition true, so the table could never refresh again withoutforce = TRUE. The count is now compared with==, and a local copy holding more rows than declared clears its cache and refetches.
polished 0.2.0
CRAN release: 2020-09-29
- Added
clean_afp_diagnosis(), aclean_afp()step that harmonises the AFP clinical diagnosis. POLIS scatters the clinical cause across four fields (diagnosis_final, the ICD-10diagnosis_other, and the bilingual free-textdiagnosis_other_specified/provisional_diagnosis); it coalesces them, in priority order with a confirmed-polio override, into a singlediagnosis_harmonised(plus adiagnosis_sourceprovenance), then derivesdiagnosis_classand theis_non_afpflag that separates reported non-AFP illness (malaria, sepsis, malnutrition, …) from the acute-flaccid-paralysis differentials, the 60-dayresidual_paralysisoutcome and thefebrile_asymmetric_onsetflag. The mapping ships as three reviewable reference tables exposed bypolis_afp_diagnosis_lookup()(free-text keywords, multilingual),polis_afp_icd10()(ICD-10 prefixes) andpolis_afp_diagnosis_class()(diagnosis -> class). - Added
clean_pop(), the POLIS population cleaner: it turns the raw population reference into adm0/adm1/adm2 under-5 / under-15 / all-ages denominators, optionally reconciled against a WorldPop input and rolled up by boundary validity. This is the base for the rate indicators.checks_pop()and achecks_popworkbook tab add its per-stream data-quality checks. -
polis_config()andclean_pop()gainpop_sourceto choose the<age>_popdenominator:"reconciled"(default — a trusted POLIS value, else WorldPop, else the district -> province -> country ladder),"polis", or"worldpop". The chosen value keeps<age>_pop_polisand<age>_pop_wpalongside it so every source stays inspectable. - Added
init_polis_pipeline(), a full pipeline-project scaffold: the domain-numbered layout (01_data,02_scripts,03_outputs), a.Rprofiledefiningcfg, a.gitignore, and runnable download / process scripts, so the project runs end to end once the boundary layers are dropped in.renv = TRUEpins package versions for collaborators. It is distinct from the lighterinit_polis_project(). -
run_pipeline()now returns adetectionstable alongsidevirus— a per-detection projection of the positives table (epid, adm0-adm2 + adm2 GUID, latitude/longitude, the virus label, vtype, emergence group, surveillance type/source, and dates) that recomputes nothing. - Added
polis_dictionary(), a data dictionary for the raw and cleaned tables. - Added citation metadata: a
CITATION.cff(GitHub’s “Cite this repository”) andinst/CITATION, socitation("polished")returns the package reference.
polished 0.1.0
CRAN release: 2020-07-01
- Initial development version.
- Unified
raw_*/polished_*naming end to end:get_polis_data()writes each table under itsraw_*stem (newfile_stemcolumn onpolis_tables_mapping) and migrates files written under the old bare table name in place on the next run (no re-download).run_pipeline_dir()readsraw_*inputs and writespolished_*outputs, with each output’s format following its source file. -
run_pipeline()now runs end to end: it cleans human specimens viaclean_human_spec(), passes a configuredshapeto every cleaner for admin reconciliation, and computes the surveillance indicators (calc_polio_indicators()) using a configuredpopulationdenominator.polis_config()gainspopulationandshapereference handles. - Added per-stream data-quality checks —
checks_afp(),checks_es(),checks_sia(),checks_virus(),checks_hum_spec()— andwrite_checks_excel(), a styled one-tab-per-check workbook.run_pipeline_dir()writes achecks_<dataset>.xlsxper output. -
get_polis_data()gainsprune_parts(delete the resume cache after a verified write, rebuilt from the canonical next run) and self-heals a corrupt canonical by rebuilding it from the intact parts. - Extended
calc_polio_indicators()from 4 to the full WHO POLIS indicator catalogue (~62 indicators across AFP, Stool, Dose, Timeliness, Lab, ES, Virus, SIA and Composite families), driven by DRY generators and a unified registry thatavailable_indicators()reads (queryable byfamily). New optional source inputs (virus,es,sia,lab,admin_units); missing sources/columns skip with a warning rather than erroring. -
get_polis_data()now supports thepopulationreference table. It carries no usable update date, so it is pulled whole in a single Id-paginated pass with no date/region filter (date_field = NAinpolis_tables_mapping). Note: the endpoint/field still need a live-API sanity check before relying on it. - Added the EPID-driven geography cleaner:
impute_geo_from_epid()plus theepid_split()/epid_country_code()/epid_prefix()/epid_strip_contact()parsers, thebuild_admin_ref()/build_prefix_ref()reference builders, andresolve_epid_country().
