#!/usr/bin/env python3 """Seed appeals (cases) from legacy vault metadata.""" import asyncio import json import sys from datetime import date from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent / "mcp-server" / "src")) from legal_mcp.services.db import get_pool, init_schema, close_pool APPEALS = [ # ── Active (01_Projects) ── { "case_number": "1130/25", "title": "ערר קרית יערים-1 — קובר", "appellants": ["מרק קובר", "יצחק מטמון"], "respondents": ["הוועדה המרחבית הראל", "ליבמן"], "subject": "ערר על אישור תכנית להוספת קומה וזכויות בנייה", "property_address": "רח' אבינדב 23, קריית יערים", "status": "in_progress", "expected_outcome": "partial", }, { "case_number": "1194/25+1199/25", "title": "ערר קרית יערים-2 — מטמון/קובר", "appellants": ["יצחק מטמון", "מרק קובר"], "respondents": ["הוועדה המקומית"], "subject": "תוספת קומה + הגדלת זכויות בנייה", "property_address": "חלקה 240, גוש 29536, רח' אבינדב", "status": "new", "expected_outcome": "", }, { "case_number": "8027-25", "title": "ערר היטל השבחה תחכמוני 20", "appellants": ["עובדיה", "מירב", "ווינשטיין ואח'"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "היטל השבחה", "property_address": "רח' תחכמוני, ירושלים, גוש 30069, חלקה 156", "status": "new", "expected_outcome": "", }, # ── Archived — completed decisions ── { "case_number": "1180-1181", "title": "ערר הכט", "appellants": [], "respondents": [], "subject": "רישוי ובנייה", "property_address": "", "status": "final", "expected_outcome": "rejected", "notes": "פורסם 05.02.2026. דחייה. שימש כמודל לניתוח סגנון.", }, { "case_number": "1126/25+1141/25", "title": "תמ\"א 38/2 בית הכרם", "appellants": ["מרכז קהילתי זיו-מרקס", "12 תושבים"], "respondents": ["הוועדה המקומית", "יזם"], "subject": "תמ\"א 38/2 הריסה ובנייה מחדש", "property_address": "רח' החלוץ 36, בית הכרם, גוש 30159/6", "status": "final", "expected_outcome": "partial", "notes": "גרסה סופית טיוטה 9, מרץ 2026. קבלה חלקית. שימש כמודל לניתוח סגנון.", }, { "case_number": "8255-25", "title": "בל\"מ אפרים אבי", "appellants": ["אפרים אברהם"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "היטל השבחה — בקשה להארכת מועד", "property_address": "רח' הורקניה 4, קטמונים, ירושלים", "status": "final", "expected_outcome": "rejected", "notes": "גרסה סופית מאושרת. דחייה.", }, # ── Archived — unified decisions ── { "case_number": "8107-25", "title": "אבו זאהריה", "appellants": ["אבו זאהריה מפיד"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "ערר על החלטת שמאי מכריע — היטל השבחה", "property_address": "רח' אום כולתום 26, בית חנינא, גוש 30615, חלקה 69", "status": "final", "expected_outcome": "", "notes": "החלטה מאחדת: ערר גפני.", }, { "case_number": "9005-24", "title": "רמת שלמה — פיצויים ס' 197", "appellants": ["קירמאיר אסתר ואח' (63-67 עוררים)"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "פיצויים לפי סעיף 197", "property_address": "רמת שלמה, ירושלים, גוש 30561, חלקות 36, 40", "status": "final", "expected_outcome": "", "notes": "החלטה מאחדת: ערר ורדי 9003-23.", }, # ── Archived — in progress ── { "case_number": "1113/25", "title": "אייל מבורך לוי ואברהם עדי", "appellants": ["אייל מבורך לוי", "אברהם עדי"], "respondents": ["הוועדה המקומית הראל"], "subject": "הרחבת דירות + תוספת 2 יח\"ד", "property_address": "רח' השלום 63, מבשרת ציון, גוש 30475, חלקה 5", "status": "in_progress", "expected_outcome": "", }, { "case_number": "1128/25", "title": "שטרית", "appellants": [], "respondents": [], "subject": "", "property_address": "", "status": "drafted", "expected_outcome": "", }, { "case_number": "1107/06/25", "title": "בלוי נ' הוועדה המקומית", "appellants": ["בלוי מאיר", "מזיע מאיר", "דזימיטרובסקי הדסה"], "respondents": ["הוועדה המקומית ירושלים", "היזם"], "subject": "תוספת בנייה וחיזוק מפני רעידות (תמ\"א 38/1)", "property_address": "רח' הרב בלוי 16, ירושלים, גוש 30099/115", "status": "in_progress", "expected_outcome": "", }, { "case_number": "8141-23", "title": "אזורים בנין", "appellants": ["אזורים בנין (1965) בע\"מ"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "היטל השבחה — תכנית 101-0611905", "property_address": "רח' הנביאים 27, ירושלים", "status": "drafted", "expected_outcome": "", }, { "case_number": "8047-24", "title": "משכן אליהו — היטל השבחה שמאי מכריע", "appellants": ["עומר דרוויש"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "ערר על שמאית מכריעה — היטל השבחה", "property_address": "גוש 30614, חלקה 89, בית חנינא", "status": "in_progress", "expected_outcome": "", }, { "case_number": "1195-25", "title": "וליד ג'מל", "appellants": ["וליד ג'מל"], "respondents": ["ועדת משנה מטה יהודה", "סמיר מוסא זעאתרה"], "subject": "הסדרת קומה שלישית למשרדים", "property_address": "גוש 30492, חלקה 23, כפר עין נקובא", "status": "in_progress", "expected_outcome": "", }, { "case_number": "1200/25", "title": "קרית ענבים נופש", "appellants": ["קרית ענבים נופש בע\"מ"], "respondents": ["הוועדה המקומית מטה יהודה", "חברי קיבוץ קרית ענבים"], "subject": "שימוש חורג — סופרמרקט בייעוד ספורט ונופש", "property_address": "קיבוץ קרית ענבים, גוש 29551", "status": "in_progress", "expected_outcome": "", }, { "case_number": "1184/25", "title": "שטוקהיים — בית נקופה", "appellants": ["אמנון שטוקהיים", "אילנית שטוקהיים"], "respondents": ["הוועדה המקומית מטה יהודה", "יערה טל"], "subject": "אישור בקשה להיתר עם הקלות", "property_address": "מגרש 51, גוש 31399, חלקה 52, בית נקופה", "status": "in_progress", "expected_outcome": "", }, { "case_number": "8070-25", "title": "היטל השבחה — דירת גג", "appellants": ["חיים ראם"], "respondents": ["הוועדה המקומית ירושלים"], "subject": "היטל השבחה — הקלה להשלמת דירת גג", "property_address": "רח' צ.פ. חיות 2, דירה 31, נווה יעקב", "status": "in_progress", "expected_outcome": "", }, { "case_number": "8136-24", "title": "ערר השבחה — מרפסות שירות", "appellants": [], "respondents": [], "subject": "היטל השבחה — מרפסות שירות", "property_address": "", "status": "in_progress", "expected_outcome": "", }, { "case_number": "8007-24", "title": "עומר דרוויש — שומה מכרעת", "appellants": [], "respondents": [], "subject": "היטל השבחה", "property_address": "", "status": "in_progress", "expected_outcome": "", }, ] async def main(): await init_schema() pool = await get_pool() inserted = 0 skipped = 0 async with pool.acquire() as conn: for a in APPEALS: existing = await conn.fetchval( "SELECT id FROM cases WHERE case_number = $1", a["case_number"] ) if existing: skipped += 1 continue await conn.execute( """INSERT INTO cases (case_number, title, appellants, respondents, subject, property_address, status, expected_outcome, notes) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)""", a["case_number"], a["title"], json.dumps(a.get("appellants", [])), json.dumps(a.get("respondents", [])), a.get("subject", ""), a.get("property_address", ""), a.get("status", "new"), a.get("expected_outcome", ""), a.get("notes", ""), ) inserted += 1 await close_pool() print(f"✓ appeals: {inserted} inserted, {skipped} skipped (already exist)") if __name__ == "__main__": asyncio.run(main())