feat!: require corpus schema_version 4 (Phase P canonical ids)
BREAKING CHANGE: canonical_govid is now uniformly 12 characters across every vintage; corpora built against schema_version 3 are rejected. Bumps MinCorpusSchema/MaxCorpusSchema to 4 and expected_version in cog_open(). canonical_fips_xwalk grows to the 14-column Phase P master schema (adds legacy_govs_id, census_geoid, id_source; confidence is renamed to pop_confidence); .empty_xwalk_tibble() is rewritten to match.
This commit is contained in:
+2
-2
@@ -31,5 +31,5 @@ Suggests:
|
|||||||
Config/testthat/edition: 3
|
Config/testthat/edition: 3
|
||||||
VignetteBuilder: knitr
|
VignetteBuilder: knitr
|
||||||
RoxygenNote: 7.3.3
|
RoxygenNote: 7.3.3
|
||||||
MinCorpusSchema: 3
|
MinCorpusSchema: 4
|
||||||
MaxCorpusSchema: 3
|
MaxCorpusSchema: 4
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# uscogdata 0.1.0 (development)
|
# uscogdata 0.1.0 (development)
|
||||||
|
|
||||||
|
## Breaking: corpus schema_version 4 (Phase P canonical ids)
|
||||||
|
|
||||||
|
* The package now requires corpus `schema_version = 4` (`MinCorpusSchema` /
|
||||||
|
`MaxCorpusSchema` in `DESCRIPTION` are both `4`); older corpora built
|
||||||
|
against schema 3 are rejected by `cog_open()` with a clear version-mismatch
|
||||||
|
error. `canonical_govid` is now uniformly 12 characters across every
|
||||||
|
vintage the corpus covers (previously a mix of 9-char legacy ids and
|
||||||
|
12-char FIPS ids depending on source year) — **every hardcoded
|
||||||
|
`canonical_govid` literal from a pre-Phase-P corpus is now invalid** and
|
||||||
|
must be re-resolved via `cog_gov_search()` or the new `canonical_alias`
|
||||||
|
lookup table. `canonical_fips_xwalk` gains four columns
|
||||||
|
(`legacy_govs_id`, `census_geoid`, `id_source`; `confidence` is renamed to
|
||||||
|
`pop_confidence`) and a companion `canonical_alias` table ships in the
|
||||||
|
corpus for mapping legacy/alternate ids onto the current canonical
|
||||||
|
namespace. The bundled fixture corpus (`inst/extdata/fixture_corpus/`) has
|
||||||
|
been regenerated against the Phase P publish tree, now ships the full
|
||||||
|
`canonical_fips_xwalk` and `canonical_alias` master tables alongside the
|
||||||
|
2019-2020 long partitions, and is reproducible via
|
||||||
|
`data-raw/regenerate_fixture_corpus.R`.
|
||||||
|
|
||||||
## Clearer errors when `USCOGDATA_URL` is unconfigured or returns non-JSON
|
## Clearer errors when `USCOGDATA_URL` is unconfigured or returns non-JSON
|
||||||
|
|
||||||
* `cog_open()` now aborts with the `uscogdata_url_not_configured` error
|
* `cog_open()` now aborts with the `uscogdata_url_not_configured` error
|
||||||
|
|||||||
+4
-3
@@ -126,9 +126,10 @@ cog_gov_search <- function(name = NULL, state = NULL, type = NULL) {
|
|||||||
canonical_govid = character(0), gov_name = character(0),
|
canonical_govid = character(0), gov_name = character(0),
|
||||||
govs_type = integer(0), type_label = character(0),
|
govs_type = integer(0), type_label = character(0),
|
||||||
fips_state = character(0), fips_county = character(0),
|
fips_state = character(0), fips_county = character(0),
|
||||||
fips_place = character(0), first_year = integer(0),
|
fips_place = character(0), legacy_govs_id = character(0),
|
||||||
last_year = integer(0), population_acs = integer(0),
|
first_year = integer(0), last_year = integer(0),
|
||||||
confidence = character(0)
|
census_geoid = character(0), population_acs = integer(0),
|
||||||
|
pop_confidence = character(0), id_source = character(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ cog_open <- function(url = .resolve_url(),
|
|||||||
DBI::dbExecute(con, "INSTALL httpfs; LOAD httpfs;")
|
DBI::dbExecute(con, "INSTALL httpfs; LOAD httpfs;")
|
||||||
|
|
||||||
manifest <- .fetch_or_cache_manifest(url, cache_dir)
|
manifest <- .fetch_or_cache_manifest(url, cache_dir)
|
||||||
.validate_schema(manifest, expected_version = 3L)
|
.validate_schema(manifest, expected_version = 4L)
|
||||||
.validate_scope(manifest)
|
.validate_scope(manifest)
|
||||||
|
|
||||||
.register_views(con, url, manifest)
|
.register_views(con, url, manifest)
|
||||||
|
|||||||
Reference in New Issue
Block a user