save work added main heating one and two

This commit is contained in:
Jun-te Kim 2025-06-10 11:35:41 +00:00
parent 27b16dc1c9
commit 899f194d31
2 changed files with 63 additions and 21 deletions

View file

@ -12,8 +12,9 @@ from etl.transform.conditionReportTypes import (
ConditionReport, AssessorDetails, InspectionAndProject, TheProperty,
MainElevation, Elevation, ElevationInfo, PropertyAccess, ExternalElevation, ExternalElevationFront,
ExternalElevationGableOne, ExternalElevationGableTwo, ExternalElevationRear, ConservatoryOrOutbuilding,
AccessAndElevations, Hallway, RoomInfo, WindowsInfo, VentilationInfo, LivingRoom, DiningRoom, Kitchen,
Utility, WC, Landing, Bedroom, Bathroom, LoftSpace, RoomInRoof, HeatingSystem, GeneralConditionHeatingSystem
AccessAndElevations, Hallway, RoomInfo, WindowsInfo, VentilationInfo, LivingRoom, DiningRoom, Kitchen, Rooms,
Utility, WC, Landing, Bedroom, Bathroom, LoftSpace, RoomInRoof, HeatingSystem, GeneralConditionHeatingSystem,
MainHeatingOne, MainHeatingTwo, SecondaryHeating
)
from datetime import datetime
from pprint import pprint
@ -36,6 +37,15 @@ class SiteNotesExtractor():
get_value = lambda key: None if lst[lst.index(value) + 1] in avoid else lst[lst.index(key) + 1]
return get_value(value)
def get_next_value_greedy(self, lst, value, upto):
index = lst.index(value) + 1
str = ""
for i in range(upto):
str += lst[index+i]
str += " "
return str[:-1]
def two_columns_processor(self, data, sub_titles_to_gather, avoid, indexAdd = 1):
def get_value(key):
@ -277,19 +287,31 @@ class ConditionReport(SiteNotesExtractor):
)
def get_section_3(self):
_ = self.get_hallway()
_ = self.get_living_room()
_ = self.get_dining_room()
_ = self.get_kitchen()
_ = self.get_utility()
_ = self.get_wc()
_ = self.get_landing()
_ = self.get_bedrooms()
_ = self.get_bathroom()
_ = self.get_loft_space()
_ = self.get_room_in_roof()
print("Put all this togeter in section 3")
hallway = self.get_hallway()
living_room = self.get_living_room()
dining_room = self.get_dining_room()
kitchen = self.get_kitchen()
utility = self.get_utility()
wc = self.get_wc()
landing = self.get_landing()
bedrooms = self.get_bedrooms()
bathrooms = self.get_bathroom()
loft_space = self.get_loft_space()
room_in_roof = self.get_room_in_roof()
return Rooms(
hallway=hallway,
living_room=living_room,
dining_room=dining_room,
kitchen=kitchen,
utility=utility,
wash_chamber=wc,
landing=landing,
bedrooms=bedrooms,
bathrooms=bathrooms,
loft_space=loft_space,
room_in_roof=room_in_roof,
)
def get_room_info(self, data):
ventilation = VentilationInfo(
@ -457,22 +479,43 @@ class ConditionReport(SiteNotesExtractor):
def get_section_4(self):
_ = self.get_general_condition_of_heating_system()
_ = self.get_main_heating_one()
_ = self.get_main_heating_two()
_ = self.get_secondary_heating()
pprint(_)
def get_main_heating_one(self):
data = self.get_data_between("Main Heating 1", "Main Heating 2")
return MainHeatingOne(
as_defined_by=self.get_next_value(data, "As defined by"),
fuel=self.get_next_value(data, "Fuel:"),
type=self.get_next_value_greedy(data, "Type", 2)
)
def get_main_heating_two(self):
data = self.get_data_between("Main Heating 2", "Secondary Heating")
return MainHeatingTwo(
is_there_a_main_heating_two=True if self.get_next_value(data, "Is there a Main Heating 2?").lower() == "yes" else False,
)
def get_secondary_heating(self):
data = self.get_data_between("Secondary Heating", "Heating by room")
return SecondaryHeating(
is_there_a_secondary_heating=True if self.get_next_value(data, "Is there a Secondary Heating?").lower() == "yes" else False,
fuel=self.get_next_value(data, "Fuel")
)
def get_general_condition_of_heating_system(self):
data = self.get_data_between("4. Heating System", "Main Heating 1")
return GeneralConditionHeatingSystem(
is_the_heating_system_in_working_order=True if self.get_next_value(data, "Is the Heating System in working order?") else False,
does_the_occupant_have_a_smart_meter=True if self.get_next_value(data, "Does the occupant have a Smart Meter?") else False,
are_there_any_smart_monitoring_devices=True if self.get_next_value(data, "Are there any smart monitoring devices (Switchee etc)?") else False,
are_the_gas_and_electricity_meters_accessible=True if self.get_next_value(data, "Are the Gas and Electricity Meters accessible") else False,
dual_or_single_electric_meter=self.get_next_value(data, "Dual or single electric meter"),
are_the_gas_and_electricity_meters_accessible=True if self.get_next_value(data, "Are the Gas and Electricity Meters accessible?") else False,
dual_or_single_electric_meter=self.get_next_value(data, "Dual or single electric meter?"),
)
class QuidosSiteNotesExtractor(SiteNotesExtractor):
def __init__(self, data_list):
super().__init__(data_list)
@ -705,7 +748,6 @@ class QuidosSiteNotesExtractor(SiteNotesExtractor):
no_of_heated_rooms = int(get_value('Number of Heated Habitable Rooms')),
heated_basement = False if get_value('Heated Basement') == "NO" else True,
conservatory_type = get_value('Conservatory Type'),
terrain_type = get_value('Terrain Type'),
percentage_of_draught_proofed= int(get_value('Percentage of Draught Proofed(%)')),
main_property=PropertyDetail(
age_band=age_bands[0],

View file

@ -162,7 +162,7 @@ class Rooms(BaseModel):
wash_chamber: WC
landing: Landing
bedrooms: List[Bedroom]
bathroomos: List[Bathroom]
bathrooms: List[Bathroom]
loft_space: LoftSpace
room_in_roof: RoomInRoof