from __future__ import annotations from datetime import datetime from pydantic import BaseModel, Field from app.schemas.common import ORMModel class EvaluationIndicatorCreate(BaseModel): mine_id: str | None = None parent_id: str | None = None code: str name: str dimension: str indicator_type: str = "quantitative" unit: str = "" formula: str = "" data_source: str = "" weight: float = 0 min_value: float | None = None max_value: float | None = None target_value: float | None = None weight_method: str = "static" enabled: bool = True sort_order: int = 0 config: dict = Field(default_factory=dict) class EvaluationIndicatorRead(ORMModel): id: str mine_id: str | None parent_id: str | None code: str name: str dimension: str indicator_type: str unit: str formula: str data_source: str weight: float min_value: float | None max_value: float | None target_value: float | None weight_method: str enabled: bool sort_order: int config: dict class EvaluationRunCreate(BaseModel): mine_id: str period_start: datetime | None = None period_end: datetime | None = None created_by: str = "" input_snapshot: dict = Field(default_factory=dict) use_agent: bool = True class EvaluationScoreRead(ORMModel): id: str run_id: str indicator_id: str raw_value: float | None score: float | None weighted_score: float | None weight: float | None level: str evidence: str metadata: dict = Field(validation_alias="metadata_json") class EvaluationRunRead(ORMModel): id: str mine_id: str run_no: str period_start: datetime | None period_end: datetime | None status: str total_score: float | None grade: str summary: str recommendations: list weight_snapshot: dict input_snapshot: dict model_output: dict started_at: datetime | None finished_at: datetime | None created_by: str created_at: datetime updated_at: datetime class EvaluationRunDetail(EvaluationRunRead): scores: list[EvaluationScoreRead] = Field(default_factory=list) class EvaluationRunRequest(BaseModel): mine_id: str period_start: datetime | None = None period_end: datetime | None = None requested_by: str = "" context: dict = Field(default_factory=dict)