You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/technical-patterns/policyengine-parameter-patterns-skill/SKILL.md
+117-4Lines changed: 117 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,10 +31,20 @@ metadata:
31
31
## 1. File Naming Conventions
32
32
33
33
### Study Reference Implementations First
34
-
Before naming, examine:
35
-
- DC TANF: `/parameters/gov/states/dc/dhs/tanf/`
36
-
- IL TANF: `/parameters/gov/states/il/dhs/tanf/`
37
-
- TX TANF: `/parameters/gov/states/tx/hhs/tanf/`
34
+
**Before creating ANY parameter files, read 3-5 files from a similar program in another state.** Match their structure — don't invent your own. This is the single most effective way to produce correct parameter files.
35
+
36
+
Search broadly by program concept (not just program name):
37
+
```bash
38
+
# For a childcare program, search by concept keywords:
-**TANF**: DC, IL, TX — `/parameters/gov/states/{st}/{agency}/tanf/`
46
+
-**Childcare**: MA CCFA, CO CCAP — `/parameters/gov/states/{st}/{agency}/ccfa/` or `ccap/`
47
+
-**LIHEAP**: AZ — `/parameters/gov/states/az/{agency}/liheap/`
38
48
39
49
### Naming Patterns
40
50
@@ -101,6 +111,18 @@ description: [State] provides this amount as the payment standard under the Temp
101
111
description: [State] excludes this share of earnings from countable income under the Temporary Assistance for Needy Families program.
102
112
```
103
113
114
+
### Keep Descriptions Practical
115
+
116
+
Descriptions should focus on what matters for simulation, not copy regulatory language verbatim. Omit regulatory details that have no practical impact:
117
+
118
+
```yaml
119
+
# ❌ Too literal — no one simulates a 1-week-old:
120
+
description: Rhode Island defines the infant/toddler age range as 1 week up to 3 years under the Child Care Assistance Program.
121
+
122
+
# ✅ Practical:
123
+
description: Rhode Island defines the infant/toddler age range as up to 3 years under the Child Care Assistance Program.
124
+
```
125
+
104
126
### Description Validation Checklist
105
127
106
128
Run this check on EVERY description:
@@ -192,6 +214,17 @@ label: California SNAP resource limit
192
214
2. Must contain the actual value
193
215
3. **Title: Include FULL section path** (all subsections and sub-subsections)
194
216
4. **PDF links: Add `#page=XX` at end of href ONLY** (never in title)
217
+
5. **Verify page numbers** — open the PDF and confirm the page number is correct before using it
218
+
219
+
**Reference Source Hierarchy — prefer online over PDF:**
220
+
1. **Online statute/regulation** (best): Cornell LII, state legislature sites, public.law
2. **Official government HTML page**: `.gov`pages with section anchors
223
+
3. **PDF with verified page number** (last resort): Only when no online HTML version exists
224
+
- Rate schedules, policy manuals without HTML versions
225
+
- Always verify the `#page=XX` is correct
226
+
227
+
Why: Online references are linkable, searchable, and don't require page number verification. PDF page numbers are error-prone (file page vs printed page) and links break when documents are updated.
195
228
196
229
**Title Format - Include ALL subsection levels (NO page numbers):**
197
230
```yaml
@@ -514,6 +547,12 @@ brackets:
514
547
2024-01-01: 0.07
515
548
```
516
549
550
+
**BOUNDARY CHECK — do this for every bracket parameter:**
551
+
1. Read the regulation's exact wording for each threshold
552
+
2. If it says "above X" or "more than X" → shift by 0.0001
553
+
3. If it says "at or above X" or "X or more" → no shift needed
554
+
4. Apply consistently to ALL thresholds in the bracket
555
+
517
556
**When to apply the 0.0001 shift:**
518
557
- Regulation says "above X%" or "more than X%" (exclusive of the boundary)
519
558
- Apply consistently to ALL thresholds in the bracket, not just the first
@@ -522,6 +561,80 @@ brackets:
522
561
- Regulation says "at or above X%" or "X% or more" (inclusive — matches PolicyEngine's default)
**When a rate table has multiple dimensions (e.g., age group × star rating × authorization level), use Enum breakdowns in a small number of parameter files — NOT one file per combination.**
**When dimensions differ by category** (e.g., licensed centers have 4 age groups, family care has 3):
621
+
- Use separate Enum variables per category (`ri_ccap_center_age_group`, `ri_ccap_family_age_group`)
622
+
- Each rate file references the appropriate Enum in its breakdown
623
+
- The variable uses `select()` on the top-level category (provider type) — each branch uses its own Enums
624
+
625
+
**When quality ratings differ** (e.g., star ratings 1-5 for licensed, step ratings 1-4 for exempt):
626
+
- Use separate Enum variables (`ri_ccap_star_rating`, `ri_ccap_step_rating`)
627
+
- Each rate file references the appropriate Enum
628
+
629
+
**Rule of thumb:** If you need helper functions in the variable to do the rate lookup, your parameter structure is too granular. Restructure the parameters.
-**Thresholds with no practical simulation impact** — A minimum age of "1 week" for childcare has no simulation value. No one models newborns. Skip it.
636
+
-**Values derivable from existing parameters** — If FPL tables already exist, don't recreate them as program-specific parameters.
**When a parameter changes structure over time** (e.g., a flat rate becomes a tiered/marginal rate in a later year), you CANNOT put both structures in a single YAML file. Instead, split into separate files with a boolean toggle.
Copy file name to clipboardExpand all lines: skills/technical-patterns/policyengine-variable-patterns-skill/SKILL.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -810,6 +810,51 @@ Before creating any enum variable, check:
810
810
2. Does an existing input variable provide the numeric value? (Grep the codebase)
811
811
3. If yes to both → use a bracket parameter + formula, not a bare input
812
812
813
+
### Rate Table Dimensions: One Enum Variable Per Dimension
814
+
815
+
**When a rate table has multiple dimensions (provider type, age group, star rating, authorization level), create a separate Enum variable for each dimension.** This enables simple Enum bracket indexing in the rate lookup variable.
**When dimensions differ by category, use separate Enums:**
830
+
- Licensed centers have 4 age groups (Infant, Toddler, Preschool, School Age)
831
+
- Family child care has 3 age groups (Infant/Toddler, Preschool, School Age)
832
+
- → Create `ri_ccap_center_age_group` and `ri_ccap_family_age_group`
833
+
834
+
**When quality ratings differ by provider type:**
835
+
- Licensed centers/family use star ratings (1-5)
836
+
- License-exempt uses step ratings (1-4)
837
+
- → Create `ri_ccap_star_rating` and `ri_ccap_step_rating` as separate Enums
838
+
839
+
**Use Enum (not int) for constrained categories:**
840
+
```python
841
+
# ❌ BAD — star rating as int (what values are valid? unclear)
842
+
classri_ccap_star_rating(Variable):
843
+
value_type =int
844
+
845
+
# ✅ GOOD — star rating as Enum (self-documenting, validated)
846
+
classRICCAPStarRating(Enum):
847
+
STAR_1="1 Star"
848
+
STAR_2="2 Stars"
849
+
STAR_3="3 Stars"
850
+
STAR_4="4 Stars"
851
+
STAR_5="5 Stars"
852
+
```
853
+
854
+
**If you need helper functions in a rate lookup, your parameter structure is too granular.** Restructure the parameter files to use Enum breakdowns (see parameter-patterns skill) so the variable is just `select()` + indexing.
855
+
856
+
**Reference implementation:** MA CCFA reimbursement — `ma_ccfa_center_based_early_education_reimbursement.py` is 3 lines: get region, get age category, index into parameter.
0 commit comments