[PULL REQUEST] Households by Workers#278
Conversation
There was a problem hiding this comment.
Pull request overview
Adds “households by number of workers (0,1,2,3+)” as a new output within the Household Characteristics module, sourcing tract-level distributions from ACS B08202 and applying MGRA-level controls/adjustments.
Changes:
- Adds ACS tract control SQL for households by worker count (with regional fallback for missing tract distributions).
- Adds MGRA control SQL inputs used by the worker characteristic (18+ population proxy and collapsed household size controls).
- Extends the Python household-characteristics pipeline to compute, validate, and insert “Household Workers - *” outputs, plus supporting constants/validation counts.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sql/hh_characteristics/get_tract_controls_hh_by_workers.sql | New ACS B08202-based tract distribution controls for worker categories (0–3+). |
| sql/hh_characteristics/get_mgra_controls_hh_by_workers_hhs.sql | New SQL to fetch/collapse households-by-size outputs into (1,2,3+) controls for the workers step. |
| sql/hh_characteristics/get_mgra_controls_hh_by_workers_18plus.sql | New SQL to fetch MGRA 18+ population control totals (proxy constraint). |
| sql/hh_characteristics/get_mgra_controls_hh_by_size.sql | Comment/docstring tweak to reflect correct parameters. |
| python/utils.py | Adds HOUSEHOLD_WORKERS constant and fixes connection-string formatting. |
| python/tests.py | Updates expected distinct counts to include household_workers. |
| python/hh_characteristics.py | Adds the end-to-end “households by workers” computation, validation, and insertion to DB/debug outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Eric-Liu-SANDAG
left a comment
There was a problem hiding this comment.
I think just add wiki stuff to this PR, did some basic sanity checks on the data, looks okay
|
Can you re-run with the new 18+ to test if the more restricted household population only still works? |
|
Completed run in |
|
Can you also add your worker validation scripts to the file |
Describe this pull request. What changes are being made?
This pull request adds to the household characteristics module, households by number of workers.
Validation and testing
Production database
[run_id]=225. Checked that household size constraints were not violated at the MGRA level and checked the 18+ population soft constraint was also respected. See SQL code below.What issues does this pull request address?
closes #247
Additional context
This is being done in service of SANDAG/Cohort-Component-Model#140.
As part of this review, once the first review of the methodology is approved, we can add a section to the Wiki either as a part of this PR or a subsequent.