SNAP Negative program
This directory defines review shapes, workbook codes, calculation, versioned checks, policy amounts, and synthetic fixtures.
Calculation and checks
| Version family | Coverage |
|---|---|
| Calculation v1 | Legacy ordinary math, household sizes 1–8. |
| Calculation v2 | Expanded sizes through 20. |
| Calculation v3 | Education net and application-day proration; rejects self-employment losses. |
| Calculation v4 (current) | Adds farm/non-farm self-employment losses and bound policy support. |
| Check basic-v1 / full-v2 / full-v3 | Separate edit-check implementations; full-v3 is current. |
Unknown IDs throw. Read binding supplies fixed legacy IDs when older snapshots omit them;
it does not silently choose the current calculation. apply_rules is
restricted to admin/statistics while the review is with the examiner and invalidates Final
and stored checks.
Core functions
-
calculate: validate a scenario/version and return benefit lines using integer cents and explicit rounding. Shared limits include household size 20 and 100 income rows. -
selfEmploymentTotals: combine farm/non-farm profit and losses using the bound allowance percentages. -
prorateBenefit: application days 1–31 use a 30-day workbook month; small monthly benefits and day 31 can yield zero. -
selectFinal: compare populated examiner columns to Eligibility, choose the smaller absolute benefit difference, tie to Comp I, copy selected inputs. -
validateRequiredInput: submission blockers from the field catalog and bound check version. -
runFullEditCheck: findings stored on the review; findings and required-input blockers have different workflow effects.
Fields and policy
field-catalog.ts owns workbook labels, code choices, required sets and answer
normalization; nature-catalog.json supplies element/nature choices. Preserve
stored codes when editing labels. Field authority is the
current inventory.
policy.ts holds amount-table types/defaults and resolves the review’s saved
policy copy. Calculation inputs, version, and policy all affect a result.
Limits and extension
PA CAP is a retained field, not a calculation gate. Current coverage is a synthetic implementation, not certification of every SNAP rule. Seed tables for other FFYs are marked synthetic copies. Program modules avoid framework/database I/O, but some import review feature types/helpers. Add a supported version branch before publishing changed rule behavior; verify historical bindings with fixed examples.