ImpactCategoriesModel
database_builder.ImpactCategoriesModel()Model for defining impact categories with associated colors, field, unit, and bins.
Attributes
categories : list[str], default=["Minor", "Major", "Severe"]-
List of impact category names.
colors : list[str], default=["#ffa500", "#ff0000", "#000000"]-
List of colors corresponding to each category.
field : str-
The database field name used for categorization.
unit : str-
The unit of measurement for the field.
bins : list[float]-
List of threshold values for binning the field values.
Methods
| Name | Description |
|---|---|
| validate_bins_length | Validate that bins list length is one less than categories list length. |
| validate_colors_length | Validate that colors list length matches categories list length. |
validate_bins_length
database_builder.ImpactCategoriesModel.validate_bins_length(bins, info)Validate that bins list length is one less than categories list length.
Parameters
Returns
Raises
: ValueError-
If bins length is not one less than categories length.
validate_colors_length
database_builder.ImpactCategoriesModel.validate_colors_length(colors, info)Validate that colors list length matches categories list length.
Parameters
Returns
Raises
: ValueError-
If colors length doesn’t match categories length.