mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
bed rooms is next
This commit is contained in:
parent
23e97789f1
commit
3ba5622f8e
2 changed files with 156 additions and 14 deletions
|
|
@ -11,7 +11,9 @@ from etl.transform.preSiteNoteTypes import (
|
|||
from etl.transform.conditionReportTypes import (
|
||||
ConditionReport, AssessorDetails, InspectionAndProject, TheProperty,
|
||||
MainElevation, Elevation, ElevationInfo, PropertyAccess, ExternalElevation, ExternalElevationFront,
|
||||
ExternalElevationGableOne, ExternalElevationGableTwo, ExternalElevationRear, ConservatoryOrOutbuilding
|
||||
ExternalElevationGableOne, ExternalElevationGableTwo, ExternalElevationRear, ConservatoryOrOutbuilding,
|
||||
AccessAndElevations, Hallway, RoomInfo, WindowsInfo, VentilationInfo, LivingRoom, DiningRoom, Kitchen,
|
||||
Utility, WC, Landing
|
||||
)
|
||||
from datetime import datetime
|
||||
from pprint import pprint
|
||||
|
|
@ -85,6 +87,7 @@ class ConditionReport(SiteNotesExtractor):
|
|||
def setup(self):
|
||||
self.get_section_1()
|
||||
self.get_section_2()
|
||||
self.get_section_3()
|
||||
self.get_section_0()
|
||||
|
||||
def get_section_0(self):
|
||||
|
|
@ -164,10 +167,18 @@ class ConditionReport(SiteNotesExtractor):
|
|||
)
|
||||
|
||||
def get_section_2(self):
|
||||
_ = self.get_property_access()
|
||||
_,_,_,_ = self.get_external_elevation()
|
||||
self.get_conservatory_or_outbuilding()
|
||||
pa = self.get_property_access()
|
||||
front,one,back, two = self.get_external_elevation()
|
||||
co = self.get_conservatory_or_outbuilding()
|
||||
|
||||
return AccessAndElevations(
|
||||
property_access=pa,
|
||||
external_elevation_front=front,
|
||||
external_elevation_back=back,
|
||||
external_elevation_gable_one=one,
|
||||
external_elevation_gable_two=two,
|
||||
conservatory_or_out_building=co,
|
||||
)
|
||||
|
||||
def get_property_access(self):
|
||||
data = self.get_data_between("2.1 Property Access", "2.2 External Elevations")
|
||||
|
|
@ -187,13 +198,16 @@ class ConditionReport(SiteNotesExtractor):
|
|||
def get_external_elevation(self):
|
||||
# Front
|
||||
data = self.get_data_between("2.2.1. External Elevation - Front", '2.2.2. External Elevation - Gable 1')
|
||||
front = ExternalElevation(
|
||||
ee = ExternalElevation(
|
||||
structural_defects_of_elevation=self.get_next_value(data, "Structural defects of elevation"),
|
||||
does_any_structural_defect_need_resolving_before_retrofit=True if self.get_next_value(data,"Does any structural defect need resolving before retrofit?").lower() == "yes" else False,
|
||||
are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework=True if self.get_next_value(data, "rainwater goods or pipework?").lower() == "yes" else False,
|
||||
are_there_any_visible_signs_of_movement=True if self.get_next_value(data, "Are there any visible signs of movement?").lower() == "yes" else False,
|
||||
are_there_any_visible_signs_of_cracking_to_the_existing_external_finish=True if self.get_next_value(data, "external finish?").lower() == "yes" else False,
|
||||
)
|
||||
front = ExternalElevationFront(
|
||||
external_elevation=ee
|
||||
)
|
||||
# Gable 1
|
||||
data = self.get_data_between("2.2.2. External Elevation - Gable 1", "2.2.3. External Elevation - Rear")
|
||||
state = True if self.get_next_value(data, "cracking)").lower() == "yes" else False
|
||||
|
|
@ -251,9 +265,138 @@ class ConditionReport(SiteNotesExtractor):
|
|||
)
|
||||
|
||||
return front, gable_one, rear, gable_two
|
||||
|
||||
|
||||
def get_conservatory_or_outbuilding(self):
|
||||
data = self.get_data_between("2.3. Conservatory or Outbuilding", "3. Rooms")
|
||||
return ConservatoryOrOutbuilding(
|
||||
is_there_a_conservatory=True if self.get_next_value(data, "Is there a Conservatory?").lower() == "yes" else False,
|
||||
is_there_a_cellar_present=True if self.get_next_value(data, "Is there a cellar present?").lower() == "yes" else False,
|
||||
is_there_an_outbuilding=True if self.get_next_value(data, "Is there an Outbuilding?").lower() == "yes" else False,
|
||||
)
|
||||
|
||||
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()
|
||||
pprint(_)
|
||||
|
||||
def get_room_info(self, data):
|
||||
ventilation = VentilationInfo(
|
||||
is_there_a_ventilation_system_present_in_the_room=True if self.get_next_value(data, "Is there a ventilation system present in the room?").lower() == "yes" else False,
|
||||
are_there_any_visible_or_reported_signs_of_damp_mould_or_excessive_condensation_within_the_room=True if self.get_next_value(data, "excessive condensation within the room?").lower() == "yes" else False,
|
||||
are_there_sufficient_undercuts_on_the_closed_door=self.get_next_value(data, "- min 7.6mm per 1000mm width door)?"),
|
||||
is_there_any_open_flue_heating_appliances_within_the_room=True if self.get_next_value(data, "Is there any open flue heating appliances within the room?").lower() == "yes" else False,
|
||||
)
|
||||
|
||||
windows_state = True if self.get_next_value(data, "Does the room have any windows?").lower() == "yes" else False
|
||||
if windows_state:
|
||||
windows = WindowsInfo(
|
||||
does_the_room_have_any_windows=windows_state,
|
||||
condition_of_the_windows=self.get_next_value(data, "Condition of the windows"),
|
||||
do_the_windows_have_trickle_vents=True if self.get_next_value(data, "Do the windows have trickle vents?").lower() == "yes" else False,
|
||||
input_trickle_vent_product_code_or_measurement=self.get_next_value(data, "in both cases."),
|
||||
are_the_windows_openable=True if self.get_next_value(data, "Are the windows openable?").lower() == "yes" else False,
|
||||
)
|
||||
else:
|
||||
windows = WindowsInfo(
|
||||
does_the_room_have_any_windows=windows_state
|
||||
)
|
||||
|
||||
return RoomInfo(
|
||||
overall_condition_of_the_room=self.get_next_value(data, "Overall condition of the room"),
|
||||
does_the_room_have_any_defects=self.get_next_value(data, "cracking in walls, etc.)"),
|
||||
windows_info=windows,
|
||||
ventilation_info=ventilation,
|
||||
)
|
||||
|
||||
|
||||
def get_hallway(self):
|
||||
data = self.get_data_between("Hallway", "Living Room")
|
||||
room = self.get_room_info(data)
|
||||
|
||||
return Hallway(
|
||||
is_there_a_hallway=True if self.get_next_value(data, "Is there a hallway?").lower() == "yes" else False,
|
||||
room_info=room,
|
||||
)
|
||||
|
||||
def get_living_room(self):
|
||||
data = self.get_data_between("Living Room", "Dining Room")
|
||||
room = self.get_room_info(data)
|
||||
return LivingRoom(
|
||||
room_info=room,
|
||||
)
|
||||
|
||||
def get_dining_room(self):
|
||||
data = self.get_data_between("Dining Room", "Kitchen")
|
||||
dining_room_state = True if self.get_next_value(data, "Is there a dining room?").lower() == "yes" else False
|
||||
if dining_room_state:
|
||||
room = self.get_room_info(data)
|
||||
else:
|
||||
room = None
|
||||
|
||||
return DiningRoom(
|
||||
is_there_a_dining_room=dining_room_state,
|
||||
room_info=room,
|
||||
)
|
||||
|
||||
def get_kitchen(self):
|
||||
data = self.get_data_between("Kitchen", "Utility")
|
||||
room = self.get_room_info(data)
|
||||
|
||||
return Kitchen(
|
||||
room_info=room,
|
||||
is_there_a_cooker_hood_present_in_the_room=True if self.get_next_value(data, "Is there a cooker hood present in the room?").lower() == "yes" else False,
|
||||
)
|
||||
|
||||
def get_utility(self):
|
||||
data = self.get_data_between("Utility", "WC")
|
||||
utility_state = True if self.get_next_value(data, "Is there a utility room?").lower() == "yes" else False
|
||||
|
||||
if utility_state:
|
||||
room = self.get_room_info(data)
|
||||
else:
|
||||
room = None
|
||||
|
||||
return Utility(
|
||||
is_there_a_utility_room=utility_state,
|
||||
room_info=room
|
||||
)
|
||||
|
||||
def get_wc(self):
|
||||
data = self.get_data_between("WC", "Landing")
|
||||
wc_state = True if self.get_next_value(data, "Is there a separated WC?").lower() == "yes" else False
|
||||
|
||||
if wc_state:
|
||||
room = self.get_room_info(data)
|
||||
else:
|
||||
room = None
|
||||
|
||||
return WC(
|
||||
is_there_a_seperated_wc=wc_state,
|
||||
room_info=room
|
||||
)
|
||||
|
||||
def get_landing(self):
|
||||
data = self.get_data_between("Landing", "Bedroom")
|
||||
landing_state = True if self.get_next_value(data, "Is there a landing?").lower() == "yes" else False
|
||||
|
||||
if landing_state:
|
||||
room_info = self.get_room_info(data)
|
||||
else:
|
||||
room_info = None
|
||||
return Landing(
|
||||
is_there_a_landing=landing_state,
|
||||
room_info=room_info
|
||||
)
|
||||
|
||||
def get_bedrooms(self):
|
||||
pass
|
||||
|
||||
|
||||
class QuidosSiteNotesExtractor(SiteNotesExtractor):
|
||||
|
|
|
|||
|
|
@ -92,29 +92,28 @@ class AccessAndElevations(BaseModel):
|
|||
class VentilationInfo(BaseModel):
|
||||
is_there_a_ventilation_system_present_in_the_room: bool
|
||||
are_there_any_visible_or_reported_signs_of_damp_mould_or_excessive_condensation_within_the_room: bool
|
||||
are_there_sufficient_undercuts_on_the_closed_door: bool
|
||||
are_there_sufficient_undercuts_on_the_closed_door: str
|
||||
is_there_any_open_flue_heating_appliances_within_the_room: bool
|
||||
|
||||
class WindowsInfo(BaseModel):
|
||||
does_the_room_have_any_windows: bool
|
||||
condition_of_the_windows: str
|
||||
do_the_windows_have_trickle_vents: bool
|
||||
are_the_windows_openable: bool
|
||||
trickle_vent_measurements: int
|
||||
condition_of_the_windows: Optional[str] = None
|
||||
do_the_windows_have_trickle_vents: Optional[bool] = None
|
||||
are_the_windows_openable: Optional[bool] = None
|
||||
input_trickle_vent_product_code_or_measurement: Optional[str] = None
|
||||
|
||||
class RoomInfo(BaseModel):
|
||||
overall_condition_of_the_room: str
|
||||
does_the_room_have_any_defects: str
|
||||
are_there_any_sloped_ceiling_areas: Optional[bool]
|
||||
windows_info: Optional[WindowsInfo]
|
||||
ventilation_info: Optional[VentilationInfo]
|
||||
are_there_any_sloped_ceiling_areas: Optional[bool] = None
|
||||
windows_info: Optional[WindowsInfo] = None
|
||||
ventilation_info: Optional[VentilationInfo] = None
|
||||
|
||||
class Hallway(BaseModel):
|
||||
is_there_a_hallway: bool
|
||||
room_info: Optional[RoomInfo]
|
||||
|
||||
class LivingRoom(BaseModel):
|
||||
overall_condition_of_the_room: str
|
||||
room_info: Optional[RoomInfo]
|
||||
|
||||
class DiningRoom(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue