This repo is a dynamic benefit cliff calculator for comparing modeled household resources across earnings levels and across states using individually entered household members and ages. It keeps the lightweight repo shape of tanf-calculator, but swaps the static precompute grid for an on-demand PolicyEngine-backed API.
- compares a selected household across all 50 states and DC
- traces a single household through an earnings curve to surface cliffs
- shows a first-pass modeled bundle of:
- SNAP
- TANF or state equivalent
- WIC
- free school meals
- refundable tax credits
- healthcare value
The v1 metric is:
net resources = market income + modeled support - taxes before refundable credits
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite 5, Recharts, react-simple-maps |
| Runtime calculations | Python, PolicyEngine US |
| Local API | built-in http.server wrapper around shared compute helpers |
| Deploy target | static frontend + serverless-style api/ handlers |
The important product constraint is that we do not precompute every state, income point, and program combination. Instead:
- the frontend stays static
- household, state, and series requests are computed on demand
- repeated requests are cached in memory by input signature
- only metadata is effectively static
More detail is in COMPUTE_STRATEGY.md.
frontend/: React appcliff_watch/: installable Python package with the calculator, config, and a local dev API serverapi/: serverless-style request handlers that share the same compute layerexamples/: sample payloads for the CLItests/: pytest suitedocs/: static build output from Vite
Install the package in editable mode (pulls PolicyEngine-US automatically):
uv venv .venv && uv pip install -e ".[dev]"If you already have a local policyengine-us checkout, you can point this repo at it:
export POLICYENGINE_US_REPO=../policyengine-uscd frontend
npm installStart the local API:
cliff-watch-dev-serverIn a second terminal:
cd frontend
npm run devThe app will run at http://localhost:3000/, with /api/* proxied to the local Python server.
You can also run the calculator without the frontend:
python3 -m cliff_watch.calculator examples/sample_household.json --mode household
python3 -m cliff_watch.calculator examples/sample_household.json --mode states
python3 -m cliff_watch.calculator examples/sample_household.json --mode series- Household inputs are person-based in v1, with each family member entered individually by type and age.
- Earnings are assigned to the first adult and held constant over the year.
- A second adult is treated as a spouse, and later adults are modeled as additional household members in the same household unit.
- County-specific refinements are not exposed in the UI yet.
- The modeled bundle is intentionally narrower than every possible administrative program.
This project is licensed under the MIT License. See LICENSE.