insulation thickness can be string 🟩

This commit is contained in:
Daniel Roth 2026-04-15 14:29:03 +00:00
parent 160dec11b1
commit 2dd9b9ce84

View file

@ -17,7 +17,7 @@ class Floor(TypedDict):
class Roof(TypedDict, total=False):
construction: int # TODO: map to str
insulation_location: int # TODO: map to str
insulation_thickness_mm: float
insulation_thickness_mm: float | str
class BuildingPart(TypedDict):
@ -55,10 +55,14 @@ def _parse_int(value: Optional[str], field: str) -> int:
return int(value)
def _parse_thickness_mm(value: Optional[str]) -> Optional[float]:
def _parse_thickness_mm(value: Optional[str]) -> Optional[float | str]:
if value is None:
return None
return float(value.replace("mm", "").strip())
stripped = value.replace("mm", "").strip()
try:
return float(stripped)
except ValueError:
return stripped
def parse_rdsap(xml_string: str) -> SapPropertyDetails: