Changelog
Source:NEWS.md
DSIR 0.7.0
Breaking changes
-
gho_clean()andsdg_clean()now share a single 15-column output schema:source,id,indicator,location,iso3,location_name,year,value,value_num,low,high,series,dim1,dim2,dim3. This lets results from the two APIs be combined directly (seebind_indicators()below). Migration notes from 0.6.x:-
gho_clean()output no longer has 11 columns; it has 15. New columns includesource("gho"),iso3(the ISO3 alpha-3 code when the spatial dim matches a WHO Member State,NAotherwise),location_name(resolved againstwho_countriesand WHO regional codes; see the bug-fix note below), andseries(alwaysNA— an SDG-only concept). -
sdg_clean()output no longer has 10 columns and is reshaped to the unified schema. Several columns moved or were renamed: the SDGgoalandtargetcolumns are no longer carried forward; the SDG indicator code is now inid(wasindicator); the human-readable series description has moved toindicator(was not present before); a newiso3column holds the ISO3 alpha-3 code viam49_to_iso3()for Member States. - Both cleaners now coerce
value_num/low/highto numeric; non-numeric raw values (e.g. SDG"<0.1") yieldNAin those columns whilevaluekeeps the raw character form. - Both cleaners now coerce
yearto integer.
-
New features
New
bind_indicators(...): stacks any number of tibbles returned bygho_clean()andsdg_clean()into a single tibble. Because the two cleaners now share a schema, the result is uniform and can be filtered, joined, or visualised without source-specific code paths; use thesourcecolumn to distinguish GHO from SDG rows.New
m49_to_iso3(): maps UN M49 numeric area codes to ISO3 country codes, the counterpart toiso3_to_m49(). Accepts zero-padded ("076") and bare ("76") input. Non-Member areas — including region / world aggregates — returnNA. Used internally bysdg_clean()to populate the newiso3column.
Bug fixes
Fixed a duplicate definition of
sdg_coverage(): the function was defined in bothR/sdg.RandR/sdg_coverage.R, and R’s alphabetical source-file loading meant the wrong copy (with a fragile\rcomposite-key separator and no upfront.resolve_area()call) was the one actually in effect. The surviving implementation now uses\x1fas the composite-key separator and resolves theareaargument up-front, so the documented “unknown ISO3 codes warn and are dropped” message surfaces cleanly fromsdg_coverage()rather than being swallowed inside an internal call tosdg_data()..gho_get()now sets a 20-second per-request timeout and applies the same exponential backoff (backoff = ~ min(2 ^ .x, 30)) as.sdg_get(). Previously a hung upstream request could stall an entiregho_data()call indefinitely.gho_clean()andsdg_clean()now populatelocation_nameconsistently across both APIs. WHO Member States are resolved againstwho_countries$name_shortin both cleaners, so the same country has the samelocation_nameregardless of source.gho_clean()additionally resolves the WHO regional codes (AFR,AMR,SEAR,EUR,EMR,WPR) andGLOBALto their human-readable names.sdg_clean()falls back to the SDG API’s originalgeoAreaNamefor non-Member-State rows (e.g. regional and world aggregates), preserving information thatwho_countriesdoes not carry.gho_clean()now actually populates theindicatorcolumn. The GHO data endpoint (/api/{IndicatorCode}) does not returnIndicatorName, so the old implementation leftindicatorNAfor every row despite the documented mapping.gho_clean()now lazy-loads the indicator catalog (viagho_indicators()) once per R session and resolvesIndicatorCodeagainst it to fill theindicatorcolumn with the human-readable name. The output schema is unchanged; if the catalog cannot be fetched,indicatorfalls back toNAand a warning surfaces fromgho_indicators().
Documentation
- All network examples now use
\donttest{}instead of\dontrun{}, so CRAN reviewers can opt to run them.
Internal
Added
httptest2to Suggests. The GHO and SDG helpers gain offline regression tests covering the emptyvalue=[]fix, the OData pagination loop, the multi-value SDGindicator/areaCoderepeated-key URL form, the client-side SDG year filter, and the graceful-failure behaviour on HTTP errors.Test coverage expanded for
gho_clean(),sdg_clean(),bind_indicators(),m49_to_iso3(),scale_*_dsi_col(), thewho_countriesdataset, and the regional ISO3 vectors.
DSIR 0.6.0
Behavior changes
theme_dsi()now draws grid lines in both directions by default. Newgridargument controls direction — passgrid = "y"to restore the previous look (horizontal grid only). This change fixes the visual glitch where horizontal bar charts (made withcoord_flip()) had grid lines running parallel to the bars instead of crossing them.theme_dsi_facet()gains agridargument mirroringtheme_dsi()’s — defaults to"both"(unchanged behaviour); pass"y","x", or"none"to control which direction(s) the grid runs.
New features
New
scale_y_dsi_col()andscale_x_dsi_col()— drop-in replacements forscale_y_continuous()/scale_x_continuous()that remove the lower axis expansion, so columns in bar charts sit flush with the axis (WHO publication style).New
theme_dsi_facet()for faceted plots — uses panel borders, light-grey strip backgrounds, and bilateral grid lines.-
New GHO data-availability helpers, for screening indicator / filter combinations before pulling a full result set:
-
gho_has_data()returnsTRUE/FALSE/NAfor whether the server has any rows for an indicator and filter. -
gho_count()returns the row count the same filter would yield, using the OData$count=trueendpoint (no rows transferred). -
gho_coverage()returns a tibble withlocation,year_min,year_max,n_obsper area, using$select=SpatialDim,TimeDimto keep the payload small.
-
sdg_indicators()gains asearchparameter, mirroringgho_indicators(search). Accepts either a single string (split on whitespace into terms) or a character vector (terms used verbatim). All terms must match (AND semantics, case-insensitive substring on the indicatordescriptioncolumn). The filter is applied client-side because the UN SDG/Indicator/Listendpoint is not OData and exposes no server-side search parameter; the list is small enough (~250 rows) that this is cheap.New
sdg_coverage(): series-exploration helper for SDG indicators. An SDG indicator (e.g."3.4.1") typically contains several series stratified by sex, age, or cause;sdg_coverage()returns a tibble of(location, series, year_min, year_max, n_obs)so you can see which series exist and how each is covered. This is intentionally framed as series-exploration rather than as agho_has_data()/gho_count()-style availability precheck — SDG data is generally complete, so those screening helpers are deliberately not provided for SDG.New
geomean(): geometric mean of a numeric vector, with optional weights viaw. Useful for aggregating ratio-based health indicators such as UHC service-coverage tracers. Handles NA (removed by default), zeros (returns 0), and negative values (warns and returns NaN).New
iso3_to_m49(): maps ISO3 country codes to UN M49 numeric codes using the bundledwho_countriesdataset. Non-Member codes returnNA. Input is case-insensitive.sdg_data()andsdg_coverage()now accept ISO3 codes directly for theareaargument; M49 codes continue to work unchanged. DSIR’s regional vectors (wpro_cty,afro_cty, etc.) can now be passed directly to SDG functions, matching the existing GHO workflow. ISO3 and M49 cannot be mixed within a single call.New
iso3_to_region(): maps ISO3 country codes to WHO region codes ("AFR","AMR","SEAR","EUR","EMR","WPR") using the bundledwho_countriesdataset. Passlong = TRUEfor full names ("Western Pacific", etc.). Non-Member codes (e.g. Associate Members like"PRI") returnNA. Stays in sync with WHO governance changes reflected in DSIR — e.g. Indonesia in WPR since EB156 (May 2025).
Bug fixes
sdg_data(): year filtering (year_from/year_to) is now applied client-side. The UN SDG API’s server-sidetimePeriodStart/timePeriodEndparameters were causing HTTP 500 errors and ~30x slowdowns on at least some indicator/area combinations (e.g.3.2.1witharea = "608"); client-side filtering avoids the issue. User-facing behaviour is unchanged.sdg_coverage()inherits the fix automatically because it dispatches throughsdg_data()..sdg_get()now sets a 20-second per-request timeout and exponential backoff between retries (backoff = ~ min(2^.x, 30)), so a hung upstream request cannot stall a call indefinitely.The internal pagination helper
.gho_get()previously produced a spurious 1-row, 1-column tibble (V1of type list) when the server returned an empty result set (value = []). Emptyvaluechunks are now skipped and an empty tibble is returned when no rows accumulate. This affectedgho_data()on filters with no matches (e.g. an indicator + area combination GHO has no data for) andgho_indicators(search)when no indicator name matched the search term.sdg_data()now correctly filters when more than one indicator or area code is supplied. The SDG API expects multi-value parameters as repeated keys (indicator=A&indicator=B), but the previous implementation joined them with commas (indicator=A,B); the API silently dropped the filter and returned all rows. Single-value calls were unaffected.sdg_data()no longer errors withduplicate 'row.names' are not allowedwhen the result spans more than one page. The per-page row-name handling has been simplified.
DSIR 0.5.0
Breaking changes
-
theme_dsi(): removed thecolorargument and addedaccentinstead. The semantics are different:colorpreviously controlled text colour, whileaccentnow controls axis line and tick colour. If you usedtheme_dsi(color = X)in 0.2.x, change totheme_dsi(accent = X)and note that the visual effect has shifted from “everywhere” to “axis only”. Text colour is now fixed togrey20to follow modern publication conventions.
Bug fixes
-
gho_data()now correctly handles longareavectors. Previously, passing more than ~22 ISO3 codes hit the upstream query string length limit and resulted in HTTP 400 errors. Switched from chained OR clauses to the ODatainoperator, which generates a much shorter URL and supports up to ~115 codes per call.
New features
New
gho_clean(): post-processor forgho_data()output. Selects the useful columns and renames them to snake_case (id,location,year,dim1-dim3,value,value_num,low,high,indicator). Output schema is stable across indicators — missing columns are filled withNA. See?gho_cleanfor details.New
sdg_clean(): counterpart forsdg_data(). Renames the SDG API columns to snake_case and flattens theindicatorlist-column. Returnsvalue,low, andhighas character to preserve non-numeric entries ("<0.1", aggregate notes); coerce withas.numeric()downstream. See?sdg_cleanfor details.
Improvements
-
theme_dsi()redesigned to follow modern publication conventions (BBC, OECD, Financial Times style):- Removed panel border; axis lines only on left and bottom
- Removed vertical grid lines (kept horizontal only)
- Lighter grid colour (
grey92, wasgrey85) - Larger title and subtitle
- Text colour standardised to
grey20 - Title left-aligned to plot edge
- New
legend_positionargument
gho_data()now infersspatial_type = "country"whenareais provided without an explicitspatial_type. Passspatial_typeexplicitly to silence the message.gho_data()now validates theareaargument: must be a non-NA, non-empty character vector.
DSIR 0.4.0
New features
New
who_countriesdataset: a tibble of all 194 WHO Member States with ISO3, ISO2, UN M49 numeric code, official and short names, WHO region, and ais_picflag for the 14 Pacific Island Country Member States.New regional ISO3 character vectors for ergonomic filtering:
afro_cty,amro_cty,searo_cty,euro_cty,emro_cty, pluspic_cty. All are derived fromwho_countriesand stay consistent with the master table.
Important data changes
-
wpro_ctynow contains 28 countries (was 22 in 0.2.0). This reflects the May 2025 World Health Assembly decision (EB156) reassigning Indonesia from the South-East Asia Region to the Western Pacific Region, along with Cook Islands and Niue, which are full WHO Member States but were previously omitted. Code that aggregates overwpro_cty(sums, counts, joins) will produce different results than under DSIR 0.2.x — this is intended.
DSIR 0.2.0
CRAN release: 2026-04-21
Initial CRAN submission. Renamed from DSI to avoid a name clash with the existing CRAN DSI package.
New features
-
gho_dimensions()returns the unique values of a dimension column for a given GHO indicator, to make it easier to discover which breakdowns (sex, age, region, etc.) are available before callinggho_data(). -
sdg_targets()lists Sustainable Development Goal targets from the UN SDG API, complementingsdg_goals()andsdg_indicators().
Improvements
-
theme_dsi()anddsi_flextable_defaults()now default to the device / package default font (base_family = ""), so they work on systems where Cambria is not installed. Passbase_family = "Cambria"to get the original look. -
ggpie()gains input validation and uses tidy-evaluation helpers internally, soR CMD checkno longer reports undefined global variables. -
gho_*()andsdg_*()now fail gracefully when the remote service is unreachable, per CRAN policy for packages that hit the network. They warn and return an empty data frame (orNULL) instead of raising a hard error. - Full
roxygen2help pages for every exported function, with cross-references between related functions. - All runnable examples use
\donttest{}(not\dontrun{}) for network-dependent code, so CRAN reviewers can opt into running them.