gradio-project-deployment / backend /scripts /generate_frontend_level3_sections.py
StormShadow308's picture
Deploy RICS Gradio UI with ZeroGPU-safe generation
6143b69
Raw
History Blame Contribute Delete
4.57 kB
"""Generate STATIC_L3_SECTIONS for frontend/index.html."""
from __future__ import annotations
from backend.domain.rics_level3_schema import CANONICAL_SCHEMA
HINTS = {
"A1": "surveyor name · RICS number · qualifications · company · contact",
"A2": "inspection date · time on site",
"A3": "related party · conflict of interest",
"A4": "weather · dry · wet · overcast",
"A5": "occupied · vacant · furnished · access limitations",
"B1": "condition ratings summary · Cat 1 · Cat 2 · Cat 3",
"B2": "overall opinion · key findings",
"B3": "further investigations · specialist reports",
"C1": "property type · construction · detached · cavity · timber frame",
"C2": "year built · approximate age · period",
"C3": "accommodation · bedrooms · bathrooms · storeys · room matrix",
"C4": "EPC · energy efficiency · double glazing",
"C5": "location · facilities · flood · radon · noise",
"D1": "chimney stacks · pots · flaunching · flashings · lean · condition rating",
"D2": "roof covering · slate · tile · felt · slipped tiles · moss · condition rating",
"D3": "gutters · downpipes · rainwater · hopper · leakage · condition rating",
"D4": "main walls · cavity · render · DPC · cracking · condition rating",
"D5": "windows · glazing · FENSA · frames · condition rating",
"D6": "outside doors · patio doors · entrance door · condition rating",
"D7": "conservatory · porch · glazing · condition rating",
"D8": "fascias · soffits · external joinery · condition rating",
"D9": "other outside elements · balconies · external stairs",
"E1": "roof structure · trusses · rafters · purlins · loft access · condition rating",
"E2": "ceilings · plaster · artex · cracking · condition rating",
"E3": "walls · partitions · damp · cracking · condition rating",
"E4": "floors · suspended · solid · springy · condition rating",
"E5": "fireplaces · chimney breasts · flues · hearth · condition rating",
"E6": "built-in kitchen · fitted wardrobes · cupboards · condition rating",
"E7": "staircase · skirting · architrave · internal doors · condition rating",
"E8": "bathroom fittings · sanitaryware · shower · WC · condition rating",
"E9": "cellar · basement · other inside · condition rating",
"F1": "electricity · consumer unit · wiring · EICR · condition rating",
"F2": "gas · oil · meter · pipework · Gas Safe · condition rating",
"F3": "water supply · stopcock · lead pipes · condition rating",
"F4": "heating · boiler · radiators · controls · condition rating",
"F5": "water heating · cylinder · combi · immersion · condition rating",
"F6": "drainage · manholes · sewers · condition rating",
"F7": "common services · shared utilities · flats only",
"G1": "garage · car port · door · condition rating",
"G2": "outbuildings · shed · workshop · condition rating",
"G3": "boundaries · garden · driveway · shared areas · condition rating",
"H1": "regulations · planning · listed building · conservation area",
"H2": "guarantees · NHBC · FENSA · warranties",
"H3": "tenure · lease · easements · other legal matters",
"I1": "structural movement · dampness · timber defects · building risks",
"I2": "flood · radon · mining · knotweed · ground risks",
"I3": "asbestos · fire safety · safety glass · people risks",
"I4": "other risks · contamination · hazards",
"J1": "insulation · loft · cavity · floor insulation",
"J2": "heating efficiency · boiler · heat pump",
"J3": "lighting · LED · natural light",
"J4": "ventilation · trickle vents · extract fans",
"J5": "general energy · solar · EPC improvements",
"K1": "surveyor declaration · signature · RICS · qualifications",
"L1": "quotations · next steps · recommended actions",
"M1": "terms of engagement · scope · fee · complaints",
"N1": "typical house diagram · illustration reference",
}
lines = ["const STATIC_L3_SECTIONS = ["]
for parent in CANONICAL_SCHEMA["sections"]:
gid = str(parent["id"])
for sub in parent.get("subsections") or []:
code = str(sub["id"])
title = str(sub["label"]).replace("'", "\\'")
hint = HINTS.get(code, title)
lines.append(
f" {{ code:'{code}', group:'{gid}', title:'{title}', hint:'{hint}' }},"
)
lines.append("];")
print("\n".join(lines))