mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Detect block-level asset conditions 🟩
This commit is contained in:
parent
187d7fbadd
commit
80f3325cf0
1 changed files with 14 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import re
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
@ -23,4 +25,15 @@ class PeabodyAssetCondition:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_block_level(self) -> bool:
|
def is_block_level(self) -> bool:
|
||||||
raise NotImplementedError
|
if not self.full_address:
|
||||||
|
return False
|
||||||
|
|
||||||
|
address = self.full_address.upper()
|
||||||
|
|
||||||
|
block_level_patterns = [
|
||||||
|
r"\bBLOCK\b", # "BLOCK MILNE HOUSE"
|
||||||
|
r"\bFLATS\b", # "FLATS A-D ..."
|
||||||
|
r"\b\d+[A-Z]?-\d+[A-Z]?\b", # "1-80", "9A-9H"
|
||||||
|
]
|
||||||
|
|
||||||
|
return any(re.search(pattern, address) for pattern in block_level_patterns)
|
||||||
Loading…
Add table
Reference in a new issue