mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Ignore block level assets during parsing
This commit is contained in:
parent
80f3325cf0
commit
f8db0cadba
3 changed files with 27 additions and 6 deletions
|
|
@ -33,9 +33,10 @@ class PeabodyParser(Parser):
|
|||
assets: List[PeabodyAssetCondition] = []
|
||||
for row in asset_rows:
|
||||
try:
|
||||
assets.append(
|
||||
PeabodyParser._map_row_to_asset_record(row, asset_header_indexes)
|
||||
)
|
||||
asset = PeabodyParser._map_row_to_asset_record(row, asset_header_indexes)
|
||||
if not asset.is_block_level:
|
||||
assets.append(asset)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error mapping Peabody row to asset record: {e}")
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class PeabodyAssetCondition:
|
|||
|
||||
block_level_patterns = [
|
||||
r"\bBLOCK\b", # "BLOCK MILNE HOUSE"
|
||||
r"\bFLATS\b", # "FLATS A-D ..."
|
||||
r"\bFLATS\b", # "FLATS A-D ..."
|
||||
r"\b\d+[A-Z]?-\d+[A-Z]?\b", # "1-80", "9A-9H"
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,25 @@ def peabody_assets_xlsx_bytes() -> BytesIO:
|
|||
])
|
||||
survey_records_d_and_lower.append([
|
||||
"B000RAND",
|
||||
"1-11 RANDOM HOUSE LONDON",
|
||||
"1 RANDOM HOUSE LONDON",
|
||||
3,
|
||||
"RAND2EST",
|
||||
110,
|
||||
"ROOFS",
|
||||
1,
|
||||
"Primary Roof",
|
||||
9,
|
||||
"Other",
|
||||
3,
|
||||
2054,
|
||||
330,
|
||||
"N",
|
||||
3,
|
||||
datetime(2025,12,4,9,17,0)
|
||||
])
|
||||
survey_records_d_and_lower.append([
|
||||
"B000BLOCK",
|
||||
"1100 BLOCK",
|
||||
3,
|
||||
"RAND2EST",
|
||||
110,
|
||||
|
|
@ -51,7 +69,7 @@ def peabody_assets_xlsx_bytes() -> BytesIO:
|
|||
])
|
||||
survey_records_d_and_lower.append([
|
||||
"B000FAKE",
|
||||
"3-10 FAKE CLOSE LONDON",
|
||||
"3 FAKE CLOSE LONDON",
|
||||
3,
|
||||
"FAKEEST",
|
||||
100,
|
||||
|
|
@ -163,6 +181,8 @@ def test_peabody_asset_is_block_level(
|
|||
full_address,
|
||||
expected_block_level,
|
||||
):
|
||||
# arrange
|
||||
asset_condition = asset_condition_factory(full_address)
|
||||
|
||||
# act + assert
|
||||
assert asset_condition.is_block_level == expected_block_level
|
||||
Loading…
Add table
Reference in a new issue