Model/etl/epc/ValidationConfiguration.py
Michael Duong aa998b3b71 add notes
2023-12-08 20:07:48 +00:00

61 lines
No EOL
1.8 KiB
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]
}
}
EPCDifferenceRecordValidationConfiguration = {
}
EPCDifferenceRecordFixedDataValidationConfiguration = {
"PROPERTY_TYPE": {
"type": "string",
"acceptable_values": ["House", "Flat", "Bungalow", "Maisonette", "Park home", "Other"]
},
"BUILT_FORM": {
"type": "string",
"acceptable_values": ["Detached", "Semi-Detached", "End-Terrace", "Mid-Terrace", "Enclosed Mid-Terrace", "Enclosed End-Terrace", "Enclosed Detached", "Not applicable"]
},
"CONSITUENCY": {
"type": "string",
"acceptable_values": ["England", "Wales", "Scotland", "Northern Ireland"]
},
"NUMBER_HABITABLE_ROOMS": {
"type": "integer",
"range": [0, 100]
},
"NUMBER_HEATED_ROOMS": {
"type": "integer",
"range": [0, 100]
},
"FIXED_LIGHTING_OUTLETS_COUNT": {
"type": "integer",
"range": [0, 100]
},
"CONSTRUCTION_AGE_BAND": {
"type": "string",
"acceptable_values": []
}
}
DatasetValidationConfiguration = {
}