-
Notifications
You must be signed in to change notification settings - Fork 0
fix: correct property PINs, addresses, and add missing properties #54
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
base: main
Are you sure you want to change the base?
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,109 @@ | ||||||||||||||||||||||||||||||||||||||||||
| -- ChittyCommand Property Data Corrections | ||||||||||||||||||||||||||||||||||||||||||
| -- Migration: 0014_fix_properties | ||||||||||||||||||||||||||||||||||||||||||
| -- Date: 2026-03-24 | ||||||||||||||||||||||||||||||||||||||||||
| -- Fixes wrong PINs, wrong addresses, and wrong properties from 0004/0007. | ||||||||||||||||||||||||||||||||||||||||||
| -- Authoritative source: project_entity_property_structure.md | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| BEGIN; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- ── Fix PINs for existing properties ────────────────────────── | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Addison: wrong PIN 14-21-307-032-1006 → correct 14-21-111-008-1006 | ||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_properties SET tax_pin = '14-21-111-008-1006' | ||||||||||||||||||||||||||||||||||||||||||
| WHERE address = '541 W Addison St' AND unit = '#3S'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Surf 504: wrong PIN 14-28-200-011-1042 → correct 14-28-122-017-1091 | ||||||||||||||||||||||||||||||||||||||||||
| -- Also fix address: 550 → 559 W Surf St per deed | ||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_properties | ||||||||||||||||||||||||||||||||||||||||||
| SET tax_pin = '14-28-122-017-1091', | ||||||||||||||||||||||||||||||||||||||||||
| address = '559 W Surf St', | ||||||||||||||||||||||||||||||||||||||||||
| unit = '#C504', | ||||||||||||||||||||||||||||||||||||||||||
| property_name = '559 W Surf St #C504', | ||||||||||||||||||||||||||||||||||||||||||
| hoa_payee = 'Commodore/Greenbrier Landmark Condo Association', | ||||||||||||||||||||||||||||||||||||||||||
| metadata = metadata || '{"pin": "14-28-122-017-1091", "condo_declaration": "26911238"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE address = '550 W Surf St' AND unit = '#504'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Backfill Addison metadata | ||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_properties | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = metadata || '{"pin": "14-21-111-008-1006", "condo_declaration": "25024798", "condo_association": "Addition Lake Shore West Condominium"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE address = '541 W Addison St' AND unit = '#3S'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- ── Remove wrong properties from 0007 ──────────────────────── | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- "211 E Surf St, Park Forest" was wrong — Surf 211 is actually 550 W Surf St #C211 | ||||||||||||||||||||||||||||||||||||||||||
| DELETE FROM cc_properties WHERE tax_pin = '31-25-301-019-0000'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- "Clarendon Hills" was wrong — should be 4343 N Clarendon Ave #1610 | ||||||||||||||||||||||||||||||||||||||||||
| DELETE FROM cc_properties WHERE tax_pin = '09-12-307-023-0000'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- ── Insert correct properties ───────────────────────────────── | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Surf 211: 550 W Surf St #C211 (Commodore/Greenbriar Landmark) | ||||||||||||||||||||||||||||||||||||||||||
| INSERT INTO cc_properties (property_name, address, unit, tax_pin, property_type, hoa_payee, metadata) | ||||||||||||||||||||||||||||||||||||||||||
| VALUES ( | ||||||||||||||||||||||||||||||||||||||||||
| 'Surf 211', | ||||||||||||||||||||||||||||||||||||||||||
| '550 W Surf St', | ||||||||||||||||||||||||||||||||||||||||||
| '#C211', | ||||||||||||||||||||||||||||||||||||||||||
| '14-28-122-017-1180', | ||||||||||||||||||||||||||||||||||||||||||
| 'condo', | ||||||||||||||||||||||||||||||||||||||||||
| 'Commodore/Greenbriar Landmark Condo Association', | ||||||||||||||||||||||||||||||||||||||||||
| '{"purchase_price": 100000, "purchase_date": "2022-07-01", "pin": "14-28-122-017-1180", "condo_declaration": "26911238", "owner_entity": "ARIBIA LLC - CITY STUDIO"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| ON CONFLICT (tax_pin) DO NOTHING; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Clarendon: 4343 N Clarendon Ave #1610 | ||||||||||||||||||||||||||||||||||||||||||
| INSERT INTO cc_properties (property_name, address, unit, tax_pin, property_type, metadata) | ||||||||||||||||||||||||||||||||||||||||||
| VALUES ( | ||||||||||||||||||||||||||||||||||||||||||
| 'Clarendon', | ||||||||||||||||||||||||||||||||||||||||||
| '4343 N Clarendon Ave', | ||||||||||||||||||||||||||||||||||||||||||
| '#1610', | ||||||||||||||||||||||||||||||||||||||||||
| '14-16-300-032-1238', | ||||||||||||||||||||||||||||||||||||||||||
| 'condo', | ||||||||||||||||||||||||||||||||||||||||||
| '{"pin": "14-16-300-032-1238", "owner_entity": "ARIBIA LLC - APT ARLENE"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| ON CONFLICT (tax_pin) DO NOTHING; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Medellín: International property held by ARIBIA LLC | ||||||||||||||||||||||||||||||||||||||||||
| INSERT INTO cc_properties (property_name, address, unit, property_type, metadata) | ||||||||||||||||||||||||||||||||||||||||||
| VALUES ( | ||||||||||||||||||||||||||||||||||||||||||
| 'Medellín', | ||||||||||||||||||||||||||||||||||||||||||
| 'Urbanización Plaza De Colores, Carrera 76, Medellín, Colombia', | ||||||||||||||||||||||||||||||||||||||||||
| 'Apt 53 (215 Int. 1112)', | ||||||||||||||||||||||||||||||||||||||||||
| 'international', | ||||||||||||||||||||||||||||||||||||||||||
| '{"country": "Colombia", "city": "Medellín", "apartment": "215 Int. 1112", "parking": "215 Int. 0226", "owner_entity": "ARIBIA LLC"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+74
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. Non-idempotent INSERT may create duplicates on re-run. Unlike the other property inserts, this Consider one of these approaches: Option 1: Add a guard with NOT EXISTS -- Medellín: International property held by ARIBIA LLC
-INSERT INTO cc_properties (property_name, address, unit, property_type, metadata)
-VALUES (
+INSERT INTO cc_properties (property_name, address, unit, property_type, metadata)
+SELECT
'Medellín',
'Urbanización Plaza De Colores, Carrera 76, Medellín, Colombia',
'Apt 53 (215 Int. 1112)',
'international',
'{"country": "Colombia", "city": "Medellín", "apartment": "215 Int. 1112", "parking": "215 Int. 0226", "owner_entity": "ARIBIA LLC"}'::jsonb
-);
+WHERE NOT EXISTS (
+ SELECT 1 FROM cc_properties WHERE property_name = 'Medellín'
+);Option 2: Add a unique constraint on property_name (if appropriate for the schema)-- If property_name should be unique, add constraint first
ALTER TABLE cc_properties ADD CONSTRAINT uq_cc_properties_property_name UNIQUE (property_name);
-- Then use ON CONFLICT
INSERT INTO cc_properties (...)
VALUES (...)
ON CONFLICT (property_name) DO NOTHING;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- ── Fix mortgage account metadata ───────────────────────────── | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- Update the Surf mortgage account to reflect correct address | ||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_accounts | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = '{"property": "559 W Surf St #C504"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE source = 'mr_cooper' AND account_name = '550 W Surf Mortgage'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| -- ── Fix obligation metadata ─────────────────────────────────── | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = metadata || '{"pin": "14-21-111-008-1006"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'mortgage' AND payee ILIKE '%Addison%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = '{"property": "559 W Surf St #C504", "pin": "14-28-122-017-1091"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'mortgage' AND payee ILIKE '%Surf%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = metadata || '{"pin": "14-21-111-008-1006"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'hoa' AND payee ILIKE '%Addison%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = metadata || '{"property": "559 W Surf St #C504", "pin": "14-28-122-017-1091"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'hoa' AND payee ILIKE '%Commodore%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = metadata || '{"pin": "14-21-111-008-1006"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'property_tax' AND payee ILIKE '%Addison%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| UPDATE cc_obligations | ||||||||||||||||||||||||||||||||||||||||||
| SET metadata = '{"property": "559 W Surf St #C504", "pin": "14-28-122-017-1091", "installments": "June + September"}'::jsonb | ||||||||||||||||||||||||||||||||||||||||||
| WHERE category = 'property_tax' AND payee ILIKE '%Surf%'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| 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.
HOA payee name spelling inconsistency.
Line 49 uses
'Commodore/Greenbriar Landmark Condo Association'(with "ia") but line 22 uses'Commodore/Greenbrier Landmark Condo Association'(with "ie"). This inconsistency could cause data quality issues and confusion when querying or displaying HOA information.Suggested fix: Align spelling (verify correct spelling first)
📝 Committable suggestion
🤖 Prompt for AI Agents