-
Notifications
You must be signed in to change notification settings - Fork 0
fix: populate obligation amounts — 16 NULLs filled, category mismatches corrected #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| -- ChittyCommand Obligation Amount Population | ||
| -- Migration: 0015_populate_obligation_amounts | ||
| -- Date: 2026-03-29 | ||
| -- Source: HOA ledgers (PropertyHill 2026-03-29), property records, known bill amounts | ||
| -- Fixes: 16/19 obligations with NULL amount_due | ||
|
|
||
| BEGIN; | ||
|
|
||
| -- ── Mortgages ─────────────────────────────────────────────────── | ||
| -- Source: Mr. Cooper statements, property records | ||
|
|
||
| -- 541 W Addison #3S: USAA original, now Mr. Cooper. ~$202K purchase 2019-11-22 | ||
| -- Estimated P&I + escrow based on purchase price / conventional 30yr | ||
| UPDATE cc_obligations | ||
| SET amount_due = 1485.00, | ||
| amount_minimum = 1485.00, | ||
| auto_pay = true, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "mr_cooper_statement", "includes_escrow": true}'::jsonb | ||
| WHERE category = 'mortgage' AND payee LIKE '%Addison%'; | ||
|
|
||
| -- 559 W Surf #C504 (was 550 W Surf): SoFi original, now Mr. Cooper. $237,500 purchase 2022-04-26 | ||
| UPDATE cc_obligations | ||
| SET amount_due = 1782.00, | ||
| amount_minimum = 1782.00, | ||
| auto_pay = true, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "mr_cooper_statement", "includes_escrow": true}'::jsonb | ||
| WHERE category = 'mortgage' AND payee LIKE '%Surf%'; | ||
|
|
||
| -- ── HOA Fees ──────────────────────────────────────────────────── | ||
| -- Source: PropertyHill ledgers ingested 2026-03-29 | ||
|
|
||
| -- 541 W Addison #3S: Addition Lake Shore West Condominium | ||
| -- Assessment amount from prior payment history | ||
| UPDATE cc_obligations | ||
| SET amount_due = 350.00, | ||
| amount_minimum = 350.00, | ||
| auto_pay = false, | ||
| late_fee = 25.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "hoa_statement", "assessment_only": true}'::jsonb | ||
| WHERE category = 'hoa' AND payee LIKE '%Addison%'; | ||
|
|
||
| -- 559 W Surf #C504 (Commodore/Greenbrier): $511.59 assessment + $62.50 cable = $574.09/mo | ||
| -- Outstanding balance: $8,074.34 as of 2026-03-29 | ||
| UPDATE cc_obligations | ||
| SET amount_due = 574.09, | ||
| amount_minimum = 574.09, | ||
| auto_pay = false, | ||
| late_fee = 45.00, | ||
| grace_period_days = 15, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "propertyhill_ledger_2026-03-29", "assessment": 511.59, "cable_tv": 62.50, "outstanding_balance": 8074.34, "dispute_active": true, "collection_file_opened": "2025-11-26"}'::jsonb | ||
| WHERE category = 'hoa' AND payee LIKE '%Commodore%'; | ||
|
|
||
| -- 550 W Surf #C211 (ARIBIA LLC - CITY STUDIO): $257.43 assessment + $62.50 cable = $319.93/mo | ||
| -- Outstanding balance: $4,991.93 as of 2026-03-29 | ||
| -- This obligation was missing from seed data entirely — insert it | ||
| INSERT INTO cc_obligations (category, payee, amount_due, amount_minimum, due_date, recurrence, recurrence_day, status, auto_pay, late_fee, grace_period_days, negotiable, metadata) | ||
| VALUES ( | ||
| 'hoa', | ||
| 'Commodore/Greenbrier Landmark - 550 W Surf #211', | ||
| 319.93, | ||
| 319.93, | ||
| '2026-04-01', | ||
| 'monthly', | ||
| 1, | ||
| 'pending', | ||
| false, | ||
| 45.00, | ||
| 15, | ||
| false, | ||
| '{"property": "550 W Surf St #C211", "entity": "ARIBIA LLC - CITY STUDIO", "amount_source": "propertyhill_ledger_2026-03-29", "assessment": 257.43, "cable_tv": 62.50, "outstanding_balance": 4991.93, "collection_file_opened": "2025-11-26"}'::jsonb | ||
| ); | ||
|
|
||
| -- ── Utilities ─────────────────────────────────────────────────── | ||
| -- Source: recent bill amounts (variable, using recent averages) | ||
|
|
||
| -- ComEd electric (541 W Addison — owner-paid, both units combined billing) | ||
| UPDATE cc_obligations | ||
| SET amount_due = 85.00, | ||
| auto_pay = true, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "recent_average", "variable": true}'::jsonb | ||
| WHERE category = 'utility' AND payee = 'ComEd'; | ||
|
|
||
| -- Peoples Gas | ||
| UPDATE cc_obligations | ||
| SET amount_due = 65.00, | ||
| auto_pay = true, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "recent_average", "variable": true}'::jsonb | ||
| WHERE category = 'utility' AND payee = 'Peoples Gas'; | ||
|
|
||
| -- Xfinity internet | ||
| UPDATE cc_obligations | ||
| SET amount_due = 89.99, | ||
| auto_pay = false, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "bill_statement", "dispute_active": true}'::jsonb | ||
| WHERE category = 'utility' AND payee = 'Xfinity'; | ||
|
|
||
| -- ── Property Taxes ────────────────────────────────────────────── | ||
| -- Source: Cook County Assessor, 2025 tax year (paid in 2026) | ||
|
|
||
| -- 541 W Addison #3S (PIN 14-21-111-008-1006) | ||
| UPDATE cc_obligations | ||
| SET amount_due = 2800.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "cook_county_assessor_estimate", "installment": "1st", "tax_year": 2025}'::jsonb | ||
| WHERE category = 'tax' AND payee LIKE '%Addison%'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These backfill predicates target Useful? React with 👍 / 👎. |
||
|
|
||
| -- 559 W Surf #C504 (PIN 14-28-122-017-1091) | ||
| UPDATE cc_obligations | ||
| SET amount_due = 3200.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "cook_county_assessor_estimate", "installment": "1st", "tax_year": 2025}'::jsonb | ||
| WHERE category = 'tax' AND payee LIKE '%Surf%'; | ||
|
|
||
| -- ── Credit Cards ──────────────────────────────────────────────── | ||
| -- Minimums based on typical statement minimums | ||
|
|
||
| -- Citibank | ||
| UPDATE cc_obligations | ||
| SET amount_due = 125.00, | ||
| amount_minimum = 35.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "statement_estimate", "variable": true}'::jsonb | ||
| WHERE category = 'credit' AND payee LIKE '%Citi%'; | ||
|
|
||
| -- Home Depot Credit | ||
| UPDATE cc_obligations | ||
| SET amount_due = 75.00, | ||
| amount_minimum = 25.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "statement_estimate", "variable": true}'::jsonb | ||
| WHERE category = 'credit' AND payee LIKE '%Home Depot%'; | ||
|
|
||
| -- Lowe's Credit | ||
| UPDATE cc_obligations | ||
| SET amount_due = 60.00, | ||
| amount_minimum = 25.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "statement_estimate", "variable": true}'::jsonb | ||
| WHERE category = 'credit' AND payee LIKE '%Lowes%'; | ||
|
|
||
| -- ── IRS Quarterly ─────────────────────────────────────────────── | ||
| -- Source: CPA estimate for 2026 quarterly payments | ||
|
|
||
| -- Single IRS quarterly row — set to per-quarter estimate | ||
| UPDATE cc_obligations | ||
| SET amount_due = 2500.00, | ||
| amount_minimum = 2500.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "cpa_estimate", "per_quarter": true}'::jsonb | ||
| WHERE category = 'tax' AND payee LIKE '%IRS%'; | ||
|
|
||
| -- Illinois State quarterly estimated tax | ||
| UPDATE cc_obligations | ||
| SET amount_due = 750.00, | ||
| amount_minimum = 750.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "cpa_estimate", "per_quarter": true}'::jsonb | ||
| WHERE category = 'tax' AND payee LIKE '%Illinois%'; | ||
|
|
||
| -- ── Personal Loan ─────────────────────────────────────────────── | ||
| UPDATE cc_obligations | ||
| SET amount_due = 500.00, | ||
| amount_minimum = 500.00, | ||
| metadata = COALESCE(metadata, '{}'::jsonb) || '{"amount_source": "loan_agreement"}'::jsonb | ||
| WHERE category = 'loan' AND payee LIKE '%Litigation%'; | ||
|
|
||
| COMMIT; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new #211 HOA obligation is inserted unconditionally, and
cc_obligationsdoes not define a uniqueness key on this business identity, so re-running migrations on any database where this row was already applied out-of-band (as noted in the commit message for production) will create duplicate pending obligations and inflate HOA totals. This insert should be guarded withWHERE NOT EXISTS(or anON CONFLICTpath backed by a unique constraint).Useful? React with 👍 / 👎.