Skip to content

Models & types

All request and response types are Pydantic models exported from the package top level:

python
from humanbaselines import (
    GeofenceSelections, RouteSelections, DepotSelections, DepotPin,
    ComputeResult, PerCellResult, RouteComputeResult, PerSegmentResult,
    DepotComputeResult, FiltersResponse, FilterDef, FilterOption,
    RegionsResponse, RegionInfo,
)

Generated from the API

These types are generated from the server's OpenAPI schema: the server's Pydantic models are the single source of truth, so the client can't drift from the API. filters() is the authoritative runtime source for valid values and defaults.

Request models (selections)

One per mode; pass an instance via selections= or just use keyword args. All use extra="forbid", so an unknown field raises locally before any request.

ModelUsed byNotable fields
GeofenceSelectionscomputeoutcome, severity, ego_vehicle, road_type, weather, light_condition, crash_year, denominator_vmt, robo_taxi_weighting, …
RouteSelectionscompute_routeoutcome, ego_vehicle (defaults ["combination"]), weather, driver_impairment, ci_method, …
DepotSelectionscompute_depot_routesame shape as RouteSelections
DepotPincompute_depot_routelat, lon
python
from humanbaselines import GeofenceSelections, Outcome
sel = GeofenceSelections(outcome=Outcome.fatal, road_type=["interstate"])
hb.compute(selections=sel)

Response models

ModelReturned byKey fields
ComputeResultcomputeN, D_miles, D_billions, rate, rate_low/high, rate_non_dyn, rate_dyn, multiplier, cells
PerCellResultComputeResult.cellss2_cell, count, vmt, mult_contrib
RouteComputeResultcompute_routeN, trip_miles, rate, rate_low/high, variance, segments
PerSegmentResultRouteComputeResult.segmentsroute, milepost, count, vmt, length_mi
DepotComputeResultcompute_depot_routeaccess_a, interstate, access_b, total, depot_a/b, vertices (permissive)
FiltersResponsefiltersmodes: dict[str, list[FilterDef]]
RegionsResponseregionsregions: list[RegionInfo], default_county

Enums

String enums for filter values; accept the enum member or its string value interchangeably:

Outcome, VehicleClass, RoadGroup, Tier3Mode, InTransport, RoboTaxiWeighting, MultiplierVmt, UnderReporting, WeatherFilter, LightFilter, DriverImpairment, CiMethod.

python
from humanbaselines import Outcome
hb.compute(outcome=Outcome.fatal)   # same as outcome="fatal"

The live option lists and per-mode defaults are on the Discovery page.

Derived statistics only. Attribute every published figure. Maintained by Valgo.