File size: 5,199 Bytes
2a6c3b9
 
 
 
 
ed0742f
 
 
 
2a6c3b9
 
 
 
 
ed0742f
2a6c3b9
 
 
 
 
 
 
 
 
ed0742f
2a6c3b9
 
 
 
 
 
 
 
 
ed0742f
2a6c3b9
 
 
 
 
 
 
ed0742f
2a6c3b9
 
 
ed0742f
2a6c3b9
 
 
ed0742f
2a6c3b9
 
 
 
ed0742f
2a6c3b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed0742f
 
 
 
 
 
2a6c3b9
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""Generate STATIC_L3_SECTIONS for frontend/index.html."""

from __future__ import annotations

from backend.domain.rics_level3_schema import CANONICAL_SCHEMA
from backend.domain.section_scope import (
    PARENT_INTRO_SECTION_IDS,
    PARENT_STORAGE_PARENT_IDS,
)

HINTS = {
    "A": "surveyor 路 RICS 路 inspection date 路 weather 路 occupancy 路 related party",
    "B": "condition ratings summary 路 overall opinion 路 further investigations",
    "C": "property type 路 construction 路 year built 路 accommodation 路 EPC 路 location",
    "D": "external inspection 路 ground level 路 binoculars 路 access limitations",
    "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",
    "E": "internal inspection 路 access 路 furniture 路 floor coverings not lifted",
    "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",
    "F": "services inspection 路 meters 路 not tested 路 visual check",
    "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",
    "G": "grounds inspection 路 garden 路 boundaries 路 shared areas",
    "G1": "garage 路 car port 路 door 路 condition rating",
    "G2": "outbuildings 路 shed 路 workshop 路 condition rating",
    "G3": "boundaries 路 garden 路 driveway 路 shared areas 路 condition rating",
    "H": "legal introduction 路 solicitor enquiries 路 not a legal report",
    "H1": "regulations 路 planning 路 listed building 路 conservation area",
    "H2": "guarantees 路 NHBC 路 FENSA 路 warranties",
    "H3": "tenure 路 lease 路 easements 路 other legal matters",
    "I": "risks introduction 路 further investigation 路 summary of risks",
    "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",
    "J": "energy introduction 路 EPC 路 insulation overview",
    "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",
    "K": "surveyor declaration 路 signature 路 RICS 路 qualifications",
    "L": "quotations 路 next steps 路 recommended actions",
    "M": "terms of engagement 路 scope 路 fee 路 complaints",
    "N": "typical house diagram 路 illustration reference",
}

lines = ["const STATIC_L3_SECTIONS = ["]
for parent in CANONICAL_SCHEMA["sections"]:
    gid = str(parent["id"])
    if gid.upper() in PARENT_STORAGE_PARENT_IDS:
        title = str(parent["label"]).replace("'", "\\'")
        hint = HINTS.get(gid, title)
        lines.append(
            f"  {{ code:'{gid}', group:'{gid}', title:'{title}', hint:'{hint}' }},"
        )
        continue
    if gid.upper() in PARENT_INTRO_SECTION_IDS:
        title = str(parent["label"]).replace("'", "\\'")
        hint = HINTS.get(gid, title)
        lines.append(
            f"  {{ code:'{gid}', group:'{gid}', title:'{title}', hint:'{hint}' }},"
        )
    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))