brushline.tactical.access

Source-preserving road links, access windows, decisions, and the access plan.

Source-preserving access and road-status checks.

exception brushline.tactical.access.AccessError[source]

Bases: ValueError

Raised when access inputs are inconsistent.

class brushline.tactical.access.AccessPlan(*, schema_version: Literal['brushline.tactical-access.v1'] = 'brushline.tactical-access.v1', plan_id: str, instance_id: str, results: list[AccessResult], feasible: bool, total_route_m: Annotated[float, Ge(ge=0)], created_utc: datetime)[source]

Bases: BaseModel

An access plan.

Parameters:
  • schema_version ({"brushline.tactical-access.v1"}) – Schema version.

  • plan_id (str) – Plan id.

  • instance_id (str) – Instance id.

  • results (list of AccessResult) – Decisions.

  • feasible (bool) – All requested windows allowed.

  • total_route_m (float) – Total route length.

  • created_utc (datetime) – Timezone-aware time.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class brushline.tactical.access.AccessResult(*, window_id: str, allowed: bool, status: str, source: str, route_length_m: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], reason: str, caveats: list[str] = <factory>)[source]

Bases: BaseModel

One access decision.

Parameters:
  • window_id (str) – Window id.

  • allowed (bool) – Whether the action is allowed.

  • status (str) – Source status.

  • source (str) – Status source.

  • route_length_m (float) – Route length.

  • reason (str) – Explanation.

  • caveats (list of str) – Caveats.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class brushline.tactical.access.AccessWindow(*, window_id: Annotated[str, MinLen(min_length=1)], unit_id: Annotated[str, MinLen(min_length=1)], link_id: Annotated[str, MinLen(min_length=1)], year: Annotated[int, Ge(ge=1900), Le(le=2200)], season: Literal['spring', 'summer', 'fall', 'winter', 'any'])[source]

Bases: BaseModel

One access window.

Parameters:
  • window_id (str) – Window id.

  • unit_id (str) – Treatment unit.

  • link_id (str) – Road link.

  • year (int) – Year.

  • season (str) – Season.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Bases: BaseModel

One source-preserving road link.

Parameters:
  • link_id (str) – Link id.

  • source (str) – Source name.

  • status (str) – Open, restricted, closed, or unknown.

  • status_source (str) – Status source.

  • length_m (float) – Route length.

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(_RoadLink__context: object) → None[source]

Validate the source status label.

brushline.tactical.access.build_access_plan(*, plan_id: str, instance_id: str, windows: list[AccessWindow], links: list[RoadLink], created_utc: datetime | None = None) → AccessPlan[source]

Check access windows against source road status.

Parameters:
  • plan_id (str) – Plan id.

  • instance_id (str) – Instance id.

  • windows (list of AccessWindow) – Windows.

  • links (list of RoadLink) – Road links.

  • created_utc (datetime, optional) – Creation time.

Returns:

AccessPlan – Source-preserving decisions.