occupant information

This commit is contained in:
Jun-te Kim 2025-06-30 11:03:51 +00:00
parent 8e16dba6f1
commit f9242b8aaf
2 changed files with 40 additions and 12 deletions

View file

@ -294,4 +294,16 @@ class HeatingSystem(BaseModel, table=True):
heating_by_room: HeatingByRoom = Relationship()
renewables_id: uuid.UUID = Field(foreign_key="renewables.id")
renewables: Renewables = Relationship()
renewables: Renewables = Relationship()
class Occupant(BaseModel, table=True):
name: str
have_evidence_of_12_months_of_fuel_bill_data: bool
total_number_of_occupants: int
no_of_adult_occupants: int
no_of_child_occupants: int
no_of_occupant_of_a_pensionable_age: int
are_there_any_vulnerable_people: bool
is_there_anyone_with_a_disability: bool
status_of_occupant: str
landlord_wrote_that_the_tenent_agrees_assessment_been_supplied: bool

View file

@ -48,7 +48,8 @@ from etl.models.conditionReport import (
SecondaryHeating,
HeatingByRoom,
Renewables,
HeatingSystem
HeatingSystem,
Occupant
)
from etl.models.topLevel import(
@ -84,7 +85,7 @@ class surveyedDataProcessor():
# [x] general_information = self.get_section_1()
# [x] access_and_elevations = self.get_section_2()
# [x] rooms = self.get_section_3()
# [] heating_system = self.get_section_4()
# [x] heating_system = self.get_section_4()
# [] occupant_assessment = self.get_section_5()
# [] site_name, reference_code, address, postcode = self.get_section_0()
@ -107,7 +108,31 @@ class surveyedDataProcessor():
access_and_elevations = self.load_access_and_elevations_from_condition_report(db_session)
rooms = self.load_rooms_from_condition_report(db_session)
heating_system = self.load_heating_system_from_condition_report(db_session)
occupant_assessment = self.load_occupant_info_from_condition_report(db_session)
def load_occupant_info_from_condition_report(self, db_session):
"""
occupant: Occupant
energy_use: EnergyUse
heating: HeatingFromConditionReport
shower_and_bath: ShowerAndBath
appliances: Optional[Appliances]
fridge_and_freezers: FridgeAndFreezers
cooker: Cooker
tumble_dryer: TumbleDryer
"""
self.load_occupant_information_from_condition_report(db_session)
def load_occupant_information_from_condition_report(self, db_session):
return self.get_attribute_and_load(
self.condition_report.master_obj.occupancy_assessment,
"occupant",
Occupant,
db_session,
additional_fields={
"landlord_wrote_that_the_tenent_agrees_assessment_been_supplied":self.condition_report.master_obj.occupancy_assessment.occupant.landlord_has_written_confirmation_that_the_tenent_agrees_to_the_assessment_been_supplied
}
)
def load_heating_system_from_condition_report(self, db_session):
general_condition = self.load_general_condition_of_heating_system_from_condition_report(db_session)
@ -117,15 +142,6 @@ class surveyedDataProcessor():
heating_by_room = self.load_heating_by_room_from_condition_report(db_session)
renwables = self.load_renewables_from_condition_report(db_session)
print("hello junte")
print(general_condition.id)
print(main_heating_one.id)
print(main_heating_two.id)
print(secondary_heating.id)
print(heating_by_room.id)
print(renwables.id)
print("goodbye junte")
return self.get_attribute_and_load(
self.condition_report.master_obj,
"heating_system",