photo electric working

This commit is contained in:
Jun-te Kim 2025-05-08 13:56:45 +00:00
parent 54d11e38de
commit 7da8b1079a
2 changed files with 29 additions and 10 deletions

View file

@ -5,7 +5,7 @@ from etl.transform.preSiteNoteTypes import (
AssessorInfo, CompanyInfo,
PreSiteNotesSummaryInfo, PreSiteNote,
PropertyDescription, Dimension, HeatingType, Heating, HeatingSystemControls,
OtherDetails, WindTurbine
OtherDetails, WindTurbine, PhotovoltaicPanel
)
import uuid
@ -98,10 +98,27 @@ class surveyedDataProcessor():
)
# Other details
otherDetails = self.get_attribute_and_load(self.pre_site_note.property_description, "otherDetails", OtherDetails, db_session)
otherDetails = self.get_attribute_and_load(
self.pre_site_note.property_description,
"otherDetails",
OtherDetails,
db_session
)
# windTurbine
windTurbine = self.get_attribute_and_load(self.pre_site_note.property_description, "windTurbine", WindTurbine, db_session)
windTurbine = self.get_attribute_and_load(
self.pre_site_note.property_description,
"windTurbine",
WindTurbine,
db_session
)
photo_volatic_panel = self.get_attribute_and_load(
self.pre_site_note.property_description,
"photovoltaicPanel",
PhotovoltaicPanel,
db_session,
)
@ -155,11 +172,7 @@ class surveyedDataProcessor():
Returns:
SQLAlchemy model instance.
"""
# Filter out private/internal fields like _sa_instance_state
clean_data = {
k: v for k, v in data_dict.items()
if not k.startswith('_') and hasattr(model_class, k)
}
clean_data = data_dict
# Merge additional fields if provided
if additional_fields:

View file

@ -161,11 +161,11 @@ class ShowerAndBaths(BaseModel):
class FlueGasHeatRecoverySystem(BaseModel):
fghrs_present: bool
class PhotovoltaicPanel(BaseModel):
class PhotovoltaicPanel(BaseModel, table=True):
pvs_are_connected_to_dwelling_electricity_meter: bool
percentage_of_external_roof_area_with_pvs: str
class WindTurbine(BaseModel):
class WindTurbine(BaseModel, table=True):
wind_turbine: bool
class OtherDetails(BaseModel, table=True):
@ -218,6 +218,12 @@ class PropertyDescription(BaseModel):
solarWaterHeating: Optional[SolarWaterHeating]
showerAndBaths: Optional[ShowerAndBaths]
flueGasHeatRecoverySystem: Optional[FlueGasHeatRecoverySystem]
# photovolaticPanel
photo_voltaic_panel_id: Optional[uuid.UUID] = Field(
default=None,
foreign_key='photovoltaicpanel.id'
)
photovoltaicPanel: Optional[PhotovoltaicPanel]
# windTuribe