97 lines
2.4 KiB
Python
97 lines
2.4 KiB
Python
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
from typing import Type
|
|
|
|
from sqlalchemy import Enum as SQLEnum
|
|
|
|
|
|
def sql_enum(enum_cls: Type[Enum], *, name: str) -> SQLEnum:
|
|
"""Build a SQLAlchemy Enum that maps using the enum member values."""
|
|
|
|
return SQLEnum(
|
|
enum_cls,
|
|
name=name,
|
|
create_type=False,
|
|
validate_strings=True,
|
|
values_callable=lambda enum_cls: [member.value for member in enum_cls],
|
|
)
|
|
|
|
|
|
class MiningOperationType(str, Enum):
|
|
"""Supported mining operation categories."""
|
|
|
|
OPEN_PIT = "open_pit"
|
|
UNDERGROUND = "underground"
|
|
IN_SITU_LEACH = "in_situ_leach"
|
|
PLACER = "placer"
|
|
QUARRY = "quarry"
|
|
MOUNTAINTOP_REMOVAL = "mountaintop_removal"
|
|
OTHER = "other"
|
|
|
|
|
|
class ScenarioStatus(str, Enum):
|
|
"""Lifecycle states for project scenarios."""
|
|
|
|
DRAFT = "draft"
|
|
ACTIVE = "active"
|
|
ARCHIVED = "archived"
|
|
|
|
|
|
class FinancialCategory(str, Enum):
|
|
"""Enumeration of cost and revenue classifications."""
|
|
|
|
CAPITAL_EXPENDITURE = "capex"
|
|
OPERATING_EXPENDITURE = "opex"
|
|
REVENUE = "revenue"
|
|
CONTINGENCY = "contingency"
|
|
OTHER = "other"
|
|
|
|
|
|
class DistributionType(str, Enum):
|
|
"""Supported stochastic distribution families for simulations."""
|
|
|
|
NORMAL = "normal"
|
|
TRIANGULAR = "triangular"
|
|
UNIFORM = "uniform"
|
|
LOGNORMAL = "lognormal"
|
|
CUSTOM = "custom"
|
|
|
|
|
|
class ResourceType(str, Enum):
|
|
"""Primary consumables and resources used in mining operations."""
|
|
|
|
DIESEL = "diesel"
|
|
ELECTRICITY = "electricity"
|
|
WATER = "water"
|
|
EXPLOSIVES = "explosives"
|
|
REAGENTS = "reagents"
|
|
LABOR = "labor"
|
|
EQUIPMENT_HOURS = "equipment_hours"
|
|
TAILINGS_CAPACITY = "tailings_capacity"
|
|
|
|
|
|
class CostBucket(str, Enum):
|
|
"""Granular cost buckets aligned with project accounting."""
|
|
|
|
CAPITAL_INITIAL = "capital_initial"
|
|
CAPITAL_SUSTAINING = "capital_sustaining"
|
|
OPERATING_FIXED = "operating_fixed"
|
|
OPERATING_VARIABLE = "operating_variable"
|
|
MAINTENANCE = "maintenance"
|
|
RECLAMATION = "reclamation"
|
|
ROYALTIES = "royalties"
|
|
GENERAL_ADMIN = "general_admin"
|
|
|
|
|
|
class StochasticVariable(str, Enum):
|
|
"""Domain variables that typically require probabilistic modelling."""
|
|
|
|
ORE_GRADE = "ore_grade"
|
|
RECOVERY_RATE = "recovery_rate"
|
|
METAL_PRICE = "metal_price"
|
|
OPERATING_COST = "operating_cost"
|
|
CAPITAL_COST = "capital_cost"
|
|
DISCOUNT_RATE = "discount_rate"
|
|
THROUGHPUT = "throughput"
|