Decide what a government's missing row contributes to a cohort sum #85
Open
opened 2026-11-17 12:48:47 -05:00 by jared
·
0 comments
No Branch/Tag Specified
main
ci/mirror-canonical-tags
chore/release-47-badges-mirror-pr
docs/readme-perf-remeasure-56
feat/pagination-search-balances-57
feat/duckdb-threads-60
feat/cohort-predicates-58
fix/windows-backslash-paths
ci/mirror-to-github
ci/github-actions-matrix
feat/public-release-0.3.0
chore/fixture-sb203
ci/apt-https
fix/pushdown-pagination
feat/all-categories-37
fix/partial-coverage-signposting-9
fix/schema-v7
fix/cog-categories-balance-subtype
feat/cog-balances-25
feat/revenue-concepts-12
feat/expenditure-concepts-11
feat/coverage-disclosure-13
feat/complete-argument-18
fix/kodor-batch-14-15-16
fix/all-scoped-series-breaks-19
fix/regen-fixture-corpus-18
test/walkthrough-findings
feat/expenditure-concept
fix/3-url-trailing-slash
feat/phase-r3-signposting
fix/fixture-option-b-aggregates
feat/phase-r2-harmonization
feat/phase-r1-forward
feat/cog-gov-search-basket-mode
v0.4.0
Labels
Clear labels
kodor
kodor/feature-proposal
kodor/fix
kodor/needs-review
kodor/triaged
madison-walkthrough
severity/high
severity/low
severity/medium
south-guide
verdict/defect
verdict/definitional
kodor
kodor/feature-proposal
kodor/fix
kodor/needs-review
kodor/triaged
Kodor should process this issue
Kodor has written a feature proposal
Kodor should implement a fix (assigned to Kodor)
Kodor's work or failure needs Jared's review
Kodor has already triaged this issue (skip)
Surfaced while building the client-facing Southern API guide
needs
human
Cannot move without a person -- a decision, a check an agent cannot make, something outside the repo
origin
client
Came from a client ask
origin
obligation
Created by a change elsewhere
origin
review
Came from human review
origin
roborev
Promoted from a roborev finding
type
chore
Maintenance with no behaviour change
type
debt
Owed work -- docs, tests, cleanup a change obligated
type
decision
Needs a decision before work can proceed
type
defect
Something is wrong
type
feature
New capability
ws
api
Query verbs and results
ws
corpus
Corpus, mirror, provenance
ws
docs
Vignettes and guides
Assign a task to kodor
Kodor thinks this needs a feature.
Kodor should fix this
Kodor thinks the user is ready to review this.
Kodor is done with this issue.
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Civilytics/uscogdata#85
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
cog_geographic_rollup()returns one row per government, layer and year, and leaves the sum to the caller. When the caller sums a territory's governments, nothing says what a government with no row in the requested category contributes. Decide that rule here, so every caller sums the same way.The problem in two counties
nss_landbuilds territory lists — every general-purpose government serving a county — and will hand them tocog_geographic_rollup(). Police, FY2022 (a complete census year), checked 2026-11-17 against the finance API:Leyden, MA files Police operations and no capital in 2012, 2017 and 2022. With
complete = TRUE,cog_spending()fills its capital asNA(not_reported), asR/complete.Rrequires for FY2012 onward.Under a rule that treats every absent row as missing, both territories' Police totals are blank in 2022. Under a rule that treats every absent row as zero, a government that was not surveyed that year adds nothing and the total looks complete.
What the corpus already distinguishes
n_units_collected(#36) separates "not surveyed this year" from "surveyed, no row in this category".R/complete.R: through FY2011 an absent cell means Census published $0 (census_zero); from FY2012 it means not reported, unknown (not_reported).Decide
cog_geographic_rollup()gain a summed output (or a companion verb) that applies the rule and flags each year's total as complete or incomplete, so callers stop summing by hand?provenance, so a reader of a total can tell which governments contributed zero by rule?Consumer
nss_landphase 4 (nss_territory_spending()) passes its list tocog_geographic_rollup()and returns the result unchanged with its counters. It does not wait on this issue; it will adopt the rule once one exists. Design:nss_land/docs/superpowers/specs/2026-11-17-land-cover-layer-design.md, "Finance" and "Work filed inuscogdata".