mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Parse Houses sheet as well 🟥
This commit is contained in:
parent
13daa62bdf
commit
dce8442fff
4 changed files with 23 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ from openpyxl import Workbook, load_workbook
|
|||
from datetime import date
|
||||
|
||||
from backend.condition.parsing.parser import Parser
|
||||
from backend.condition.parsing.records.lbwf_asset_condition import LbwfAssetCondition
|
||||
from backend.condition.parsing.records.lbwf.lbwf_asset_condition import LbwfAssetCondition
|
||||
from backend.condition.utils.date_utils import normalise_date
|
||||
from utils.logger import setup_logger
|
||||
|
||||
|
|
|
|||
15
backend/condition/parsing/records/lbwf/lbwf_house.py
Normal file
15
backend/condition/parsing/records/lbwf/lbwf_house.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
from backend.condition.parsing.records.lbwf.lbwf_asset_condition import LbwfAssetCondition
|
||||
|
||||
@dataclass
|
||||
class LbwfHouse:
|
||||
uprn: int
|
||||
reference: int
|
||||
address: str
|
||||
epc: str # TODO: make enum
|
||||
shdf: bool
|
||||
house: str
|
||||
fail_decency: int
|
||||
assets: List[LbwfAssetCondition]
|
||||
|
|
@ -5,7 +5,7 @@ from openpyxl import Workbook
|
|||
from datetime import datetime
|
||||
|
||||
from backend.condition.parsing.lbwf_parser import LbwfParser
|
||||
from backend.condition.parsing.records.lbwf_asset_condition import LbwfAssetCondition
|
||||
from backend.condition.parsing.records.lbwf.lbwf_house import LbwfHouse
|
||||
|
||||
@pytest.fixture
|
||||
def lbwf_homes_xlsx_bytes() -> BytesIO:
|
||||
|
|
@ -77,6 +77,11 @@ def lbwf_homes_xlsx_bytes() -> BytesIO:
|
|||
"Source of Data = Joe Bloggs",
|
||||
])
|
||||
|
||||
houses = wb.create_sheet("Houses")
|
||||
houses.append(["Reference", "Address", "EPC", "SHDF", "HOSUE", "Fail Decency"])
|
||||
houses.append([12345, "123 Fake Street, London, A10 1AB", "E", "NO", "HOUSE", 2025])
|
||||
houses.append([54321, "100 Random Road, London, A10 1AB", "F", "NO", "HOUSE", 2025])
|
||||
|
||||
all_energy_breakdown = wb.create_sheet("All Energy Breakdown ") # Trailing space is intentional; matches source
|
||||
all_energy_breakdown.append([
|
||||
"UPRN",
|
||||
|
|
@ -116,6 +121,6 @@ def test_lbwf_parser_passes_houses(lbwf_homes_xlsx_bytes):
|
|||
# assert
|
||||
# TODO: Improve these asserts
|
||||
assert len(result) == 2
|
||||
assert isinstance(result[0], LbwfAssetCondition)
|
||||
assert isinstance(result[0], LbwfHouse)
|
||||
assert result[0].uprn == 1
|
||||
assert result[1].uprn == 2
|
||||
Loading…
Add table
Reference in a new issue