From ab59e13936d45f8f96cc7350b30d1eadf7104db3 Mon Sep 17 00:00:00 2001 From: Nitzan P <9297302+nitzpo@users.noreply.github.com> Date: Tue, 25 Nov 2025 09:20:14 +0200 Subject: [PATCH] Fix: Same-building detection using correct API field names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same-building detection was failing because the code was accessing deal.street_name and deal.house_number (Pydantic model field names), but the Govmap API actually returns streetNameHeb/streetNameEng and houseNum as extra fields. Modified address construction to check multiple field names using getattr() to handle the API's actual field names, falling back to model field names if needed. This fix ensures same-building deals are correctly identified and prioritized with priority=0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- nadlan_mcp/govmap/client.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nadlan_mcp/govmap/client.py b/nadlan_mcp/govmap/client.py index d088952..f719fbe 100644 --- a/nadlan_mcp/govmap/client.py +++ b/nadlan_mcp/govmap/client.py @@ -718,9 +718,17 @@ class GovmapClient: deal.distance_meters = round(deal_distance, 1) # Check if this is from the same building - # Construct address from model fields - street = deal.street_name or "" - house_num = str(deal.house_number or "") + # Construct address from model fields (try multiple field names) + # API returns streetNameHeb/streetNameEng and houseNum + street = ( + getattr(deal, "streetNameHeb", None) + or getattr(deal, "streetNameEng", None) + or deal.street_name + or "" + ) + house_num = str( + getattr(deal, "houseNum", None) or deal.house_number or "" + ) deal_address = f"{street} {house_num}".lower().strip() if self._is_same_building(search_address_normalized, deal_address): deal.deal_source = "same_building"