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
Owner

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_land builds territory lists — every general-purpose government serving a county — and will hand them to cog_geographic_rollup(). Police, FY2022 (a complete census year), checked 2026-11-17 against the finance API:

Territory Governments File any Police row File Police capital
Dane County, WI 60 reporting through 2022 42 21
Middlesex County, MA (municipalities) 54 53 operations 37

Leyden, MA files Police operations and no capital in 2012, 2017 and 2022. With complete = TRUE, cog_spending() fills its capital as NA (not_reported), as R/complete.R requires 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).
  • #80 asked whether a sheriff-contract city's missing Police row is a real zero or an intergovernmental payment the default concept does not count.

Decide

  1. In a cohort sum, when does "surveyed but no row in this category" count as zero, and when does it make the total incomplete? By era, by category, by subtype (operations vs capital), or by an argument the caller sets?
  2. Does 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?
  3. How is the rule recorded in provenance, so a reader of a total can tell which governments contributed zero by rule?

Consumer

nss_land phase 4 (nss_territory_spending()) passes its list to cog_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 in uscogdata".

`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_land` builds territory lists — every general-purpose government serving a county — and will hand them to `cog_geographic_rollup()`. Police, FY2022 (a complete census year), checked 2026-11-17 against the finance API: | Territory | Governments | File any Police row | File Police capital | |---|---|---|---| | Dane County, WI | 60 reporting through 2022 | 42 | 21 | | Middlesex County, MA (municipalities) | 54 | 53 operations | 37 | Leyden, MA files Police operations and no capital in 2012, 2017 and 2022. With `complete = TRUE`, `cog_spending()` fills its capital as `NA` (`not_reported`), as `R/complete.R` requires 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`). - #80 asked whether a sheriff-contract city's missing Police row is a real zero or an intergovernmental payment the default concept does not count. ## Decide 1. In a cohort sum, when does "surveyed but no row in this category" count as zero, and when does it make the total incomplete? By era, by category, by subtype (operations vs capital), or by an argument the caller sets? 2. Does `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? 3. How is the rule recorded in `provenance`, so a reader of a total can tell which governments contributed zero by rule? ## Consumer `nss_land` phase 4 (`nss_territory_spending()`) passes its list to `cog_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 in `uscogdata`".
jared added the
ws
api
type
decision
labels 2026-11-17 12:48:47 -05:00
jared added the
needs
human
label 2026-11-17 12:48:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Civilytics/uscogdata#85