brushline.tactical.resources
Contractor profiles, resource requests, cost lines, capacity checks, and the resource plan.
Contractor capacity, productivity, and cost build-up.
- class brushline.tactical.resources.ContractorProfile(*, contractor_id: Annotated[str, MinLen(min_length=1)], methods: Annotated[list[Literal['manual', 'mechanical', 'chemical', 'mowing', 'grazing', 'prescribed_fire', 'other']], MinLen(min_length=1)], crews: Annotated[int, Ge(ge=1)] = 1, machines: Annotated[int, Ge(ge=0)] = 0, rate_per_unit: Annotated[float, Ge(ge=0)], travel_cost_per_km: Annotated[float, Ge(ge=0)] = 0.0, supervision_rate: Annotated[float, Ge(ge=0), Le(le=1)] = 0.0, overhead_fraction: Annotated[float, Ge(ge=0), Le(le=1)] = 0.0, risk_fraction: Annotated[float, Ge(ge=0), Le(le=1)] = 0.0, annual_capacity_units: Annotated[float, Gt(gt=0)], currency: str = 'CAD')[source]
Bases:
BaseModelOne contractor/crew/machine profile.
- Parameters:
contractor_id (str) – Contractor id.
methods (list of str) – Methods offered.
crews (int) – Crew count.
machines (int) – Machine count.
rate_per_unit (float) – Base rate per capacity unit.
travel_cost_per_km (float) – Travel cost per kilometre.
supervision_rate (float) – Supervision fraction of base cost.
overhead_fraction (float) – Overhead fraction.
risk_fraction (float) – Risk fraction of base cost.
annual_capacity_units (float) – Annual capacity units.
currency (str) – Currency.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class brushline.tactical.resources.CostLine(*, label: str, amount: Annotated[float, Ge(ge=0)], source: str)[source]
Bases:
BaseModelOne cost build-up line.
- Parameters:
label (str) – Label.
amount (float) – Amount.
source (str) – Source.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- exception brushline.tactical.resources.ResourceError[source]
Bases:
ValueErrorRaised when resource inputs are inconsistent.
- class brushline.tactical.resources.ResourcePlan(*, schema_version: ~typing.Literal['brushline.tactical-resources.v1'] = 'brushline.tactical-resources.v1', plan_id: str, instance_id: str, requests: list[~brushline.tactical.resources.ResourceRequest], lines: list[~brushline.tactical.resources.CostLine], total_cost: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], by_contractor: dict[str, float], by_year: dict[int, float], feasible: bool, violations: list[~brushline.tactical.resources.ResourceViolation] = <factory>, created_utc: ~datetime.datetime)[source]
Bases:
BaseModelA contractor/resource cost plan.
- Parameters:
schema_version ({"brushline.tactical-resources.v1"}) – Schema version.
plan_id (str) – Plan id.
instance_id (str) – Instance id.
requests (list of ResourceRequest) – Requests.
lines (list of CostLine) – Cost lines.
total_cost (float) – Total cost.
by_contractor (dict of str to float) – Cost by contractor.
by_year (dict of int to float) – Cost by year.
feasible (bool) – Capacity/method satisfied.
violations (list of ResourceViolation) – Violations.
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.resources.ResourceRequest(*, request_id: Annotated[str, MinLen(min_length=1)], contractor_id: Annotated[str, MinLen(min_length=1)], method: Literal['manual', 'mechanical', 'chemical', 'mowing', 'grazing', 'prescribed_fire', 'other'], year: Annotated[int, Ge(ge=1900), Le(le=2200)], capacity_units: Annotated[float, Gt(gt=0)], travel_km: Annotated[float, Ge(ge=0)] = 0.0)[source]
Bases:
BaseModelOne contractor request.
- Parameters:
request_id (str) – Request id.
contractor_id (str) – Contractor id.
method (str) – Method.
year (int) – Year.
capacity_units (float) – Capacity units.
travel_km (float) – Travel distance.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class brushline.tactical.resources.ResourceViolation(*, code: str, message: str, request_id: str | None = None)[source]
Bases:
BaseModelOne resource violation.
- Parameters:
code (str) – Code.
message (str) – Explanation.
request_id (str or None) – Request.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.tactical.resources.build_resource_plan(*, plan_id: str, instance_id: str, requests: list[ResourceRequest], profiles: list[ContractorProfile], created_utc: datetime | None = None) ResourcePlan[source]
Build capacity and cost evidence for contractor requests.
- Parameters:
plan_id (str) – Plan id.
instance_id (str) – Instance id.
requests (list of ResourceRequest) – Requests.
profiles (list of ContractorProfile) – Profiles.
created_utc (datetime, optional) – Creation time.
- Returns:
ResourcePlan – Cost lines and feasibility.