Skip to content

Schema decision: is known_nulls an exact count or a ceiling? #121

Description

@mmcky

schema.known_nulls maps a column to a null count, and #14's template treats it as exact: n != known.get(col, 0) fails. Two dynamic snapshots now carry counts that a refresh will change:

  • business_cycle_data.csv.yml: {YR1960: 9} — stable by construction, growth is undefined in the first year for every economy.
  • the FRED composite: {UNRATE: 349, UMCSENT: 616, CPILFESL: 457, M0892AUSM156SNBR: 1132} — leading nulls before each series starts, on a monthly panel whose length grows with every refresh, so at least some of these counts move as soon as the panel is extended.

Frozen extracts want exact counts (a changed null is a changed file). Tracking snapshots want a shape constraint, not a number.

Options.

  1. Exact everywhere; the refresh stamps the new counts alongside retrieved and date_range.end, so the manifest diff shows them. Simple, but it turns a data invariant into a field the pipeline rewrites.
  2. Ceiling everywhere: n <= known. Never fails on a refresh that fills in history, but it silently accepts a column going empty below the ceiling.
  3. Exact by default, with an explicit ceiling form for tracking snapshots, e.g. {UNRATE: {max: 400}} or a {col: "<=400"} string. Two forms to document and validate.
  4. A positional rule instead of a count: nulls allowed only before a series' first observation or in the newest k rows, never inside (what business_cycle's validate() already implements by hand), with the count kept as documentation.

Decide, then update manifest-schema.yml's known_nulls comment and the template's check in step with the manifest-driven validate().

Sub-issue of #14.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions