From aba11aee9517f24ceac21365f85481773011ba3f Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Sat, 3 Jun 2023 10:41:51 +0000 Subject: [PATCH] code: add building exception if same as hse no --- surplus.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/surplus.py b/surplus.py index b72c684..d56bdb6 100644 --- a/surplus.py +++ b/surplus.py @@ -204,10 +204,18 @@ def surplus( # location["address"].get("leisure"), # location["address"].get("shop"), # location["address"].get("railway"), - location["address"].get("building"), + ( + location["address"].get("building") + if ( + location["address"].get("building") + != location["address"].get("house_number") + ) + else None + ), location["address"].get("highway"), ( location["address"].get("house_number", "") + + (" " + location["address"].get("house_name", "")).strip() + " " + location["address"].get("road", "") + ( @@ -219,7 +227,16 @@ def surplus( else "" ) ).strip(), - location["address"].get("neighbourhood", ""), + ( + ",".join( + [ + location["address"].get(detail, "") + for detail in ( + "residential, neighbourhood, allotments, quarter" + ).split(", ") + ] + ) + ).strip(","), location["address"].get("postcode"), location["address"].get("country"), ]