Model/etl/epc/ValidationConfiguration.py
2023-12-05 12:32:48 +00:00

23 lines
751 B
Python

"""
Specify the validation rules for each field in the differents record.
"""
def validate_walls_description(value):
if value not in ["Cavity", "Solid", "System built", "Timber frame", "Suspended timber", "Other"]:
raise ValueError("Walls description is not valid")
EPCRecordValidationConfiguration = {
"WALLS_DESCRIPTION": {
"type": "string",
"acceptable_values": ["Cavity", "Solid", "System built", "Timber frame", "Suspended timber", "Other"]
"function": validate_walls_description
},
"FLOOR_DESCRIPTION": {
"type": "string",
"acceptable_values": ["Solid", "Suspended", "Other"]
},
"ENERGY_CONSUMPTION_CURRENT": {
"type": "float",
"range": [0, 100]
}
}