fix: close five final-review gaps in all-categories mode
- .detect_direct_suppressed() keys on (year, canonical_govid, category); all-categories mode collapses category to one literal value, so the key collides and the detector silently reports FALSE instead of "unknown". Report NA there instead, and stop isTRUE() in .build_provenance() from collapsing that NA back to FALSE. Schema widened to allow null. - Refuse complete = TRUE + category = "All Categories": the completion grid has no per-category cells left to fill once categories are collapsed, so the prior silent 0-rows-filled result was never actually checked. - cog_balances(category = "All Categories") returned zero rows with no error. .validate_verb_inputs() gains allow_all_categories (default FALSE); .verb_spendrev() passes TRUE, cog_balances() does not, so the three verbs share one place to reject it instead of drifting again. - Fix the false `subtype = "operations"` argument claim (no such argument exists) in NEWS.md and an internal spending.R comment. Adds three covering tests to test-all-categories.R for the three behaviour changes above.
This commit is contained in:
+6
-1
@@ -28,7 +28,12 @@ argument: for holdings, `category` is a strict coarsening of
|
||||
every combination would be either redundant or empty.
|
||||
`category = "Fund Balances"` is exactly the `general` family
|
||||
(`W01`/`W31`/`W61`). `balance_subtype` is returned, so a finer split is
|
||||
one `dplyr::filter()` away.}
|
||||
one `dplyr::filter()` away. The reserved pseudo-category
|
||||
`"All Categories"` (see [cog_spending()]) is **not** supported here and
|
||||
errors with class `uscogdata_all_categories_unsupported`: it sums a
|
||||
concept's subtype scope, and holdings are a stock with no concept
|
||||
vocabulary to sum across. Omit `category` to get every category broken
|
||||
out instead.}
|
||||
|
||||
\item{per_capita}{Divide holdings by population. Note this is a **stock per
|
||||
resident** (reserves per person), which is *not* comparable to
|
||||
|
||||
+6
-1
@@ -106,7 +106,12 @@ possibly-misleading `"harmonized"`/`"raw"` value.}
|
||||
component (when one exists), and
|
||||
`provenance$expenditure_concept_direct_suppressed` is `TRUE` -- the
|
||||
figure in those rows is the intergovernmental leg alone, not Direct +
|
||||
IG.}
|
||||
IG. When `category = "All Categories"` is combined with
|
||||
`expenditure_concept = "total"`, this detection cannot run (it keys on
|
||||
per-category rows, which all-categories mode collapses to one literal
|
||||
value), so `expenditure_concept_direct_suppressed` is `NA` rather than a
|
||||
possibly-false `FALSE`; query an explicit `category` to get a real
|
||||
answer.}
|
||||
|
||||
\item{complete}{If `TRUE`, fill the requested grid so that a cell the
|
||||
corpus does not carry still appears, labelled with **why** it is
|
||||
|
||||
Reference in New Issue
Block a user