mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
small tidies
This commit is contained in:
parent
03fb727994
commit
fa72d16239
6 changed files with 10 additions and 10 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from typing import Any, List, Optional
|
||||
|
||||
from backend.condition.domain.asset_condition import AssetCondition
|
||||
from backend.condition.domain.lbwf_element import LbwfElement
|
||||
from backend.condition.domain.mapping.mapper import Mapper
|
||||
from backend.condition.parsing.records.peabody.peabody_asset_condition import (
|
||||
PeabodyAssetCondition,
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
from backend.condition.domain.mapping.lbwf_mapper import LbwfMapper
|
||||
from backend.condition.domain.mapping.lbwf.lbwf_mapper import LbwfMapper
|
||||
from backend.condition.domain.mapping.mapper import Mapper
|
||||
from backend.condition.file_type import FileType
|
||||
from backend.condition.parsing.parser import Parser
|
||||
from backend.condition.parsing.lbwf_parser import LbwfParser
|
||||
from backend.condition.parsing.peabody_parser import PeabodyParser
|
||||
|
||||
|
||||
def select_parser(file_type: FileType) -> Parser:
|
||||
if file_type is FileType.LBWF:
|
||||
return LbwfParser()
|
||||
|
||||
|
||||
if file_type is FileType.Peabody:
|
||||
return PeabodyParser()
|
||||
|
||||
raise ValueError("Unrecognised file type, unable to instantiate Parser")
|
||||
|
||||
|
||||
def select_mapper(file_type: FileType) -> Mapper:
|
||||
if file_type is FileType.LBWF:
|
||||
return LbwfMapper()
|
||||
|
||||
|
||||
raise ValueError("Unrecognised file type, unable to instantiate Mapper")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from utils.logger import setup_logger
|
|||
from backend.condition.file_type import FileType, detect_file_type
|
||||
from backend.condition.parsing.factory import select_parser, select_mapper
|
||||
|
||||
|
||||
def process_file(file_stream: BinaryIO, source_key: str) -> None:
|
||||
print(f"[processor] Received file: {source_key}")
|
||||
|
||||
|
|
@ -19,10 +20,10 @@ def process_file(file_stream: BinaryIO, source_key: str) -> None:
|
|||
# Orchestration
|
||||
raw_properties: List[Any] = parser.parse(file_stream)
|
||||
|
||||
survey_year = datetime.now().year # TODO: get this from filepath or elsewhere
|
||||
survey_year = datetime.now().year # TODO: get this from filepath or elsewhere
|
||||
|
||||
assets: List[AssetCondition] = []
|
||||
for p in raw_properties:
|
||||
assets.extend(mapper.map_asset_conditions_for_property(p, survey_year))
|
||||
|
||||
print(assets) # temp
|
||||
print(assets) # temp
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@ from datetime import date
|
|||
|
||||
from backend.condition.domain.aspect_type import AspectType
|
||||
from backend.condition.domain.element import Element
|
||||
from backend.condition.domain.mapping.lbwf_mapper import LbwfMapper
|
||||
from backend.condition.domain.mapping.lbwf.lbwf_mapper import LbwfMapper
|
||||
from backend.condition.parsing.records.lbwf.lbwf_house import LbwfHouse
|
||||
from backend.condition.parsing.records.lbwf.lbwf_asset_condition import (
|
||||
LbwfAssetCondition,
|
||||
)
|
||||
from backend.condition.domain.lbwf_element import LbwfElement
|
||||
from backend.condition.domain.asset_condition import AssetCondition
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
from backend.condition.domain.mapping.peabody_mapper import PeabodyMapper
|
||||
from backend.condition.domain.lbwf_element import LbwfElement
|
||||
from backend.condition.domain.mapping.peabody.peabody_mapper import PeabodyMapper
|
||||
from backend.condition.parsing.records.peabody.peabody_asset_condition import (
|
||||
PeabodyAssetCondition,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue