RoadsInfographicModel

database_builder.RoadsInfographicModel()

Model for roads infographic configuration.

Attributes

categories : list[str], default=["Slight", "Minor", "Major", "Severe"]

List of road impact category names.

colors : list[str], default=["#e0f7fa", "#80deea", "#26c6da", "#006064"]

List of colors corresponding to each category.

icons : list[str], default=["walking_person", "car", "truck", "ambulance"]

List of icon names for each category.

users : list[str], default=["Pedestrians", "Cars", "Trucks", "Rescue vehicles"]

List of road user types for each category.

thresholds : list[float]

List of threshold values for categorizing road impacts.

field : str, default=_IMPACT_COLUMNS.inundation_depth

The database field name used for categorization.

unit : str

The unit of measurement for the field.

road_length_field : str, default=_IMPACT_COLUMNS.segment_length

The database field name containing road segment lengths.

Methods

Name Description
get_template Get a pre-configured template for roads infographics.
validate_lengths Validate that all list attributes have the same length.

get_template

database_builder.RoadsInfographicModel.get_template(
    unit_system: Literal['metric', 'imperial'],
)

Get a pre-configured template for roads infographics.

Parameters

unit_system : Literal['metric', 'imperial']

The unit system to use for thresholds and measurements.

Returns

: RoadsInfographicModel

Pre-configured roads infographic model.

validate_lengths

database_builder.RoadsInfographicModel.validate_lengths(v, info)

Validate that all list attributes have the same length.

Parameters

v : list[str]

The categories list.

info : Any

Field validation info containing all field values.

Returns

: list[str]

The validated categories list.

Raises

: ValueError

If list attributes don’t have the same length.

Back to top