Merge pull request #1039 from Hestia-Homes/feature/epc-property-data-to-db

EPC property data to db
This commit is contained in:
Daniel Roth 2026-04-28 16:50:44 +01:00 committed by GitHub
commit 0069fc3b7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1964 additions and 42 deletions

View file

@ -18,8 +18,8 @@ class EpcPropertyModel(SQLModel, table=True):
__tablename__ = "epc_property"
id: Optional[int] = Field(default=None, primary_key=True)
property_id: int = Field(foreign_key="property.id", nullable=False)
portfolio_id: int = Field(foreign_key="portfolio.id", nullable=False)
property_id: Optional[int] = Field(default=None)
portfolio_id: Optional[int] = Field(default=None)
# Identity / admin
uprn: Optional[int] = Field(default=None)
@ -148,8 +148,8 @@ class EpcPropertyModel(SQLModel, table=True):
def from_epc_property_data(
cls,
data: EpcPropertyData,
property_id: int,
portfolio_id: int,
property_id: Optional[int] = None,
portfolio_id: Optional[int] = None,
) -> EpcPropertyModel:
es = data.sap_energy_source
h = data.sap_heating
@ -593,7 +593,7 @@ class EpcWindowModel(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
epc_property_id: int = Field(foreign_key="epc_property.id", nullable=False)
pvc_frame: str
frame_material: Optional[str] = Field(default=None)
glazing_gap: str
orientation: str
window_type: str
@ -607,7 +607,7 @@ class EpcWindowModel(SQLModel, table=True):
frame_factor: Optional[float] = Field(default=None)
permanent_shutters_insulated: Optional[str] = Field(default=None)
transmission_u_value: Optional[float] = Field(default=None)
transmission_data_source: Optional[int] = Field(default=None)
transmission_data_source: Optional[str] = Field(default=None)
transmission_solar_transmittance: Optional[float] = Field(default=None)
@classmethod
@ -615,7 +615,7 @@ class EpcWindowModel(SQLModel, table=True):
td = window.window_transmission_details
return cls(
epc_property_id=epc_property_id,
pvc_frame=str(window.pvc_frame),
frame_material=window.frame_material,
glazing_gap=str(window.glazing_gap),
orientation=str(window.orientation),
window_type=str(window.window_type),

View file

@ -0,0 +1,451 @@
import re
from datetime import date, datetime
from typing import List, Optional
from datatypes.epc.surveys.elmhurst_site_notes import (
BathsAndShowers,
BuildingPartDimensions,
ElmhurstSiteNotes,
FloorDetails,
FloorDimension,
Lighting,
MainHeating,
Meters,
PropertyDetails,
Renewables,
RoofDetails,
Shower,
SurveyorInfo,
VentilationAndCooling,
WallDetails,
WaterHeating,
Window,
)
class ElmhurstSiteNotesExtractor:
def __init__(self, pages: List[str]) -> None:
self._text = "\n".join(pages)
self._lines = [l.strip() for l in self._text.splitlines() if l.strip()]
# --- generic helpers ---
def _next_val(self, label: str) -> Optional[str]:
lc = label.rstrip(":") + ":"
lb = label.rstrip(":")
for i, line in enumerate(self._lines):
if line.startswith(lc) and len(line) > len(lc):
return line[len(lc):].strip() or None
if line == lc or line == lb:
for j in range(i + 1, min(i + 4, len(self._lines))):
v = self._lines[j]
if v.endswith(":") or v.startswith("©"):
return None
if v:
return v
return None
return None
def _str_val(self, label: str) -> str:
v = self._next_val(label)
return " ".join(v.split()) if v else ""
def _opt_str(self, label: str) -> Optional[str]:
v = self._next_val(label)
return " ".join(v.split()) if v else None
def _bool_val(self, label: str) -> bool:
v = self._next_val(label)
return v is not None and v.lower() == "yes"
def _int_val(self, label: str) -> int:
v = self._next_val(label)
try:
return int(v.split()[0]) if v else 0
except (ValueError, IndexError):
return 0
def _date_val(self, label: str) -> date:
v = self._next_val(label)
if not v:
raise ValueError(f"Missing date for label: {label}")
return datetime.strptime(v.strip(), "%d/%m/%Y").date()
def _between(self, start: str, end: str) -> str:
try:
s = self._text.index(start) + len(start)
e = self._text.index(end, s)
return self._text[s:e]
except ValueError:
return ""
def _section_lines(self, start: str, end: str) -> List[str]:
text = self._between(start, end)
return [l.strip() for l in text.splitlines() if l.strip()]
def _local_val(self, lines: List[str], label: str) -> Optional[str]:
lb = label.rstrip(":")
lc = lb + ":"
for i, line in enumerate(lines):
if line.startswith(lc) and len(line) > len(lc):
return line[len(lc):].strip() or None
if line == lc or line == lb:
for j in range(i + 1, min(i + 4, len(lines))):
v = lines[j]
if v.endswith(":") or v.startswith("©"):
return None
if v:
return v
return None
return None
def _local_str(self, lines: List[str], label: str) -> str:
v = self._local_val(lines, label)
return " ".join(v.split()) if v else ""
def _local_bool(self, lines: List[str], label: str) -> bool:
v = self._local_val(lines, label)
return v is not None and v.lower() == "yes"
# --- section extractors ---
def _extract_surveyor_info(self) -> SurveyorInfo:
return SurveyorInfo(
surveyor_code=self._str_val("Surveyor"),
name=self._str_val("Name"),
title=self._str_val("Title"),
tel_number=self._str_val("Tel Number"),
survey_reference=self._str_val("Survey Reference"),
my_reference=self._opt_str("My Reference"),
)
def _extract_property_details(self) -> PropertyDetails:
epc_m = re.search(
r"Check for the existence of\nan EPC:\n(Yes|No)", self._text
)
epc_exists = epc_m.group(1).lower() == "yes" if epc_m else False
return PropertyDetails(
rdsap_version=self._str_val("RdSAP version"),
reference_number=self._str_val("Reference Number"),
lodgement_required=self._bool_val("Lodgement Required"),
regs_region=self._str_val("Regs Region"),
epc_language=self._str_val("EPC Language"),
postcode=self._str_val("Postcode"),
region=self._str_val("Region"),
street=self._str_val("Street"),
town=self._str_val("Town"),
tenure=self._str_val("Property Tenure"),
transaction_type=self._str_val("Transaction Type"),
inspection_date=self._date_val("Inspection Date"),
process_date=self._date_val("Process date"),
epc_exists=epc_exists,
uprn=self._opt_str("UPRN"),
house_name=self._opt_str("House Name"),
house_number=self._opt_str("House No"),
locality=self._opt_str("Locality"),
county=self._opt_str("County"),
)
def _extract_attachment(self) -> str:
m = re.search(r"1\.0 Property type:\n[^\n]+\n([^\n]+)", self._text)
return " ".join(m.group(1).strip().split()) if m else ""
def _extract_dimensions(self) -> BuildingPartDimensions:
dim_type = self._str_val("Dimension type")
section = self._between("4.0 Dimensions:", "5.0 Conservatory:")
floor_matches = re.findall(
r"([A-Za-z ]+Floor):\n([\d.]+)\n([\d.]+)\n([\d.]+)\n([\d.]+)",
section,
)
floors = [
FloorDimension(
name=name.strip(),
area_m2=float(area),
room_height_m=float(height),
heat_loss_perimeter_m=float(hlp),
party_wall_length_m=float(pwl),
)
for name, area, height, hlp, pwl in floor_matches
]
return BuildingPartDimensions(dimension_type=dim_type, floors=floors)
def _extract_walls(self) -> WallDetails:
lines = self._section_lines("7.0 Walls:", "8.0 Roofs:")
thickness_raw = self._local_val(lines, "Wall Thickness")
thickness_mm = (
int(thickness_raw.split()[0]) if thickness_raw else None
)
return WallDetails(
wall_type=self._local_str(lines, "Type"),
insulation=self._local_str(lines, "Insulation"),
thickness_unknown=self._local_bool(lines, "Wall Thickness Unknown"),
u_value_known=self._local_bool(lines, "U-value Known"),
party_wall_type=self._local_str(lines, "Party Wall Type"),
thickness_mm=thickness_mm,
)
def _extract_roof(self) -> RoofDetails:
lines = self._section_lines("8.0 Roofs:", "8.1 Rooms in Roof:")
thickness_raw = self._local_val(lines, "Insulation Thickness")
thickness_mm = (
int(thickness_raw.split()[0]) if thickness_raw else None
)
return RoofDetails(
roof_type=self._local_str(lines, "Type"),
insulation=self._local_str(lines, "Insulation"),
u_value_known=self._local_bool(lines, "U-value Known"),
insulation_thickness_mm=thickness_mm,
)
def _extract_floor(self) -> FloorDetails:
lines = self._section_lines("9.0 Floors:", "10.0 Doors:")
u_val_raw = self._local_val(lines, "Default U-value")
default_u = float(u_val_raw) if u_val_raw else None
return FloorDetails(
location=self._local_str(lines, "Location"),
floor_type=self._local_str(lines, "Type"),
insulation=self._local_str(lines, "Insulation"),
u_value_known=self._local_bool(lines, "U-value Known"),
default_u_value=default_u,
)
def _extract_windows(self) -> List[Window]:
m = re.search(
r"Permanent\s+Shutters\n(.*?)Draught Proofing",
self._text,
re.DOTALL,
)
if not m:
return []
tokens = [t.strip() for t in m.group(1).splitlines() if t.strip()]
windows: List[Window] = []
i = 0
while i + 12 < len(tokens):
try:
width_m = float(tokens[i])
height_m = float(tokens[i + 1])
area_m2 = float(tokens[i + 2])
except (ValueError, IndexError):
i += 1
continue
i += 3
# Collect glazing type tokens until frame_factor (0 < v ≤ 1.0)
glazing_parts: List[str] = []
while i < len(tokens):
try:
v = float(tokens[i])
if 0.0 < v <= 1.0:
break
glazing_parts.append(tokens[i])
except ValueError:
glazing_parts.append(tokens[i])
i += 1
# If last glazing token is a single word (no spaces, not numeric) it's the frame_type
frame_type: Optional[str] = None
if glazing_parts and " " not in glazing_parts[-1] and not glazing_parts[-1].replace(".", "").isdigit():
frame_type = glazing_parts.pop()
glazing_type = " ".join(glazing_parts).strip()
if i >= len(tokens):
break
frame_factor = float(tokens[i]); i += 1
# Consume glazing_gap if present ("mm" token, possibly multi-token e.g. "16 mm or more")
glazing_gap: Optional[str] = None
if i < len(tokens) and "mm" in tokens[i]:
gap_parts = [tokens[i]]; i += 1
while i < len(tokens) and tokens[i].lower() in {"or", "more"}:
gap_parts.append(tokens[i]); i += 1
glazing_gap = " ".join(gap_parts)
building_part = tokens[i]; i += 1
location = tokens[i]; i += 1
orientation = tokens[i]; i += 1
data_source = tokens[i]; i += 1
u_value = float(tokens[i]); i += 1
g_value = float(tokens[i]); i += 1
draught_proofed = tokens[i].lower() == "yes"; i += 1
permanent_shutters = tokens[i]; i += 1
windows.append(
Window(
width_m=width_m,
height_m=height_m,
area_m2=area_m2,
glazing_type=glazing_type,
frame_factor=frame_factor,
building_part=building_part,
location=location,
orientation=orientation,
data_source=data_source,
u_value=u_value,
g_value=g_value,
draught_proofed=draught_proofed,
permanent_shutters=permanent_shutters,
frame_type=frame_type,
glazing_gap=glazing_gap,
)
)
return windows
def _extract_ventilation(self) -> VentilationAndCooling:
return VentilationAndCooling(
open_chimneys_count=self._int_val("No. of open chimneys"),
open_flues_count=self._int_val("No. of open flues"),
open_chimneys_closed_fire_count=self._int_val(
"No. of open chimneys/open flues attached to closed fire"
),
solid_fuel_boiler_flues_count=self._int_val(
"No. of flues attached to solid fuel boiler"
),
other_heater_flues_count=self._int_val(
"No. of open flues attached to other heater"
),
blocked_chimneys_count=self._int_val("No. of blocked chimneys"),
extract_fans_count=self._int_val("No. of intermittent extract fans"),
passive_vents_count=self._int_val("No. of passive vents"),
flueless_gas_fires_count=self._int_val("No. of flueless gas fires"),
fixed_space_cooling=self._bool_val("Fixed Space Cooling"),
draught_lobby=self._str_val("Draught Lobby"),
mechanical_ventilation=self._bool_val("Mechanical Ventilation"),
pressure_test_method=self._str_val("Test Method"),
)
def _extract_lighting(self) -> Lighting:
led_cfl_count_known = self._bool_val("Number of LED and CFL Known")
return Lighting(
total_bulbs=self._int_val("Total number of bulbs"),
led_cfl_count_known=led_cfl_count_known,
led_count=self._int_val("Number of LED lights"),
cfl_count=self._int_val("Number of CFL lights"),
incandescent_count=self._int_val("Total number of incandescents"),
low_energy_count=(
0 if led_cfl_count_known
else self._int_val("Total number of Low Energy")
),
)
def _extract_main_heating(self) -> MainHeating:
lines = self._section_lines("14.0 Main Heating1", "14.1 Main Heating2")
pct_raw = self._local_val(lines, "Percentage of Heat")
pct = int(pct_raw.split()[0]) if pct_raw else 0
return MainHeating(
heat_emitter=self._local_str(lines, "Heat Emitter"),
fuel_type=self._local_str(lines, "Fuel Type"),
flue_type=self._local_str(lines, "Flue Type"),
fan_assisted_flue=self._local_bool(lines, "Fan Assisted Flue"),
design_flow_temperature=self._local_str(lines, "Design flow temperature"),
heating_controls_ees=self._local_str(lines, "Main Heating Controls EES"),
heating_controls_sap=self._local_str(lines, "Main Heating Controls Sap"),
percentage_of_heat=pct,
pcdf_boiler_reference=self._local_val(lines, "PCDF boiler Reference"),
heat_pump_age=self._local_val(lines, "Heat pump age"),
)
def _extract_meters(self) -> Meters:
return Meters(
electricity_meter_type=self._str_val("Electricity meter type"),
main_gas=self._bool_val("Main gas"),
electricity_smart_meter=self._bool_val("Electricity Smart Meter Present"),
gas_smart_meter=self._bool_val("Gas Smart Meter Present"),
)
def _extract_water_heating(self) -> WaterHeating:
return WaterHeating(
water_heating_code=self._str_val("Water Heating Code"),
water_heating_sap_code=self._int_val("Water Heating SapCode"),
water_heating_fuel_type=self._str_val("Water Heating Fuel Type"),
hot_water_cylinder_present=self._bool_val("Hot Water Cylinder Present"),
)
def _extract_baths_and_showers(self) -> BathsAndShowers:
n_baths = self._int_val("Total Number of Baths")
n_connected = self._int_val("Number of Baths Connected")
try:
idx = self._lines.index("Connected")
except ValueError:
return BathsAndShowers(
number_of_baths=n_baths,
number_of_baths_connected=n_connected,
showers=[],
)
showers: List[Shower] = []
j = idx + 1
while j + 2 <= len(self._lines) - 1:
num_line = self._lines[j]
if not num_line.isdigit():
break
showers.append(
Shower(
shower_number=int(num_line),
outlet_type=self._lines[j + 1],
connected=self._lines[j + 2],
)
)
j += 3
return BathsAndShowers(
number_of_baths=n_baths,
number_of_baths_connected=n_connected,
showers=showers,
)
def _rating_val(self, label: str) -> int:
v = self._next_val(label)
try:
return int(v.split()[-1]) if v else 0
except (ValueError, IndexError):
return 0
def _extract_renewables(self) -> Renewables:
fghrs_lines = self._section_lines(
"18.0 Flue Gas Heat Recovery System", "19.0 Photovoltaic Panel"
)
fghrs = self._local_bool(fghrs_lines, "Present")
terrain = self._str_val("Terrain Type")
hydro_raw = self._next_val("Electricity generated [kWh/year]")
hydro = float(hydro_raw) if hydro_raw else 0.0
return Renewables(
solar_water_heating=self._bool_val("Solar Water Heating"),
wwhrs_present=self._bool_val("Is WWHRS present in the property?"),
flue_gas_heat_recovery_present=fghrs,
photovoltaic_panel=self._str_val("Photovoltaic Panel"),
export_capable_meter=self._bool_val("Export capable meter"),
wind_turbine_present=self._bool_val("Wind turbine present?"),
wind_turbines_terrain_type=terrain,
hydro_electricity_generated_kwh=hydro,
)
def extract(self) -> ElmhurstSiteNotes:
emissions_raw = self._next_val("Emissions (t/year)")
co2 = float(emissions_raw.split()[0]) if emissions_raw else 0.0
return ElmhurstSiteNotes(
surveyor_info=self._extract_surveyor_info(),
property_details=self._extract_property_details(),
current_sap_rating=self._rating_val("Current SAP rating"),
potential_sap_rating=self._rating_val("Potential SAP rating"),
current_ei_rating=self._rating_val("Current EI rating"),
potential_ei_rating=self._rating_val("Potential EI rating"),
co2_emissions_current_t=co2,
property_type=self._str_val("1.0 Property type"),
attachment=self._extract_attachment(),
number_of_storeys=self._int_val("Storeys"),
habitable_rooms=self._int_val("Habitable Rooms"),
heated_habitable_rooms=self._int_val("Heated Habitable Rooms"),
construction_age_band=self._str_val("Main Property"),
dimensions=self._extract_dimensions(),
has_conservatory=self._bool_val("Is there a conservatory?"),
walls=self._extract_walls(),
roof=self._extract_roof(),
floor=self._extract_floor(),
door_count=self._int_val("Total Number of Doors"),
insulated_door_count=self._int_val("Number of Insulated Doors"),
windows=self._extract_windows(),
draught_proofing_percent=self._int_val("Draught Proofing"),
ventilation=self._extract_ventilation(),
lighting=self._extract_lighting(),
main_heating=self._extract_main_heating(),
meters=self._extract_meters(),
water_heating=self._extract_water_heating(),
baths_and_showers=self._extract_baths_and_showers(),
renewables=self._extract_renewables(),
)

View file

@ -0,0 +1,131 @@
#!/usr/bin/env python3
"""
Parse a local site-notes PDF and load the result into the database.
Usage:
python local_runner.py <pdf_path>
"""
from typing import List, Optional, Tuple
from backend.app.db.connection import db_session
from backend.app.db.models.epc_property import (
EpcBuildingPartModel,
EpcEnergyElementModel,
EpcFlatDetailsModel,
EpcFloorDimensionModel,
EpcMainHeatingDetailModel,
EpcPropertyEnergyPerformanceModel,
EpcPropertyModel,
EpcWindowModel,
)
from backend.documents_parser.elmhurst_extractor import ElmhurstSiteNotesExtractor
from backend.documents_parser.extractor import PasHubRdSapSiteNotesExtractor
from backend.documents_parser.pdf import pdf_to_pages, pdf_to_text_list
from datatypes.epc.domain.epc_property_data import EnergyElement, EpcPropertyData
from datatypes.epc.domain.mapper import EpcPropertyDataMapper
def _parse_pdf(pdf_path: str) -> EpcPropertyData:
with open(pdf_path, "rb") as f:
pdf_bytes: bytes = f.read()
pages: List[str] = pdf_to_pages(pdf_bytes)
full_text: str = "\n".join(pages)
if "Elmhurst Energy Systems" in full_text:
site_notes = ElmhurstSiteNotesExtractor(pages).extract()
return EpcPropertyDataMapper.from_elmhurst_site_notes(site_notes)
tokens: List[str] = pdf_to_text_list(pdf_bytes)
pashub_notes = PasHubRdSapSiteNotesExtractor(tokens).extract()
return EpcPropertyDataMapper.from_site_notes(pashub_notes)
def _insert_energy_elements(
session,
elements: List[EnergyElement],
element_type: str,
epc_property_id: int,
) -> None:
for el in elements:
session.add(
EpcEnergyElementModel.from_domain(el, element_type, epc_property_id)
)
def _insert_optional_energy_element(
session,
el: Optional[EnergyElement],
element_type: str,
epc_property_id: int,
) -> None:
if el is not None:
session.add(
EpcEnergyElementModel.from_domain(el, element_type, epc_property_id)
)
def run(pdf_path: str) -> None:
data: EpcPropertyData = _parse_pdf(pdf_path)
print("successfully mapped pdf")
with db_session() as session:
epc_prop: EpcPropertyModel = EpcPropertyModel.from_epc_property_data(data)
session.add(epc_prop)
session.flush()
assert epc_prop.id is not None
epc_property_id: int = epc_prop.id
session.add(
EpcPropertyEnergyPerformanceModel.from_epc_property_data(
data, epc_property_id=epc_property_id
)
)
for detail in data.sap_heating.main_heating_details:
session.add(EpcMainHeatingDetailModel.from_domain(detail, epc_property_id))
for part in data.sap_building_parts:
bp: EpcBuildingPartModel = EpcBuildingPartModel.from_domain(
part, epc_property_id
)
session.add(bp)
session.flush()
assert bp.id is not None
for dim in part.sap_floor_dimensions:
session.add(EpcFloorDimensionModel.from_domain(dim, bp.id))
for window in data.sap_windows:
session.add(EpcWindowModel.from_domain(window, epc_property_id))
list_elements: List[Tuple[List[EnergyElement], str]] = [
(data.roofs, "roof"),
(data.walls, "wall"),
(data.floors, "floor"),
(data.main_heating, "main_heating"),
]
for elements, etype in list_elements:
_insert_energy_elements(session, elements, etype, epc_property_id)
optional_elements: List[Tuple[Optional[EnergyElement], str]] = [
(data.window, "window"),
(data.lighting, "lighting"),
(data.hot_water, "hot_water"),
(data.secondary_heating, "secondary_heating"),
(data.main_heating_controls, "main_heating_controls"),
]
for el, etype in optional_elements:
_insert_optional_energy_element(session, el, etype, epc_property_id)
if data.sap_flat_details is not None:
session.add(
EpcFlatDetailsModel.from_domain(data.sap_flat_details, epc_property_id)
)
print(f"epc_property_id={epc_property_id}")
print(f"address: {data.address_line_1}, {data.post_town}, {data.postcode}")
if __name__ == "__main__":
# run("backend/documents_parser/tests/fixtures/PasHubSiteNotes_6.pdf")
run("backend/documents_parser/tests/fixtures/ElmhurstSiteNotes.pdf")

View file

@ -10,3 +10,8 @@ def pdf_to_text_list(pdf_bytes: bytes) -> List[str]:
for line in page.get_text().split("\n"):
tokens.append(line)
return tokens
def pdf_to_pages(pdf_bytes: bytes) -> List[str]:
with pymupdf.open(stream=pdf_bytes, filetype="pdf") as doc:
return [page.get_text() for page in doc]

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,6 @@
[
"Summary Information\nSurveyor:\nP960-0001\nName:\nRichard Matthew Ratcliff\nTitle: Mr.\nTel Number: 07760 443 469\nSurvey Reference:\n001573\nMy Reference:\nCurrent SAP rating:\nC 69\nPotential SAP rating: C 77\nEmissions (t/year):\n1.683 tonnes\nCurrent EI rating:\nC 76\nPotential EI rating:\nB 81\nFuel Bill:\n\u00a3896\nProperty Details:\nRdSAP version:\nRdSAP10\nReference Number:\nP960-0001-001573\nMy Reference:\nLodgement Required:\nNo\nRegs Region:\nEngland\nEPC Language:\nEnglish\nUPRN:\nPostcode:\nBB10 1XX\nRegion:\nWest Pennines\nHouse Name:\nHouse No:\n19\nStreet:\nQueens Road\nLocality:\nTown:\nBURNLEY\nCounty:\nProperty Tenure:\nRented (social)\nTransaction Type:\nGrant scheme\nInspection Date:\n06/03/2026\nProcess date:\n06/03/2026\nCheck for the existence of\nan EPC:\nNo\nDoes an EPC exist at the\npoint of carrying out this\nenergy assessment:\nNo\nReason why another energy\nassessment needs to be\nundertaken:\nRdSAP Inputs\nProperty Description:\n1.0 Property type:\nB Bungalow\nE End-Terrace\n2.0 Number of\nStoreys:\n1\nHabitable Rooms:\n2\nHeated Habitable Rooms:\n2\n3.0 Date Built:\nMain Property\nD 1950-1966\n4.0 Dimensions:\nDimension type:\nInternal\nMain Property\nFloor\nArea\n[m2]\nRoom\nHeight\n[m]\nHeat Loss\nWall Perimeter\n[m]\nParty Wall\nLength\n[m]\nLowest Floor:\n44.89\n2.24\n20.10\n6.70\nNo\n5.0 Conservatory:\nIs there a conservatory?\nNo\n7.0 Walls:\nMain Property\nType\nCA Cavity\nInsulation\nF Filled Cavity\nWall Thickness Unknown\nNo\nWall Thickness\n300 mm\nU-value Known\nNo\nParty Wall Type\nU Unable to determine\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\n8.0 Roofs:\nMain Property\nType\nPA Pitched (slates/tiles), access to loft\nInsulation\nJ Joists\nInsulation Thickness\n270 mm\nU-value Known\nNo\n8.1 Rooms in Roof:\n9.0 Floors:\nMain Property\nLocation\nG Ground floor\nType\nN Suspended, not timber\nInsulation\nA As built\nDefault U-value\n0.69\nU-value Known\nNo\n10.0 Doors:\nTotal Number of Doors\n0\nNumber of Insulated Doors\n0\n11.0 Windows:\nW\nH\nArea Glazing Type\nFrame \nType\nFrame \nFactor\nGlazing \nGap\nBuilding \nPart\nLocation\nOrient. Data-Source\nU \nvalue\ng \nvalue\nDraught \nProofed\nPermanent \nShutters\n1.30\n1.10\n1.43\nDouble post or during \n2022\n0.70\nMain\nExternal wall\nNorth\nManufacturer\n1.40\n0.72\nYes\nNone\n1.80\n1.00\n1.80\nDouble post or during \n2022\n0.70\nMain\nExternal wall\nNorth\nManufacturer\n1.40\n0.72\nYes\nNone\n0.70\n0.80\n0.56\nDouble post or during \n2022\n0.70\nMain\nExternal wall\nSouth\nManufacturer\n1.40\n0.72\nYes\nNone\n0.70\n1.30\n0.91\nDouble post or during \n2022\n0.70\nMain\nExternal wall\nSouth\nManufacturer\n1.40\n0.72\nYes\nNone\nDraught Proofing\n100 %\n12.0 Ventilation & Cooling\nNo. of open chimneys\n0\nNo. of open flues\n0\nNo. of open chimneys/open flues attached to closed fire\n0\nNo. of flues attached to solid fuel boiler\n0\nNo. of open flues attached to other heater\n0\nNo. of blocked chimneys\n0\nNo. of intermittent extract fans\n2\nNo. of passive vents\n0\nNo. of flueless gas fires\n0\nFixed Space Cooling\nNo\nDraught Lobby\nNot present\n12.1 Mechanical Ventilation\nMechanical Ventilation\nNo\n12.2 Air Pressure Test\nTest Method\nNot available\n13.0 Lighting\nTotal number of bulbs\n8\nNumber of LED and CFL Known\nYes\nNumber of LED lights\n4\nNumber of CFL lights\n4\nTotal number of Low Energy\n8\nTotal number of incandescents\n0\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\n14.0 Main Heating1\nPCDF boiler Reference\n17742 Potterton, Promax 33 Combi ErP, 88.30%\nHeat Emitter\nRadiators\nHeat pump age\nUnknown\nFuel Type\nMains gas\nFlue Type\nBalanced\nFan Assisted Flue\nYes\nDesign flow temperature\nUnknown\nPCDF Heating Controls\n0 \nMain Heating Controls EES\nCBE\nMain Heating Controls Sap\nSAP code 2106, Programmer, room thermostat and TRVs\nPCDF Compensator\n0 \nPercentage of Heat\n100 %\n14.1 Main Heating2\nPCDF boiler Reference\n0 \nMain Heating EES Code\nMain Heating SAP Code\n0\nPercentage of Heat\n0 %\n14.1 Community Heating/Heat Network\nHeating Type\nNone\n14.2 Meters\nElectricity meter type\nSingle\nMain gas\nYes\nElectricity Smart Meter Present\nNo\nGas Smart Meter Present\nNo\n15.0 Water Heating\nWater Heating Code\nHWP\nWater Heating SapCode\n901\nWater Heating Fuel Type\nMains gas\n15.1 Hot Water Cylinder\nHot Water Cylinder Present\nNo\n15.2 Community Hot Water\nPCDF boiler Reference\n0\n16.0 Solar water heating\nSolar Water Heating\nNo\n17.0 Waste Water Heat Recovery System\nIs WWHRS present in the property?\nNo / Unknown\n1x.0 Baths and Showers\nTotal Number of Baths\n0\nNumber of Baths Connected\n0\nDescription\nType\nConnected\n1\nElectric shower\nNone\n18.0 Flue Gas Heat Recovery System\nPresent\nNo\n19.0 Photovoltaic Panel\nPhotovoltaic Panel\nNone\nExport capable meter\nNo\n20.0 Wind Turbine\nTerrain Type\nSuburban\nWind turbine present?\nNo\n22.0 Special Features\n21.0 Small-Scale Hydro\nElectricity generated [kWh/year]\n0.00\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\nRecommendations\nLoft insulation (Already installed)\nFlat roof insulation (Not applicable)\nRoom-in-roof insulation (Not applicable)\nCavity wall insulation (Already installed)\nSolid wall insulation (Not applicable)\nFloor insulation (suspended floor) (Recommended)\nHot water cylinder insulation (Not applicable)\nDraught proofing (Already installed)\nLow energy lighting (Already installed)\nCylinder thermostat (Not applicable)\nHeating controls for wet central heating system (Already installed)\nUpgrade boiler, same fuel (Already installed)\nChange heating to condensing gas condensing boiler (fuel switch) (Not applicable)\nFlue gas heat recovery in conjunction with new boiler (Not applicable)\nSolar water heating (SAP increase too small)\nHeat recovery system for mixer showers (Not applicable)\nDouble glazed windows (Already installed)\nInsulated doors (Already installed)\nSolar photovoltaic panels (Recommended)\nWind turbine (Not applicable)\nPV diverter (Not applicable)\nPV battery (Not applicable)\nWater heating controls (Not applicable)\nAlternative Recommendations\nExternal wall insulation with cavity insulation (Not applicable)\nBiomass boiler (alternative) (Not applicable)\nMicro CHP (alternative) (Not applicable)\nRelated Party Disclosure\nAddenda\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n"
]

View file

@ -0,0 +1,6 @@
[
"Summary Information\nSurveyor:\nBW22-0001\nName:\nIan Marsh\nTitle:\nTel Number: 07709266472\nSurvey Reference:\n001233\nMy Reference:\nCurrent SAP rating:\nD 68\nPotential SAP rating: A 92\nEmissions (t/year):\n2.812 tonnes\nCurrent EI rating:\nD 68\nPotential EI rating:\nC 76\nFuel Bill:\n\u00a31098\nProperty Details:\nRdSAP version:\nRdSAP10\nReference Number:\nBW22-0001-001233\nMy Reference:\nLodgement Required:\nNo\nRegs Region:\nEngland\nEPC Language:\nEnglish\nUPRN:\nPostcode:\nBB11 2NU\nRegion:\nWest Pennines\nHouse Name:\nHouse No:\n39\nStreet:\nConstable Avenue\nLocality:\nTown:\nBURNLEY\nCounty:\nProperty Tenure:\nRented (social)\nTransaction Type:\nGrant scheme\nInspection Date:\n06/03/2026\nProcess date:\n06/03/2026\nCheck for the existence of\nan EPC:\nNo\nDoes an EPC exist at the\npoint of carrying out this\nenergy assessment:\nNo\nReason why another energy\nassessment needs to be\nundertaken:\nRdSAP Inputs\nProperty Description:\n1.0 Property type:\nH House\nS Semi-Detached\n2.0 Number of\nStoreys:\n2\nHabitable Rooms:\n4\nHeated Habitable Rooms:\n4\n3.0 Date Built:\nMain Property\nD 1950-1966\n4.0 Dimensions:\nDimension type:\nInternal\nMain Property\nFloor\nArea\n[m2]\nRoom\nHeight\n[m]\nHeat Loss\nWall Perimeter\n[m]\nParty Wall\nLength\n[m]\n1st Floor:\n35.88\n2.51\n17.46\n6.62\nLowest Floor:\n35.88\n2.67\n17.46\n6.62\nNo\n5.0 Conservatory:\nIs there a conservatory?\nNo\n7.0 Walls:\nMain Property\nType\nCA Cavity\nInsulation\nF Filled Cavity\nWall Thickness Unknown\nNo\nWall Thickness\n300 mm\nU-value Known\nNo\nParty Wall Type\nCU Cavity masonry unfilled\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\n8.0 Roofs:\nMain Property\nType\nPA Pitched (slates/tiles), access to loft\nInsulation\nJ Joists\nInsulation Thickness\n200 mm\nU-value Known\nNo\n8.1 Rooms in Roof:\n9.0 Floors:\nMain Property\nLocation\nG Ground floor\nType\nT Suspended timber\nInsulation\nA As built\nDefault U-value\n0.72\nU-value Known\nNo\n10.0 Doors:\nTotal Number of Doors\n2\nNumber of Insulated Doors\n0\n11.0 Windows:\nW\nH\nArea Glazing Type\nFrame \nType\nFrame \nFactor\nGlazing \nGap\nBuilding \nPart\nLocation\nOrient. Data-Source\nU \nvalue\ng \nvalue\nDraught \nProofed\nPermanent \nShutters\n1.59\n1.36\n2.16\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nEast\nManufacturer\n2.70\n0.76\nYes\nNone\n1.27\n0.43\n0.55\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nEast\nManufacturer\n2.70\n0.76\nYes\nNone\n1.54\n1.06\n1.63\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nEast\nManufacturer\n2.70\n0.76\nYes\nNone\n0.61\n1.07\n0.65\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nSouth\nManufacturer\n2.70\n0.76\nYes\nNone\n1.07\n1.05\n1.12\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nWest\nManufacturer\n2.70\n0.76\nYes\nNone\n1.07\n1.08\n1.16\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nWest\nManufacturer\n2.70\n0.76\nYes\nNone\n1.10\n1.06\n1.17\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nWest\nManufacturer\n2.70\n0.76\nYes\nNone\n1.12\n1.06\n1.19\nDouble with unknown \ninstall date\nPVC\n0.70\n16 mm or \nmore\nMain\nExternal wall\nWest\nManufacturer\n2.70\n0.76\nYes\nNone\nDraught Proofing\n90 %\n12.0 Ventilation & Cooling\nNo. of open chimneys\n0\nNo. of open flues\n0\nNo. of open chimneys/open flues attached to closed fire\n0\nNo. of flues attached to solid fuel boiler\n0\nNo. of open flues attached to other heater\n0\nNo. of blocked chimneys\n0\nNo. of intermittent extract fans\n2\nNo. of passive vents\n2\nNo. of flueless gas fires\n0\nFixed Space Cooling\nNo\nDraught Lobby\nNot present\n12.1 Mechanical Ventilation\nMechanical Ventilation\nNo\n12.2 Air Pressure Test\nTest Method\nNot available\n13.0 Lighting\nTotal number of bulbs\n10\nNumber of LED and CFL Known\nNo\nTotal number of Low Energy\n5\nTotal number of incandescents\n5\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\n14.0 Main Heating1\nPCDF boiler Reference\n18737 Baxi, ASSURE, 88.40%\nHeat Emitter\nRadiators\nHeat pump age\nUnknown\nFuel Type\nMains gas\nFlue Type\nBalanced\nFan Assisted Flue\nYes\nDesign flow temperature\nUnknown\nPCDF Heating Controls\n0 \nMain Heating Controls EES\nCBE\nMain Heating Controls Sap\nSAP code 2106, Programmer, room thermostat and TRVs\nPCDF Compensator\n0 \nPercentage of Heat\n100 %\n14.1 Main Heating2\nPCDF boiler Reference\n0 \nMain Heating EES Code\nMain Heating SAP Code\n0\nPercentage of Heat\n0 %\n14.1 Community Heating/Heat Network\nHeating Type\nNone\n14.2 Meters\nElectricity meter type\nSingle\nMain gas\nYes\nElectricity Smart Meter Present\nNo\nGas Smart Meter Present\nNo\n15.0 Water Heating\nWater Heating Code\nHWP\nWater Heating SapCode\n901\nWater Heating Fuel Type\nMains gas\n15.1 Hot Water Cylinder\nHot Water Cylinder Present\nNo\n15.2 Community Hot Water\nPCDF boiler Reference\n0\n16.0 Solar water heating\nSolar Water Heating\nNo\n17.0 Waste Water Heat Recovery System\nIs WWHRS present in the property?\nNo / Unknown\n1x.0 Baths and Showers\nTotal Number of Baths\n1\nNumber of Baths Connected\n0\nDescription\nType\nConnected\n1\nNon-electric shower\nNone\n18.0 Flue Gas Heat Recovery System\nPresent\nNo\n19.0 Photovoltaic Panel\nPhotovoltaic Panel\nNone\nExport capable meter\nNo\n20.0 Wind Turbine\nTerrain Type\nRural\nWind turbine present?\nNo\n22.0 Special Features\n21.0 Small-Scale Hydro\nElectricity generated [kWh/year]\n0.00\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n",
"Summary Information\nRecommendations\nLoft insulation (Already installed)\nFlat roof insulation (Not applicable)\nRoom-in-roof insulation (Not applicable)\nCavity wall insulation (Already installed)\nSolid wall insulation (Not applicable)\nFloor insulation (suspended floor) (Recommended)\nHot water cylinder insulation (Not applicable)\nDraught proofing (SAP increase too small)\nLow energy lighting (Recommended)\nCylinder thermostat (Not applicable)\nHeating controls for wet central heating system (Already installed)\nUpgrade boiler, same fuel (Already installed)\nChange heating to condensing gas condensing boiler (fuel switch) (Not applicable)\nFlue gas heat recovery in conjunction with new boiler (Not applicable)\nSolar water heating (SAP increase too small)\nHeat recovery system for mixer showers (SAP increase too small)\nDouble glazed windows (Already installed)\nInsulated doors (SAP increase too small)\nSolar photovoltaic panels (Recommended)\nWind turbine (Recommended)\nPV diverter (Not applicable)\nPV battery (Not applicable)\nWater heating controls (Not applicable)\nAlternative Recommendations\nExternal wall insulation with cavity insulation (Not applicable)\nBiomass boiler (alternative) (Not applicable)\nMicro CHP (alternative) (Not applicable)\nRelated Party Disclosure\nAddenda\n\u00a9 Elmhurst Energy Systems Limited Registered Office Unit 16, St Johns Business Park, Lutterworth, Leicestershire LE17 4HB\n"
]

View file

@ -0,0 +1,356 @@
import json
import os
from datetime import date
import pytest
from backend.documents_parser.elmhurst_extractor import ElmhurstSiteNotesExtractor
from datatypes.epc.domain.epc_property_data import EpcPropertyData
from datatypes.epc.domain.mapper import EpcPropertyDataMapper
FIXTURE_PATH = os.path.join(
os.path.dirname(__file__), "fixtures", "elmhurst_site_notes_1_text.json"
)
FIXTURE_PATH_2 = os.path.join(
os.path.dirname(__file__), "fixtures", "elmhurst_site_notes_2_text.json"
)
@pytest.fixture(scope="module")
def result() -> EpcPropertyData:
with open(FIXTURE_PATH) as f:
pages = json.load(f)
site_notes = ElmhurstSiteNotesExtractor(pages).extract()
return EpcPropertyDataMapper.from_elmhurst_site_notes(site_notes)
@pytest.fixture(scope="module")
def result2() -> EpcPropertyData:
with open(FIXTURE_PATH_2) as f:
pages = json.load(f)
site_notes = ElmhurstSiteNotesExtractor(pages).extract()
return EpcPropertyDataMapper.from_elmhurst_site_notes(site_notes)
class TestAddress:
def test_address_line_1(self, result: EpcPropertyData) -> None:
assert result.address_line_1 == "19, Queens Road"
def test_post_town(self, result: EpcPropertyData) -> None:
assert result.post_town == "BURNLEY"
def test_postcode(self, result: EpcPropertyData) -> None:
assert result.postcode == "BB10 1XX"
class TestInspectionInfo:
def test_inspection_date(self, result: EpcPropertyData) -> None:
assert result.inspection_date == date(2026, 3, 6)
def test_tenure(self, result: EpcPropertyData) -> None:
assert result.tenure == "Rented (social)"
def test_transaction_type(self, result: EpcPropertyData) -> None:
assert result.transaction_type == "Grant scheme"
def test_report_reference(self, result: EpcPropertyData) -> None:
assert result.report_reference == "P960-0001-001573"
class TestPropertyDescription:
def test_property_type(self, result: EpcPropertyData) -> None:
assert result.property_type == "Bungalow"
def test_built_form(self, result: EpcPropertyData) -> None:
assert result.built_form == "End-Terrace"
def test_dwelling_type(self, result: EpcPropertyData) -> None:
assert result.dwelling_type == "End-Terrace bungalow"
def test_number_of_storeys(self, result: EpcPropertyData) -> None:
assert result.number_of_storeys == 1
def test_has_conservatory(self, result: EpcPropertyData) -> None:
assert result.has_conservatory is False
def test_total_floor_area(self, result: EpcPropertyData) -> None:
assert result.total_floor_area_m2 == 44.89
class TestCounts:
def test_habitable_rooms_count(self, result: EpcPropertyData) -> None:
assert result.habitable_rooms_count == 2
def test_heated_rooms_count(self, result: EpcPropertyData) -> None:
assert result.heated_rooms_count == 2
def test_door_count(self, result: EpcPropertyData) -> None:
assert result.door_count == 0
def test_insulated_door_count(self, result: EpcPropertyData) -> None:
assert result.insulated_door_count == 0
def test_open_chimneys_count(self, result: EpcPropertyData) -> None:
assert result.open_chimneys_count == 0
def test_blocked_chimneys_count(self, result: EpcPropertyData) -> None:
assert result.blocked_chimneys_count == 0
class TestLighting:
def test_led_count(self, result: EpcPropertyData) -> None:
assert result.led_fixed_lighting_bulbs_count == 4
def test_cfl_count(self, result: EpcPropertyData) -> None:
assert result.cfl_fixed_lighting_bulbs_count == 4
def test_incandescent_count(self, result: EpcPropertyData) -> None:
assert result.incandescent_fixed_lighting_bulbs_count == 0
class TestFlags:
def test_solar_water_heating(self, result: EpcPropertyData) -> None:
assert result.solar_water_heating is False
def test_has_hot_water_cylinder(self, result: EpcPropertyData) -> None:
assert result.has_hot_water_cylinder is False
def test_has_fixed_air_conditioning(self, result: EpcPropertyData) -> None:
assert result.has_fixed_air_conditioning is False
def test_hydro(self, result: EpcPropertyData) -> None:
assert result.hydro is False
def test_photovoltaic_array(self, result: EpcPropertyData) -> None:
assert result.photovoltaic_array is False
class TestBuildingPart:
def test_single_building_part(self, result: EpcPropertyData) -> None:
assert len(result.sap_building_parts) == 1
def test_identifier(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].identifier == "main"
def test_construction_age_band(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].construction_age_band == "1950-1966"
def test_wall_construction(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].wall_construction == "Cavity"
def test_wall_insulation_type(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].wall_insulation_type == "Filled Cavity"
def test_wall_thickness_measured(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].wall_thickness_measured is True
def test_wall_thickness_mm(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].wall_thickness_mm == 300
def test_roof_insulation_location(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].roof_insulation_location == "Joists"
def test_roof_insulation_thickness(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].roof_insulation_thickness == 270
def test_floor_type(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].floor_type == "Ground floor"
def test_floor_construction_type(self, result: EpcPropertyData) -> None:
assert (
result.sap_building_parts[0].floor_construction_type
== "Suspended, not timber"
)
def test_floor_insulation_type_str(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].floor_insulation_type_str == "As built"
def test_floor_u_value_known(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].floor_u_value_known is False
def test_single_floor_dimension(self, result: EpcPropertyData) -> None:
assert len(result.sap_building_parts[0].sap_floor_dimensions) == 1
def test_floor_dimension_area(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].sap_floor_dimensions[0].total_floor_area_m2 == 44.89
def test_floor_dimension_room_height(self, result: EpcPropertyData) -> None:
assert result.sap_building_parts[0].sap_floor_dimensions[0].room_height_m == 2.24
def test_floor_dimension_heat_loss_perimeter(self, result: EpcPropertyData) -> None:
assert (
result.sap_building_parts[0].sap_floor_dimensions[0].heat_loss_perimeter_m
== 20.10
)
def test_floor_dimension_party_wall_length(self, result: EpcPropertyData) -> None:
assert (
result.sap_building_parts[0].sap_floor_dimensions[0].party_wall_length_m
== 6.70
)
class TestWindows:
def test_window_count(self, result: EpcPropertyData) -> None:
assert len(result.sap_windows) == 4
def test_first_window_width(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].window_width == 1.30
def test_first_window_height(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].window_height == 1.10
def test_first_window_orientation(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].orientation == "North"
def test_first_window_glazing_type(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].glazing_type == "Double post or during 2022"
def test_first_window_draught_proofed(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].draught_proofed is True
def test_third_window_orientation(self, result: EpcPropertyData) -> None:
assert result.sap_windows[2].orientation == "South"
def test_frame_factor(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].frame_factor == 0.7
def test_transmission_u_value(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].window_transmission_details is not None
assert result.sap_windows[0].window_transmission_details.u_value == 1.4
def test_transmission_solar_transmittance(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].window_transmission_details is not None
assert result.sap_windows[0].window_transmission_details.solar_transmittance == 0.72
def test_transmission_data_source(self, result: EpcPropertyData) -> None:
assert result.sap_windows[0].window_transmission_details is not None
assert result.sap_windows[0].window_transmission_details.data_source == "Manufacturer"
class TestHeating:
def test_single_heating_detail(self, result: EpcPropertyData) -> None:
assert len(result.sap_heating.main_heating_details) == 1
def test_fuel_type(self, result: EpcPropertyData) -> None:
assert result.sap_heating.main_heating_details[0].main_fuel_type == "Mains gas"
def test_heat_emitter_type(self, result: EpcPropertyData) -> None:
assert (
result.sap_heating.main_heating_details[0].heat_emitter_type == "Radiators"
)
def test_emitter_temperature(self, result: EpcPropertyData) -> None:
assert (
result.sap_heating.main_heating_details[0].emitter_temperature == "Unknown"
)
def test_fan_flue_present(self, result: EpcPropertyData) -> None:
assert result.sap_heating.main_heating_details[0].fan_flue_present is True
def test_has_fghrs(self, result: EpcPropertyData) -> None:
assert result.sap_heating.main_heating_details[0].has_fghrs is False
def test_main_heating_control(self, result: EpcPropertyData) -> None:
assert (
result.sap_heating.main_heating_details[0].main_heating_control
== "Programmer, room thermostat and TRVs"
)
def test_shower_outlet_type(self, result: EpcPropertyData) -> None:
assert result.sap_heating.shower_outlets is not None
assert (
result.sap_heating.shower_outlets.shower_outlet.shower_outlet_type
== "Electric shower"
)
def test_no_hot_water_cylinder_size(self, result: EpcPropertyData) -> None:
assert result.sap_heating.cylinder_size is None
def test_has_fixed_air_conditioning(self, result: EpcPropertyData) -> None:
assert result.sap_heating.has_fixed_air_conditioning is False
def test_water_heating_code(self, result: EpcPropertyData) -> None:
assert result.sap_heating.water_heating_code == 901
class TestEnergySource:
def test_mains_gas(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.mains_gas is True
def test_meter_type(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.meter_type == "Single"
def test_electricity_smart_meter(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.electricity_smart_meter_present is False
def test_gas_smart_meter(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.gas_smart_meter_present is False
def test_wind_turbines_count(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.wind_turbines_count == 0
def test_wind_turbines_terrain_type(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.wind_turbines_terrain_type == "Suburban"
def test_pv_battery_count(self, result: EpcPropertyData) -> None:
assert result.sap_energy_source.pv_battery_count == 0
class TestVentilation:
def test_draught_lobby(self, result: EpcPropertyData) -> None:
assert result.sap_ventilation is not None
assert result.sap_ventilation.draught_lobby is False
def test_pressure_test(self, result: EpcPropertyData) -> None:
assert result.sap_ventilation is not None
assert result.sap_ventilation.pressure_test == "Not available"
def test_extract_fans_count(self, result: EpcPropertyData) -> None:
assert result.sap_ventilation is not None
assert result.sap_ventilation.extract_fans_count == 2
def test_open_flues_count(self, result: EpcPropertyData) -> None:
assert result.sap_ventilation is not None
assert result.sap_ventilation.open_flues_count == 0
class TestDraughtproofingAndWater:
def test_percent_draughtproofed(self, result: EpcPropertyData) -> None:
assert result.percent_draughtproofed == 100
def test_waste_water_heat_recovery_absent(self, result: EpcPropertyData) -> None:
assert result.waste_water_heat_recovery == "None"
def test_any_unheated_rooms_false(self, result: EpcPropertyData) -> None:
assert result.any_unheated_rooms is False
class TestEnergyPerformance:
def test_energy_rating_current(self, result: EpcPropertyData) -> None:
assert result.energy_rating_current == 69
def test_energy_rating_potential(self, result: EpcPropertyData) -> None:
assert result.energy_rating_potential == 77
def test_environmental_impact_current(self, result: EpcPropertyData) -> None:
assert result.environmental_impact_current == 76
def test_environmental_impact_potential(self, result: EpcPropertyData) -> None:
assert result.environmental_impact_potential == 81
def test_co2_emissions_current(self, result: EpcPropertyData) -> None:
assert result.co2_emissions_current == 1.683
class TestWindowFrameMaterial:
def test_frame_material_from_elmhurst(self, result2: EpcPropertyData) -> None:
assert result2.sap_windows[0].frame_material == "PVC"
def test_glazing_gap_from_elmhurst(self, result2: EpcPropertyData) -> None:
assert result2.sap_windows[0].glazing_gap == "16 mm or more"
class TestLowEnergyLighting:
def test_low_energy_fixed_lighting_bulbs_count(self, result2: EpcPropertyData) -> None:
assert result2.low_energy_fixed_lighting_bulbs_count == 5

View file

@ -0,0 +1,515 @@
import json
import os
from datetime import date
import pytest
from backend.documents_parser.elmhurst_extractor import ElmhurstSiteNotesExtractor
from datatypes.epc.surveys.elmhurst_site_notes import (
BathsAndShowers,
BuildingPartDimensions,
ElmhurstSiteNotes,
FloorDetails,
FloorDimension,
Lighting,
MainHeating,
Meters,
PropertyDetails,
Renewables,
RoofDetails,
Shower,
SurveyorInfo,
VentilationAndCooling,
WallDetails,
WaterHeating,
Window,
)
FIXTURE_PATH = os.path.join(
os.path.dirname(__file__), "fixtures", "elmhurst_site_notes_1_text.json"
)
FIXTURE_PATH_2 = os.path.join(
os.path.dirname(__file__), "fixtures", "elmhurst_site_notes_2_text.json"
)
@pytest.fixture(scope="module")
def result() -> ElmhurstSiteNotes:
with open(FIXTURE_PATH) as f:
pages = json.load(f)
return ElmhurstSiteNotesExtractor(pages).extract()
@pytest.fixture(scope="module")
def result2() -> ElmhurstSiteNotes:
with open(FIXTURE_PATH_2) as f:
pages = json.load(f)
return ElmhurstSiteNotesExtractor(pages).extract()
class TestSurveyorInfo:
def test_surveyor_code(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.surveyor_code == "P960-0001"
def test_name(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.name == "Richard Matthew Ratcliff"
def test_title(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.title == "Mr."
def test_tel_number(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.tel_number == "07760 443 469"
def test_survey_reference(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.survey_reference == "001573"
def test_my_reference_none(self, result: ElmhurstSiteNotes) -> None:
assert result.surveyor_info.my_reference is None
class TestPropertyDetails:
def test_rdsap_version(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.rdsap_version == "RdSAP10"
def test_reference_number(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.reference_number == "P960-0001-001573"
def test_lodgement_required(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.lodgement_required is False
def test_regs_region(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.regs_region == "England"
def test_epc_language(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.epc_language == "English"
def test_uprn_none(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.uprn is None
def test_postcode(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.postcode == "BB10 1XX"
def test_region(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.region == "West Pennines"
def test_house_name_none(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.house_name is None
def test_house_number(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.house_number == "19"
def test_street(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.street == "Queens Road"
def test_locality_none(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.locality is None
def test_town(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.town == "BURNLEY"
def test_county_none(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.county is None
def test_tenure(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.tenure == "Rented (social)"
def test_transaction_type(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.transaction_type == "Grant scheme"
def test_inspection_date(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.inspection_date == date(2026, 3, 6)
def test_process_date(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.process_date == date(2026, 3, 6)
def test_epc_exists(self, result: ElmhurstSiteNotes) -> None:
assert result.property_details.epc_exists is False
class TestPropertyDescription:
def test_property_type(self, result: ElmhurstSiteNotes) -> None:
assert result.property_type == "B Bungalow"
def test_attachment(self, result: ElmhurstSiteNotes) -> None:
assert result.attachment == "E End-Terrace"
def test_number_of_storeys(self, result: ElmhurstSiteNotes) -> None:
assert result.number_of_storeys == 1
def test_habitable_rooms(self, result: ElmhurstSiteNotes) -> None:
assert result.habitable_rooms == 2
def test_heated_habitable_rooms(self, result: ElmhurstSiteNotes) -> None:
assert result.heated_habitable_rooms == 2
def test_construction_age_band(self, result: ElmhurstSiteNotes) -> None:
assert result.construction_age_band == "D 1950-1966"
def test_has_conservatory(self, result: ElmhurstSiteNotes) -> None:
assert result.has_conservatory is False
class TestDimensions:
def test_dimension_type(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.dimension_type == "Internal"
def test_floor_count(self, result: ElmhurstSiteNotes) -> None:
assert len(result.dimensions.floors) == 1
def test_floor_name(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.floors[0].name == "Lowest Floor"
def test_floor_area(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.floors[0].area_m2 == 44.89
def test_floor_room_height(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.floors[0].room_height_m == 2.24
def test_floor_heat_loss_perimeter(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.floors[0].heat_loss_perimeter_m == 20.10
def test_floor_party_wall_length(self, result: ElmhurstSiteNotes) -> None:
assert result.dimensions.floors[0].party_wall_length_m == 6.70
class TestWalls:
def test_wall_type(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.wall_type == "CA Cavity"
def test_insulation(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.insulation == "F Filled Cavity"
def test_thickness_unknown(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.thickness_unknown is False
def test_thickness_mm(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.thickness_mm == 300
def test_u_value_known(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.u_value_known is False
def test_party_wall_type(self, result: ElmhurstSiteNotes) -> None:
assert result.walls.party_wall_type == "U Unable to determine"
class TestRoof:
def test_roof_type(self, result: ElmhurstSiteNotes) -> None:
assert result.roof.roof_type == "PA Pitched (slates/tiles), access to loft"
def test_insulation(self, result: ElmhurstSiteNotes) -> None:
assert result.roof.insulation == "J Joists"
def test_insulation_thickness_mm(self, result: ElmhurstSiteNotes) -> None:
assert result.roof.insulation_thickness_mm == 270
def test_u_value_known(self, result: ElmhurstSiteNotes) -> None:
assert result.roof.u_value_known is False
class TestFloor:
def test_location(self, result: ElmhurstSiteNotes) -> None:
assert result.floor.location == "G Ground floor"
def test_floor_type(self, result: ElmhurstSiteNotes) -> None:
assert result.floor.floor_type == "N Suspended, not timber"
def test_insulation(self, result: ElmhurstSiteNotes) -> None:
assert result.floor.insulation == "A As built"
def test_default_u_value(self, result: ElmhurstSiteNotes) -> None:
assert result.floor.default_u_value == 0.69
def test_u_value_known(self, result: ElmhurstSiteNotes) -> None:
assert result.floor.u_value_known is False
class TestDoors:
def test_door_count(self, result: ElmhurstSiteNotes) -> None:
assert result.door_count == 0
def test_insulated_door_count(self, result: ElmhurstSiteNotes) -> None:
assert result.insulated_door_count == 0
class TestWindows:
def test_window_count(self, result: ElmhurstSiteNotes) -> None:
assert len(result.windows) == 4
def test_draught_proofing_percent(self, result: ElmhurstSiteNotes) -> None:
assert result.draught_proofing_percent == 100
def test_first_window_dimensions(self, result: ElmhurstSiteNotes) -> None:
w = result.windows[0]
assert w.width_m == 1.30
assert w.height_m == 1.10
assert w.area_m2 == 1.43
def test_first_window_glazing(self, result: ElmhurstSiteNotes) -> None:
w = result.windows[0]
assert w.glazing_type == "Double post or during 2022"
assert w.frame_factor == 0.70
def test_first_window_location(self, result: ElmhurstSiteNotes) -> None:
w = result.windows[0]
assert w.building_part == "Main"
assert w.location == "External wall"
assert w.orientation == "North"
def test_first_window_performance(self, result: ElmhurstSiteNotes) -> None:
w = result.windows[0]
assert w.data_source == "Manufacturer"
assert w.u_value == 1.40
assert w.g_value == 0.72
assert w.draught_proofed is True
assert w.permanent_shutters == "None"
def test_third_window_orientation(self, result: ElmhurstSiteNotes) -> None:
assert result.windows[2].orientation == "South"
def test_fourth_window_dimensions(self, result: ElmhurstSiteNotes) -> None:
w = result.windows[3]
assert w.width_m == 0.70
assert w.height_m == 1.30
assert w.area_m2 == 0.91
class TestVentilation:
def test_open_chimneys(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.open_chimneys_count == 0
def test_open_flues(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.open_flues_count == 0
def test_open_chimneys_closed_fire(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.open_chimneys_closed_fire_count == 0
def test_solid_fuel_boiler_flues(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.solid_fuel_boiler_flues_count == 0
def test_other_heater_flues(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.other_heater_flues_count == 0
def test_blocked_chimneys(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.blocked_chimneys_count == 0
def test_extract_fans(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.extract_fans_count == 2
def test_passive_vents(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.passive_vents_count == 0
def test_flueless_gas_fires(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.flueless_gas_fires_count == 0
def test_fixed_space_cooling(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.fixed_space_cooling is False
def test_draught_lobby(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.draught_lobby == "Not present"
def test_mechanical_ventilation(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.mechanical_ventilation is False
def test_pressure_test_method(self, result: ElmhurstSiteNotes) -> None:
assert result.ventilation.pressure_test_method == "Not available"
class TestLighting:
def test_total_bulbs(self, result: ElmhurstSiteNotes) -> None:
assert result.lighting.total_bulbs == 8
def test_led_cfl_count_known(self, result: ElmhurstSiteNotes) -> None:
assert result.lighting.led_cfl_count_known is True
def test_led_count(self, result: ElmhurstSiteNotes) -> None:
assert result.lighting.led_count == 4
def test_cfl_count(self, result: ElmhurstSiteNotes) -> None:
assert result.lighting.cfl_count == 4
def test_incandescent_count(self, result: ElmhurstSiteNotes) -> None:
assert result.lighting.incandescent_count == 0
class TestMainHeating:
def test_pcdf_boiler_reference(self, result: ElmhurstSiteNotes) -> None:
assert (
result.main_heating.pcdf_boiler_reference
== "17742 Potterton, Promax 33 Combi ErP, 88.30%"
)
def test_heat_emitter(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.heat_emitter == "Radiators"
def test_heat_pump_age(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.heat_pump_age == "Unknown"
def test_fuel_type(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.fuel_type == "Mains gas"
def test_flue_type(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.flue_type == "Balanced"
def test_fan_assisted_flue(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.fan_assisted_flue is True
def test_design_flow_temperature(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.design_flow_temperature == "Unknown"
def test_heating_controls_ees(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.heating_controls_ees == "CBE"
def test_heating_controls_sap(self, result: ElmhurstSiteNotes) -> None:
assert (
result.main_heating.heating_controls_sap
== "SAP code 2106, Programmer, room thermostat and TRVs"
)
def test_percentage_of_heat(self, result: ElmhurstSiteNotes) -> None:
assert result.main_heating.percentage_of_heat == 100
class TestMeters:
def test_electricity_meter_type(self, result: ElmhurstSiteNotes) -> None:
assert result.meters.electricity_meter_type == "Single"
def test_main_gas(self, result: ElmhurstSiteNotes) -> None:
assert result.meters.main_gas is True
def test_electricity_smart_meter(self, result: ElmhurstSiteNotes) -> None:
assert result.meters.electricity_smart_meter is False
def test_gas_smart_meter(self, result: ElmhurstSiteNotes) -> None:
assert result.meters.gas_smart_meter is False
class TestWaterHeating:
def test_water_heating_code(self, result: ElmhurstSiteNotes) -> None:
assert result.water_heating.water_heating_code == "HWP"
def test_water_heating_sap_code(self, result: ElmhurstSiteNotes) -> None:
assert result.water_heating.water_heating_sap_code == 901
def test_water_heating_fuel_type(self, result: ElmhurstSiteNotes) -> None:
assert result.water_heating.water_heating_fuel_type == "Mains gas"
def test_hot_water_cylinder_present(self, result: ElmhurstSiteNotes) -> None:
assert result.water_heating.hot_water_cylinder_present is False
class TestBathsAndShowers:
def test_number_of_baths(self, result: ElmhurstSiteNotes) -> None:
assert result.baths_and_showers.number_of_baths == 0
def test_number_of_baths_connected(self, result: ElmhurstSiteNotes) -> None:
assert result.baths_and_showers.number_of_baths_connected == 0
def test_shower_count(self, result: ElmhurstSiteNotes) -> None:
assert len(result.baths_and_showers.showers) == 1
def test_shower_number(self, result: ElmhurstSiteNotes) -> None:
assert result.baths_and_showers.showers[0].shower_number == 1
def test_shower_outlet_type(self, result: ElmhurstSiteNotes) -> None:
assert result.baths_and_showers.showers[0].outlet_type == "Electric shower"
def test_shower_connected(self, result: ElmhurstSiteNotes) -> None:
assert result.baths_and_showers.showers[0].connected == "None"
class TestRenewables:
def test_solar_water_heating(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.solar_water_heating is False
def test_wwhrs_present(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.wwhrs_present is False
def test_flue_gas_heat_recovery_present(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.flue_gas_heat_recovery_present is False
def test_photovoltaic_panel(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.photovoltaic_panel == "None"
def test_export_capable_meter(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.export_capable_meter is False
def test_wind_turbine_present(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.wind_turbine_present is False
def test_wind_turbines_terrain_type(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.wind_turbines_terrain_type == "Suburban"
def test_hydro_electricity_generated_kwh(self, result: ElmhurstSiteNotes) -> None:
assert result.renewables.hydro_electricity_generated_kwh == 0.0
class TestEnergyPerformance:
def test_current_sap_rating(self, result: ElmhurstSiteNotes) -> None:
assert result.current_sap_rating == 69
def test_potential_sap_rating(self, result: ElmhurstSiteNotes) -> None:
assert result.potential_sap_rating == 77
def test_current_ei_rating(self, result: ElmhurstSiteNotes) -> None:
assert result.current_ei_rating == 76
def test_potential_ei_rating(self, result: ElmhurstSiteNotes) -> None:
assert result.potential_ei_rating == 81
def test_co2_emissions_current_t(self, result: ElmhurstSiteNotes) -> None:
assert result.co2_emissions_current_t == 1.683
class TestWindowsWithFrameDetails:
def test_window_count(self, result2: ElmhurstSiteNotes) -> None:
assert len(result2.windows) == 8
def test_draught_proofing_percent(self, result2: ElmhurstSiteNotes) -> None:
assert result2.draught_proofing_percent == 90
def test_first_window_glazing_type_excludes_frame_type(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].glazing_type == "Double with unknown install date"
def test_first_window_frame_type(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].frame_type == "PVC"
def test_first_window_frame_factor(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].frame_factor == 0.70
def test_first_window_glazing_gap(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].glazing_gap == "16 mm or more"
def test_first_window_location(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].building_part == "Main"
assert result2.windows[0].location == "External wall"
assert result2.windows[0].orientation == "East"
def test_first_window_performance(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[0].data_source == "Manufacturer"
assert result2.windows[0].u_value == 2.70
assert result2.windows[0].g_value == 0.76
assert result2.windows[0].draught_proofed is True
assert result2.windows[0].permanent_shutters == "None"
def test_fourth_window_orientation(self, result2: ElmhurstSiteNotes) -> None:
assert result2.windows[3].orientation == "South"
class TestLightingLedCflUnknown:
def test_total_bulbs(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.total_bulbs == 10
def test_led_cfl_count_known_false(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.led_cfl_count_known is False
def test_low_energy_count(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.low_energy_count == 5
def test_incandescent_count(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.incandescent_count == 5
def test_led_count_zero_when_unknown(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.led_count == 0
def test_cfl_count_zero_when_unknown(self, result2: ElmhurstSiteNotes) -> None:
assert result2.lighting.cfl_count == 0

View file

@ -20,9 +20,9 @@ from datatypes.epc.domain.epc_property_data import (
)
from datatypes.epc.domain.mapper import EpcPropertyDataMapper
PDF_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "ExampleSiteNotes.pdf")
PDF_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_1.pdf")
PDF_PATH_2 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_2.pdf"
os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_2.pdf"
)
@ -71,7 +71,7 @@ class TestPdfToEpcPropertyData:
),
sap_windows=[
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",
@ -84,7 +84,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",
@ -97,7 +97,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North East",
window_type="Window",
@ -110,7 +110,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North",
window_type="Window",
@ -123,7 +123,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North East",
window_type="Window",
@ -136,7 +136,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",
@ -149,7 +149,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",
@ -162,7 +162,7 @@ class TestPdfToEpcPropertyData:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North East",
window_type="Window",
@ -302,7 +302,7 @@ class TestPdfToEpcPropertyDataFixture2:
PDF_PATH_3 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_3.pdf"
os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_3.pdf"
)
@ -339,7 +339,7 @@ class TestPdfToEpcPropertyDataFixture3:
PDF_PATH_4 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_4.pdf"
os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_4.pdf"
)
@ -369,7 +369,7 @@ class TestPdfToEpcPropertyDataFixture4:
PDF_PATH_5 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_5.pdf"
os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_5.pdf"
)
@ -401,7 +401,7 @@ class TestPdfToEpcPropertyDataFixture5:
PDF_PATH_6 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_6.pdf"
os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_6.pdf"
)

View file

@ -37,32 +37,32 @@ FIXTURES = os.path.join(os.path.dirname(__file__), "fixtures")
def load_text_fixture() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_1_text.json")) as f:
return json.load(f)
def load_text_fixture_2() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_2_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_2_text.json")) as f:
return json.load(f)
def load_text_fixture_3() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_3_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_3_text.json")) as f:
return json.load(f)
def load_text_fixture_4() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_4_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_4_text.json")) as f:
return json.load(f)
def load_text_fixture_5() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_5_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_5_text.json")) as f:
return json.load(f)
def load_text_fixture_6() -> list[str]:
with open(os.path.join(FIXTURES, "site_notes_example_6_text.json")) as f:
with open(os.path.join(FIXTURES, "pashub_site_notes_6_text.json")) as f:
return json.load(f)

View file

@ -5,8 +5,8 @@ import pytest
from backend.documents_parser.pdf import pdf_to_text_list
PDF_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "ExampleSiteNotes.pdf")
FIXTURE_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "site_notes_example_text.json")
PDF_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "PasHubSiteNotes_1.pdf")
FIXTURE_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "pashub_site_notes_1_text.json")
@pytest.fixture

View file

@ -89,13 +89,13 @@ class SapVentilation:
@dataclass
class WindowTransmissionDetails:
u_value: float
data_source: int
data_source: Union[int, str]
solar_transmittance: float
@dataclass
class SapWindow:
pvc_frame: str
frame_material: Optional[str]
glazing_gap: Union[int, str]
orientation: Union[int, str]
window_type: Union[int, str]

View file

@ -51,13 +51,17 @@ from datatypes.epc.schema.rdsap_schema_21_0_1 import (
RdSapSchema21_0_1,
EnergyElement as EnergyElement_21_0_1,
)
from datatypes.epc.surveys.elmhurst_site_notes import (
ElmhurstSiteNotes,
VentilationAndCooling as ElmhurstVentilation,
Window as ElmhurstWindow,
)
from datatypes.epc.surveys.pashub_rdsap_site_notes import (
BuildingConstruction,
BuildingMeasurements,
ExtensionConstruction,
ExtensionMeasurements,
ExtensionRoofSpace,
FloorConstruction,
FloorMeasurement,
HeatingAndHotWater,
PasHubRdSapSiteNotes,
@ -200,6 +204,80 @@ class EpcPropertyDataMapper:
sap_ventilation=_map_sap_ventilation(ventilation),
)
@staticmethod
def from_elmhurst_site_notes(survey: ElmhurstSiteNotes) -> EpcPropertyData:
pd = survey.property_details
built_form = _strip_code(survey.attachment)
property_type = _strip_code(survey.property_type)
prefix = pd.house_number or pd.house_name or ""
address_line_1 = f"{prefix}, {pd.street}" if prefix else pd.street
return EpcPropertyData(
dwelling_type=f"{built_form} {property_type.lower()}",
inspection_date=pd.inspection_date,
tenure=pd.tenure,
transaction_type=pd.transaction_type,
address_line_1=address_line_1,
post_town=pd.town,
postcode=pd.postcode,
report_reference=pd.reference_number,
roofs=[],
walls=[],
floors=[],
main_heating=[],
door_count=survey.door_count,
sap_heating=_map_elmhurst_sap_heating(survey),
sap_windows=[_map_elmhurst_window(w) for w in survey.windows],
sap_energy_source=SapEnergySource(
mains_gas=survey.meters.main_gas,
meter_type=survey.meters.electricity_meter_type,
pv_battery_count=0,
wind_turbines_count=1 if survey.renewables.wind_turbine_present else 0,
gas_smart_meter_present=survey.meters.gas_smart_meter,
is_dwelling_export_capable=survey.renewables.export_capable_meter,
wind_turbines_terrain_type=survey.renewables.wind_turbines_terrain_type,
electricity_smart_meter_present=survey.meters.electricity_smart_meter,
),
sap_building_parts=[_map_elmhurst_building_part(survey)],
solar_water_heating=survey.renewables.solar_water_heating,
has_hot_water_cylinder=survey.water_heating.hot_water_cylinder_present,
has_fixed_air_conditioning=survey.ventilation.fixed_space_cooling,
wet_rooms_count=0,
extensions_count=0,
heated_rooms_count=survey.heated_habitable_rooms,
open_chimneys_count=survey.ventilation.open_chimneys_count,
habitable_rooms_count=survey.habitable_rooms,
insulated_door_count=survey.insulated_door_count,
cfl_fixed_lighting_bulbs_count=survey.lighting.cfl_count,
led_fixed_lighting_bulbs_count=survey.lighting.led_count,
incandescent_fixed_lighting_bulbs_count=survey.lighting.incandescent_count,
total_floor_area_m2=round(
sum(f.area_m2 for f in survey.dimensions.floors), 2
),
built_form=built_form,
property_type=property_type,
has_conservatory=survey.has_conservatory,
blocked_chimneys_count=survey.ventilation.blocked_chimneys_count,
number_of_storeys=survey.number_of_storeys,
hydro=survey.renewables.hydro_electricity_generated_kwh > 0,
photovoltaic_array=survey.renewables.photovoltaic_panel != "None",
sap_ventilation=_map_elmhurst_ventilation(survey.ventilation),
percent_draughtproofed=survey.draught_proofing_percent,
waste_water_heat_recovery=(
"None" if not survey.renewables.wwhrs_present else "Present"
),
any_unheated_rooms=survey.heated_habitable_rooms < survey.habitable_rooms,
low_energy_fixed_lighting_bulbs_count=(
survey.lighting.low_energy_count if not survey.lighting.led_cfl_count_known else None
),
energy_rating_current=survey.current_sap_rating,
energy_rating_potential=survey.potential_sap_rating,
environmental_impact_current=survey.current_ei_rating,
environmental_impact_potential=survey.potential_ei_rating,
co2_emissions_current=survey.co2_emissions_current_t,
)
@staticmethod
def from_rdsap_schema_17_0(schema: RdSapSchema17_0) -> EpcPropertyData:
es = schema.sap_energy_source
@ -866,7 +944,7 @@ class EpcPropertyDataMapper:
# 20.0.0 SapWindow lacks frame/gap/draught fields present in later schemas
sap_windows=[
SapWindow(
pvc_frame="",
frame_material=None,
glazing_gap=0,
orientation=w.orientation,
window_type=w.window_type,
@ -1043,7 +1121,7 @@ class EpcPropertyDataMapper:
),
sap_windows=[
SapWindow(
pvc_frame=w.pvc_frame,
frame_material="PVC" if w.pvc_frame == "true" else None,
glazing_gap=w.glazing_gap,
orientation=w.orientation,
window_type=w.window_type,
@ -1277,7 +1355,7 @@ class EpcPropertyDataMapper:
# SAP windows
sap_windows=[
SapWindow(
pvc_frame=w.pvc_frame,
frame_material="PVC" if w.pvc_frame == "true" else None,
glazing_gap=w.glazing_gap,
orientation=w.orientation,
window_type=w.window_type,
@ -1453,6 +1531,12 @@ class EpcPropertyDataMapper:
# ---------------------------------------------------------------------------
def _strip_code(value: str) -> str:
"""Strip leading uppercase code from Elmhurst coded strings, e.g. 'CA Cavity''Cavity'."""
parts = value.split(" ", 1)
return parts[1] if len(parts) > 1 else value
def _extract_age_band(age_range: str) -> str:
"""Return the letter code from a site-notes age range, e.g. 'I: 1996 - 2002''I'."""
return age_range.split(":")[0].strip()
@ -1532,7 +1616,7 @@ def _map_extension_building_part(
def _map_sap_window(window: Window) -> SapWindow:
return SapWindow(
pvc_frame=window.frame_type,
frame_material=window.frame_type,
glazing_gap=window.glazing_gap,
orientation=window.orientation,
window_type=window.window_type,
@ -1574,7 +1658,11 @@ def _map_sap_heating(
fuel_type = (
_raw_fuel
if _raw_fuel
else ("Electricity" if main.system_type.lower() in _ELECTRIC_SYSTEM_TYPES else _raw_fuel)
else (
"Electricity"
if main.system_type.lower() in _ELECTRIC_SYSTEM_TYPES
else _raw_fuel
)
)
return SapHeating(
@ -1596,7 +1684,11 @@ def _map_sap_heating(
secondary_fuel_type=secondary_fuel_type,
secondary_heating_type=heating.secondary_heating.secondary_system,
shower_outlets=shower_outlets,
cylinder_size=heating.water_heating.cylinder_size if heating.water_heating.cylinder_size != "No Cylinder" else None,
cylinder_size=(
heating.water_heating.cylinder_size
if heating.water_heating.cylinder_size != "No Cylinder"
else None
),
cylinder_insulation_type=heating.water_heating.insulation_type,
cylinder_insulation_thickness_mm=heating.water_heating.insulation_thickness_mm,
immersion_heating_type=heating.water_heating.immersion_type,
@ -1617,3 +1709,112 @@ def _map_sap_ventilation(ventilation: Ventilation) -> SapVentilation:
flueless_gas_fires_count=ventilation.number_of_flueless_gas_fires,
ventilation_in_pcdf_database=ventilation.ventilation_in_pcdf_database,
)
def _map_elmhurst_building_part(survey: ElmhurstSiteNotes) -> SapBuildingPart:
dims = survey.dimensions
floor_dims = [
SapFloorDimension(
room_height_m=f.room_height_m,
total_floor_area_m2=f.area_m2,
party_wall_length_m=f.party_wall_length_m,
heat_loss_perimeter_m=f.heat_loss_perimeter_m,
floor=i,
)
for i, f in enumerate(dims.floors)
]
return SapBuildingPart(
identifier="main",
construction_age_band=_strip_code(survey.construction_age_band),
wall_construction=_strip_code(survey.walls.wall_type),
wall_insulation_type=_strip_code(survey.walls.insulation),
wall_thickness_measured=not survey.walls.thickness_unknown,
party_wall_construction=_strip_code(survey.walls.party_wall_type),
sap_floor_dimensions=floor_dims,
wall_thickness_mm=survey.walls.thickness_mm,
roof_insulation_location=_strip_code(survey.roof.insulation),
roof_insulation_thickness=survey.roof.insulation_thickness_mm,
floor_type=_strip_code(survey.floor.location),
floor_construction_type=_strip_code(survey.floor.floor_type),
floor_insulation_type_str=_strip_code(survey.floor.insulation),
floor_u_value_known=survey.floor.u_value_known,
)
def _map_elmhurst_window(w: ElmhurstWindow) -> SapWindow:
return SapWindow(
frame_material=w.frame_type or None,
glazing_gap=w.glazing_gap or "",
orientation=w.orientation,
window_type="Window",
glazing_type=w.glazing_type,
window_width=w.width_m,
window_height=w.height_m,
draught_proofed=w.draught_proofed,
window_location=w.building_part,
window_wall_type=w.location,
permanent_shutters_present=w.permanent_shutters,
frame_factor=w.frame_factor,
window_transmission_details=WindowTransmissionDetails(
u_value=w.u_value,
solar_transmittance=w.g_value,
data_source=w.data_source,
),
)
def _map_elmhurst_sap_heating(survey: ElmhurstSiteNotes) -> SapHeating:
mh = survey.main_heating
sap_control = mh.heating_controls_sap
control = (
sap_control.split(", ", 1)[1]
if sap_control.startswith("SAP code") and ", " in sap_control
else sap_control
)
shower_outlets = (
ShowerOutlets(
shower_outlet=ShowerOutlet(
shower_outlet_type=survey.baths_and_showers.showers[0].outlet_type
)
)
if survey.baths_and_showers.showers
else None
)
return SapHeating(
instantaneous_wwhrs=InstantaneousWwhrs(),
main_heating_details=[
MainHeatingDetail(
has_fghrs=survey.renewables.flue_gas_heat_recovery_present,
main_fuel_type=mh.fuel_type,
heat_emitter_type=mh.heat_emitter,
emitter_temperature=mh.design_flow_temperature,
fan_flue_present=mh.fan_assisted_flue,
main_heating_control=control,
central_heating_pump_age_str=mh.heat_pump_age,
)
],
has_fixed_air_conditioning=survey.ventilation.fixed_space_cooling,
shower_outlets=shower_outlets,
cylinder_size=(
None
if not survey.water_heating.hot_water_cylinder_present
else survey.water_heating.water_heating_code
),
water_heating_code=survey.water_heating.water_heating_sap_code,
)
def _map_elmhurst_ventilation(v: ElmhurstVentilation) -> SapVentilation:
return SapVentilation(
ventilation_type=None,
draught_lobby=v.draught_lobby != "Not present",
pressure_test=v.pressure_test_method,
open_flues_count=v.open_flues_count,
closed_flues_count=v.open_chimneys_closed_fire_count,
boiler_flues_count=v.solid_fuel_boiler_flues_count,
other_flues_count=v.other_heater_flues_count,
extract_fans_count=v.extract_fans_count,
passive_vents_count=v.passive_vents_count,
flueless_gas_fires_count=v.flueless_gas_fires_count,
ventilation_in_pcdf_database=None,
)

View file

@ -481,6 +481,10 @@ class TestFromRdSapSchema21_0_1:
# draught_proofed: "true"
assert result.sap_windows[0].draught_proofed is True
def test_window_frame_material_false(self, result: EpcPropertyData) -> None:
# pvc_frame: "false" in fixture → frame_material should be None
assert result.sap_windows[0].frame_material is None
# --- sap building parts ---
def test_building_part_count(self, result: EpcPropertyData) -> None:

View file

@ -398,7 +398,7 @@ class TestFromSiteNotesExample1:
# Windows
sap_windows=[
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="South East",
window_type="Window",
@ -411,7 +411,7 @@ class TestFromSiteNotesExample1:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="South East",
window_type="Window",
@ -424,7 +424,7 @@ class TestFromSiteNotesExample1:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",
@ -437,7 +437,7 @@ class TestFromSiteNotesExample1:
permanent_shutters_present=False,
),
SapWindow(
pvc_frame="Wooden or PVC",
frame_material="Wooden or PVC",
glazing_gap="16 mm or more",
orientation="North West",
window_type="Window",

View file

@ -0,0 +1,247 @@
from dataclasses import dataclass
from datetime import date
from typing import List, Optional
@dataclass
class SurveyorInfo:
surveyor_code: str
name: str
title: str
tel_number: str
survey_reference: str
my_reference: Optional[str] = None
@dataclass
class PropertyDetails:
rdsap_version: str
reference_number: str
lodgement_required: bool
regs_region: str
epc_language: str
postcode: str
region: str
street: str
town: str
tenure: str
transaction_type: str
inspection_date: date
process_date: date
epc_exists: bool
uprn: Optional[str] = None
house_name: Optional[str] = None
house_number: Optional[str] = None
locality: Optional[str] = None
county: Optional[str] = None
@dataclass
class FloorDimension:
name: str # e.g. "Lowest Floor"
area_m2: float
room_height_m: float
heat_loss_perimeter_m: float
party_wall_length_m: float
@dataclass
class BuildingPartDimensions:
dimension_type: str # e.g. "Internal"
floors: List[FloorDimension]
@dataclass
class WallDetails:
wall_type: str # e.g. "CA Cavity"
insulation: str # e.g. "F Filled Cavity"
thickness_unknown: bool
u_value_known: bool
party_wall_type: str # e.g. "U Unable to determine"
thickness_mm: Optional[int] = None
@dataclass
class RoofDetails:
roof_type: str # e.g. "PA Pitched (slates/tiles), access to loft"
insulation: str # e.g. "J Joists"
u_value_known: bool
insulation_thickness_mm: Optional[int] = None
@dataclass
class FloorDetails:
location: str # e.g. "G Ground floor"
floor_type: str # e.g. "N Suspended, not timber"
insulation: str # e.g. "A As built"
u_value_known: bool
default_u_value: Optional[float] = None
@dataclass
class Window:
width_m: float
height_m: float
area_m2: float
glazing_type: str
frame_factor: float
building_part: str
location: str
orientation: str
data_source: str
u_value: float
g_value: float
draught_proofed: bool
permanent_shutters: str # e.g. "None"
frame_type: Optional[str] = None
glazing_gap: Optional[str] = None
@dataclass
class VentilationAndCooling:
open_chimneys_count: int
open_flues_count: int
open_chimneys_closed_fire_count: int
solid_fuel_boiler_flues_count: int
other_heater_flues_count: int
blocked_chimneys_count: int
extract_fans_count: int
passive_vents_count: int
flueless_gas_fires_count: int
fixed_space_cooling: bool
draught_lobby: str # e.g. "Not present"
mechanical_ventilation: bool
pressure_test_method: str # e.g. "Not available"
@dataclass
class Lighting:
total_bulbs: int
led_cfl_count_known: bool
led_count: int
cfl_count: int
incandescent_count: int
low_energy_count: int = 0
@dataclass
class MainHeating:
heat_emitter: str # e.g. "Radiators"
fuel_type: str # e.g. "Mains gas"
flue_type: str # e.g. "Balanced"
fan_assisted_flue: bool
design_flow_temperature: str # e.g. "Unknown"
heating_controls_ees: str # e.g. "CBE"
heating_controls_sap: (
str # e.g. "SAP code 2106, Programmer, room thermostat and TRVs"
)
percentage_of_heat: int
pcdf_boiler_reference: Optional[str] = (
None # e.g. "17742 Potterton, Promax 33 Combi ErP, 88.30%"
)
heat_pump_age: Optional[str] = None
@dataclass
class Meters:
electricity_meter_type: str # e.g. "Single"
main_gas: bool
electricity_smart_meter: bool
gas_smart_meter: bool
@dataclass
class WaterHeating:
water_heating_code: str # e.g. "HWP"
water_heating_sap_code: int
water_heating_fuel_type: str
hot_water_cylinder_present: bool
@dataclass
class Shower:
shower_number: int
outlet_type: str
connected: str # e.g. "None"
@dataclass
class BathsAndShowers:
number_of_baths: int
number_of_baths_connected: int
showers: List[Shower]
@dataclass
class Renewables:
solar_water_heating: bool
wwhrs_present: bool
flue_gas_heat_recovery_present: bool
photovoltaic_panel: str # e.g. "None"
export_capable_meter: bool
wind_turbine_present: bool
wind_turbines_terrain_type: str
hydro_electricity_generated_kwh: float
@dataclass
class ElmhurstSiteNotes:
surveyor_info: SurveyorInfo
property_details: PropertyDetails
# Summary Information
current_sap_rating: int
potential_sap_rating: int
current_ei_rating: int
potential_ei_rating: int
co2_emissions_current_t: float
# Section 1.0
property_type: str # e.g. "B Bungalow"
attachment: str # e.g. "E End-Terrace"
# Section 2.0
number_of_storeys: int
habitable_rooms: int
heated_habitable_rooms: int
# Section 3.0
construction_age_band: str # e.g. "D 1950-1966"
# Section 4.0
dimensions: BuildingPartDimensions
# Section 5.0
has_conservatory: bool
# Sections 7.09.0
walls: WallDetails
roof: RoofDetails
floor: FloorDetails
# Section 10.0
door_count: int
insulated_door_count: int
# Section 11.0
windows: List[Window]
draught_proofing_percent: int
# Section 12.0
ventilation: VentilationAndCooling
# Section 13.0
lighting: Lighting
# Section 14.014.2
main_heating: MainHeating
meters: Meters
# Section 15.0
water_heating: WaterHeating
# Section 1x.0
baths_and_showers: BathsAndShowers
# Sections 16.022.0
renewables: Renewables