Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .claude/agents/parameter-architect.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,40 @@ values:
```yaml
description: [Active voice sentence describing what this parameter does]
metadata:
label: [Short display name - REQUIRED, always include]
unit: [currency-USD | /1 | month | year | bool]
period: [year | month | day | eternity]
reference:
- title: [Specific document name and section]
- title: [Specific document name and section/subsection]
href: [Direct URL to source]
publication_date: [YYYY-MM-DD]
label: [Short display name]
values:
[date]: [value]
```

### Description and Label Standards

**Description (REQUIRED):**
- Must exist and describe what the parameter does
- RECOMMENDED: Use active voice for clarity
- RECOMMENDED: End with a period

**Examples:**
- ✅ "Montana allocates itemized deductions to each spouse at this rate when filing separately."
- ✅ "Montana caps the federal income tax deduction to this amount, based on filing status."
- ⚠️ "Rate at which itemized deductions are allocated" (passive voice, but still acceptable)

**Label (RECOMMENDED):**
- Should be included in metadata for better UI/documentation
- Be concise (2-6 words) and descriptive
- Missing label won't break functionality but reduces discoverability

**Reference (REQUIRED):**
- MUST have at least one reference with title and href
- RECOMMENDED: Cite specific statute subsections (§ 15-30-2131(2) vs § 15-30-2131)
- RECOMMENDED: Include document section/page numbers when available
- RECOMMENDED: Prefer official statutory citations over secondary sources

### Unit Types
- `currency-USD`: Dollar amounts
- `/1`: Ratios, percentages, factors
Expand Down
19 changes: 18 additions & 1 deletion .claude/agents/reference-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,24 @@ class variable_name(Variable):
reference = "Specific regulation citation (e.g., 42 USC 601, 7 CFR 273.9)"
```

### 2. Reference-Value Corroboration
### 2. Reference-Value Corroboration (CRITICAL)

**⚠️ THE REFERENCE MUST ACTUALLY CORROBORATE THE VALUE ⚠️**

This is the most critical validation. A reference that doesn't support the value is worse than no reference.

**MANDATORY CHECKS:**
1. **Fetch the referenced document** (if accessible via WebFetch)
2. **Read the cited section/subsection**
3. **Verify it explicitly states the value** (not just related content)
4. **Flag if subsection citation is wrong** even if general section is correct

**Example of what went wrong:**
- Parameter value: 0.5 (spouse allocation rate)
- Citation: "Montana Code § 15-30-2131(2)"
- Actual statute § 15-30-2131(2): About day-care home deductions (WRONG SUBSECTION!)
- Correct subsection: § 15-30-2131(1)(c)(vi)(D): "deduction...must be divided equally"
- **This MUST be flagged as non-corroborating even though the statute number is related**

**The reference must explicitly support the value:**

Expand Down
2 changes: 1 addition & 1 deletion .github/update_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def main():
# First, find the current package version number from the pyproject.toml file
with open("pyproject.toml", "rb") as f:
data = tomllib.load(f)
version = data["project"]["version"] # Would give us "1.358.0"
version = data["project"]["version"]
# Then, clone the https://github.com/policyengine/policyengine-api repo using the GitHub CLI
pat = os.environ["GITHUB_TOKEN"]
os.system(
Expand Down
6 changes: 6 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- bump: patch
changes:
changed:
- Parameterized Montana spouse allocation factor for itemized deductions (was hardcoded 0.5)
removed:
- Unhelpful comment from .github/update_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: Montana divides itemized deductions equally between spouses when married filing separately on the same form.
values:
2022-01-01: 0.5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need 2021 start date to not break 2021 runs

metadata:
label: Montana itemized deductions spouse allocation rate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add period

unit: /1
reference:
- title: Montana Form 2 Instructions - Itemized deductions divided equally for MFS on same form
href: https://revenue.mt.gov/publications/montana-form-2-individual-income-tax-return-forms-and-instructions-includes-form-2ec
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment stating that it is not an actual policy parameter

Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ class mt_itemized_deductions_indiv(Variable):
defined_for = StateCode.MT

def formula(person, period, parameters):
p = parameters(period).gov.irs.deductions
p = parameters(period).gov.states.mt.tax.income.deductions.itemized
# Since we only compute the federal charitable deduction at the tax unit level,
# we will split the value between each spouse
charitable_deduction = (
person.tax_unit("charitable_deduction", period) * 0.5
person.tax_unit("charitable_deduction", period)
* p.spouse_allocation_rate
)
head_or_spouse = person("is_tax_unit_head_or_spouse", period)
# The interest deduction is the sum of mortagage and investment interest expenses
Expand Down