mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
add TODO to is_block_level
This commit is contained in:
parent
b33b69dbce
commit
8cdbe107e5
1 changed files with 9 additions and 6 deletions
|
|
@ -4,6 +4,7 @@ from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class PeabodyAssetCondition:
|
class PeabodyAssetCondition:
|
||||||
lo_reference: str
|
lo_reference: str
|
||||||
|
|
@ -25,17 +26,19 @@ class PeabodyAssetCondition:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_block_level(self) -> bool:
|
def is_block_level(self) -> bool:
|
||||||
|
# TODO: maybe use block codes from other Peabody dataset to do this instead
|
||||||
|
|
||||||
if not self.full_address:
|
if not self.full_address:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
address = self.full_address.upper()
|
address = self.full_address.upper()
|
||||||
|
|
||||||
block_level_patterns = [
|
block_level_patterns = [
|
||||||
r"\bBLOCK\b", # BLOCK MILNE HOUSE
|
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
|
r"\b\d+[A-Z]?-\d+[A-Z]?\b", # 1-80, 9A-9H
|
||||||
r"\b\d+[A-Z]-[A-Z]\b", # 81A-B
|
r"\b\d+[A-Z]-[A-Z]\b", # 81A-B
|
||||||
r"\b\d+\s*&\s*\d+\b", # 73 & 74
|
r"\b\d+\s*&\s*\d+\b", # 73 & 74
|
||||||
]
|
]
|
||||||
|
|
||||||
return any(re.search(pattern, address) for pattern in block_level_patterns)
|
return any(re.search(pattern, address) for pattern in block_level_patterns)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue