brushline.tactical.fhops

The optional FHOPS boundary, request mapping, dry-run productivity/cost, and result model.

Optional FHOPS boundary and deterministic dry-run adapter.

class brushline.tactical.fhops.FhopsBoundary(*, package: str = 'fhops', pinned_version: str = '1.1.0b1', optional: bool = True, capabilities: list[str] = <factory>)[source]

Bases: BaseModel

The optional FHOPS boundary manifest.

Parameters:
  • package (str) – Package name.

  • pinned_version (str) – Supported version.

  • optional (bool) – Whether the dependency is optional.

  • capabilities (list of str) – Supported mapping capabilities.

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

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

class brushline.tactical.fhops.FhopsConfig(*, units_per_machine_hour: Annotated[float, Gt(gt=0)] = 0.25, cost_per_machine_hour: Annotated[float, Ge(ge=0)] = 180.0, move_cost: Annotated[float, Ge(ge=0)] = 100.0, currency: str = 'CAD')[source]

Bases: BaseModel

Dry-run productivity and cost settings.

Parameters:
  • units_per_machine_hour (float) – Productivity per machine hour.

  • cost_per_machine_hour (float) – Cost per machine hour.

  • move_cost (float) – Fixed move cost.

  • currency (str) – Currency.

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

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

exception brushline.tactical.fhops.FhopsError[source]

Bases: ValueError

Raised when the FHOPS boundary is inconsistent.

class brushline.tactical.fhops.FhopsRequest(*, unit_id: Annotated[str, MinLen(min_length=1)], action_id: Annotated[str, MinLen(min_length=1)], area_ha: Annotated[float, Gt(gt=0)], method: str, machines: Annotated[int, Ge(ge=1)], shift_hours: Annotated[float, Gt(gt=0), Le(le=24)], days: Annotated[int, Ge(ge=1)])[source]

Bases: BaseModel

A FHOPS scenario request for one treatment unit.

Parameters:
  • unit_id (str) – Treatment unit.

  • action_id (str) – Source action.

  • area_ha (float) – Area.

  • method (str) – Method.

  • machines (int) – Machine count.

  • shift_hours (float) – Shift hours.

  • days (int) – Planned days.

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

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

class brushline.tactical.fhops.FhopsResult(*, schema_version: ~typing.Literal['brushline.tactical-fhops.v1'] = 'brushline.tactical-fhops.v1', action_id: str, unit_id: str, status: str, machine_hours: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], productivity_units_per_day: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], total_cost: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], notes: list[str] = <factory>, created_utc: ~datetime.datetime)[source]

Bases: BaseModel

A normalized FHOPS or dry-run result.

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

  • action_id (str) – Source action.

  • unit_id (str) – Unit.

  • status ({"dry_run", "live", "unavailable"}) – Result status.

  • machine_hours (float) – Machine hours.

  • productivity_units_per_day (float) – Units per day.

  • total_cost (float) – Cost.

  • notes (list of str) – Notes/caveats.

  • 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].

brushline.tactical.fhops.dry_run(request: FhopsRequest, config: FhopsConfig | None = None, *, created_utc: datetime | None = None) → FhopsResult[source]

Run the deterministic dry-run productivity/cost model.

Parameters:
  • request (FhopsRequest) – Request.

  • config (FhopsConfig, optional) – Settings.

  • created_utc (datetime, optional) – Creation time.

Returns:

FhopsResult – Dry-run result.

brushline.tactical.fhops.fhops_version() → str[source]

Return the installed FHOPS version or not-installed.

Returns:

str – Version.

brushline.tactical.fhops.request_from_action(action: TacticalAction, *, area_ha: float, machines: int = 1, shift_hours: float = 8.0, days: int = 1) → FhopsRequest[source]

Map a tactical action to a FHOPS request.

Parameters:
  • action (TacticalAction) – Tactical action.

  • area_ha (float) – Area.

  • machines (int, optional) – Machine count.

  • shift_hours (float, optional) – Shift hours.

  • days (int, optional) – Days.

Returns:

FhopsRequest – Request.