12 KiB
name, description
| name | description |
|---|---|
| policyengine-parameter-patterns | PolicyEngine parameter patterns - YAML structure, naming conventions, metadata requirements, federal/state separation |
PolicyEngine Parameter Patterns
Comprehensive patterns for creating PolicyEngine parameter files.
Critical: Required Structure
Every parameter MUST have this exact structure:
description: [One sentence description].
values:
YYYY-MM-DD: value
metadata:
unit: [type] # REQUIRED
period: [period] # REQUIRED
label: [name] # REQUIRED
reference: # REQUIRED
- title: [source]
href: [url]
Missing ANY metadata field = validation error
1. File Naming Conventions
Study Reference Implementations First
Before naming, examine:
- DC TANF:
/parameters/gov/states/dc/dhs/tanf/ - IL TANF:
/parameters/gov/states/il/dhs/tanf/ - TX TANF:
/parameters/gov/states/tx/hhs/tanf/
Naming Patterns
Dollar amounts → /amount.yaml
income/deductions/work_expense/amount.yaml # $120
resources/limit/amount.yaml # $6,000
payment_standard/amount.yaml # $320
Percentages/rates → /rate.yaml or /percentage.yaml
income_limit/rate.yaml # 1.85 (185% FPL)
benefit_reduction/rate.yaml # 0.2 (20%)
income/disregard/percentage.yaml # 0.67 (67%)
Thresholds → /threshold.yaml
age_threshold/minor_child.yaml # 18
age_threshold/elderly.yaml # 60
income/threshold.yaml # 30_000
2. Description Field
The ONLY Acceptable Formula
description: [State] [verb] [category] to [this X] under the [Full Program Name] program.
Components:
- [State]: Full state name (Indiana, Texas, California)
- [verb]: ONLY use: limits, provides, sets, excludes, deducts, uses
- [category]: What's being limited/provided (gross income, resources, payment standard)
- [this X]: ALWAYS use generic placeholder
this amount(for currency-USD)this shareorthis percentage(for rates/percentages)this threshold(for age/counts)
- [Full Program Name]: ALWAYS spell out (Temporary Assistance for Needy Families, NOT TANF)
Copy These Exact Templates
For income limits:
description: [State] limits gross income to this amount under the Temporary Assistance for Needy Families program.
For resource limits:
description: [State] limits resources to this amount under the Temporary Assistance for Needy Families program.
For payment standards:
description: [State] provides this amount as the payment standard under the Temporary Assistance for Needy Families program.
For disregards:
description: [State] excludes this share of earnings from countable income under the Temporary Assistance for Needy Families program.
Description Validation Checklist
Run this check on EVERY description:
# Pseudo-code validation
def validate_description(desc):
checks = [
desc.count('.') == 1, # Exactly one sentence
'TANF' not in desc, # No acronyms
'SNAP' not in desc, # No acronyms
'this amount' in desc or 'this share' in desc or 'this percentage' in desc,
'under the' in desc and 'program' in desc,
'by household size' not in desc, # No explanatory text
'based on' not in desc, # No explanatory text
'for eligibility' not in desc, # Redundant
]
return all(checks)
CRITICAL: Always spell out full program names in descriptions!
3. Values Section
Format Rules
values:
2024-01-01: 3_000 # Use underscores
# NOT: 3000
2024-01-01: 0.2 # Remove trailing zeros
# NOT: 0.20 or 0.200
2024-01-01: 2 # No decimals for integers
# NOT: 2.0 or 2.00
Effective Dates
Use exact dates from sources:
# If source says "effective July 1, 2023"
2023-07-01: value
# If source says "as of October 1"
2024-10-01: value
# NOT arbitrary dates:
2000-01-01: value # Shows no research
Date format: YYYY-MM-01 (always use 01 for day)
4. Metadata Fields (ALL REQUIRED)
unit
Common units:
currency-USD- Dollar amounts/1- Rates, percentages (as decimals)month- Number of monthsyear- Age in yearsbool- True/falseperson- Count of people
period
year- Annual valuesmonth- Monthly valuesday- Daily valueseternity- Never changes
label
Pattern: [State] [PROGRAM] [description]
label: Montana TANF minor child age threshold
label: Illinois TANF earned income disregard rate
label: California SNAP resource limit
Rules:
- Spell out state name
- Abbreviate program (TANF, SNAP)
- No period at end
reference
Requirements:
- At least one source (prefer two)
- Must contain the actual value
- Legal codes need subsections
- PDFs need page anchors
✅ GOOD:
reference:
- title: Idaho Admin Code 16.05.03.205(3)
href: https://adminrules.idaho.gov/rules/current/16/160503.pdf#page=14
- title: Idaho LIHEAP Guidelines, Section 3, page 8
href: https://healthandwelfare.idaho.gov/guidelines.pdf#page=8
❌ BAD:
reference:
- title: Federal LIHEAP regulations # Too generic
href: https://www.acf.hhs.gov/ocs # No specific section
5. Federal/State Separation
Federal Parameters
Location: /parameters/gov/{agency}/{program}/
# parameters/gov/hhs/fpg/first_person.yaml
description: HHS sets this amount as the federal poverty guideline for one person.
State Parameters
Location: /parameters/gov/states/{state}/{agency}/{program}/
# parameters/gov/states/ca/dss/tanf/income_limit/rate.yaml
description: California uses this multiplier of the federal poverty guideline for TANF income eligibility.
6. Common Parameter Patterns
Income Limits (as FPL multiplier)
# income_limit/rate.yaml
description: State uses this multiplier of the federal poverty guideline for program income limits.
values:
2024-01-01: 1.85 # 185% FPL
metadata:
unit: /1
period: year
label: State PROGRAM income limit multiplier
Benefit Amounts
# payment_standard/amount.yaml
description: State provides this amount as the monthly program benefit.
values:
2024-01-01: 500
metadata:
unit: currency-USD
period: month
label: State PROGRAM payment standard amount
Age Thresholds
# age_threshold/minor_child.yaml
description: State defines minor children as under this age for program eligibility.
values:
2024-01-01: 18
metadata:
unit: year
period: eternity
label: State PROGRAM minor child age threshold
Disregard Percentages
# income/disregard/percentage.yaml
description: State excludes this share of earned income from program calculations.
values:
2024-01-01: 0.67 # 67%
metadata:
unit: /1
period: eternity
label: State PROGRAM earned income disregard percentage
7. Validation Checklist
Before creating parameters:
- Studied reference implementations (DC, IL, TX)
- All four metadata fields present
- Description is one complete sentence
- Values use underscore separators
- Trailing zeros removed from decimals
- References include subsections and page numbers
- Label follows naming pattern
- Effective date matches source document
8. Common Mistakes to Avoid
Missing Metadata
❌ WRONG - Missing required fields:
metadata:
unit: currency-USD
label: Benefit amount
# Missing: period, reference
Generic References
❌ WRONG:
reference:
- title: State TANF Manual
href: https://state.gov/tanf
✅ CORRECT:
reference:
- title: State TANF Manual Section 5.2, page 15
href: https://state.gov/tanf-manual.pdf#page=15
Arbitrary Dates
❌ WRONG:
values:
2000-01-01: 500 # Lazy default
✅ CORRECT:
values:
2023-07-01: 500 # From source: "effective July 1, 2023"
Real-World Examples from Production Code
CRITICAL: Study actual parameter files, not just examples!
Before writing ANY parameter:
- Open and READ 3+ similar parameter files from TX/IL/DC
- COPY their exact description pattern
- Replace state name and specific details only
Payment Standards
# Texas (actual production)
description: Texas provides this amount as the payment standard under the Temporary Assistance for Needy Families program.
# Pennsylvania (actual production)
description: Pennsylvania limits TANF benefits to households with resources at or below this amount.
Income Limits
# Indiana (should be)
description: Indiana limits gross income to this amount under the Temporary Assistance for Needy Families program.
# Texas (actual production)
description: Texas limits countable resources to this amount under the Temporary Assistance for Needy Families program.
Disregards
# Indiana (should be)
description: Indiana excludes this share of earnings from countable income under the Temporary Assistance for Needy Families program.
# Texas (actual production)
description: Texas deducts this standard work expense amount from gross earned income for Temporary Assistance for Needy Families program calculations.
Pattern Analysis
- ALWAYS spell out full program name
- Use "under the [Program] program" or "for [Program] program calculations"
- One simple verb (limits, provides, excludes, deducts)
- One "this X" placeholder
- NO extra explanation ("based on X", "This is Y")
Common Description Mistakes to AVOID
❌ WRONG - Using acronyms:
description: Indiana sets this gross income limit for TANF eligibility by household size.
# Problems: "TANF" not spelled out, unnecessary "by household size"
✅ CORRECT:
description: Indiana limits gross income to this amount under the Temporary Assistance for Needy Families program.
❌ WRONG - Adding explanatory text:
description: Indiana provides this payment standard amount based on household size.
# Problem: "based on household size" is unnecessary (evident from breakdown)
✅ CORRECT:
description: Indiana provides this amount as the payment standard under the Temporary Assistance for Needy Families program.
❌ WRONG - Missing program context:
description: Indiana sets the gross income limit.
# Problem: No program name, no "this amount"
✅ CORRECT:
description: Indiana limits gross income to this amount under the Temporary Assistance for Needy Families program.
Authoritative Source Requirements
ONLY use official government sources:
- ✅ State codes and administrative regulations
- ✅ Official state agency websites (.gov domains)
- ✅ Federal regulations (CFR, USC)
- ✅ State plans and official manuals (.gov PDFs)
NEVER use:
- ❌ Third-party guides (singlemotherguide.com, benefits.gov descriptions)
- ❌ Wikipedia
- ❌ Nonprofit summaries (unless no official source exists)
- ❌ News articles
For Agents
When creating parameters:
- READ ACTUAL FILES - Study TX/IL/DC parameter files, not just skill examples
- Include ALL metadata fields - missing any causes errors
- Use exact effective dates from sources
- Follow naming conventions (amount/rate/threshold)
- Write simple descriptions with "this" placeholders and full program names
- Include ONLY official government references with subsections and pages
- Format values properly (underscores, no trailing zeros)