55 lines
972 B
Python
55 lines
972 B
Python
|
|
from decimal import Decimal
|
||
|
|
|
||
|
|
from pydantic import BaseModel
|
||
|
|
|
||
|
|
|
||
|
|
class CountByName(BaseModel):
|
||
|
|
name: str
|
||
|
|
count: int
|
||
|
|
|
||
|
|
|
||
|
|
class CountByMonth(BaseModel):
|
||
|
|
month: str # YYYY-MM
|
||
|
|
count: int
|
||
|
|
|
||
|
|
|
||
|
|
class CostByMonth(BaseModel):
|
||
|
|
month: str
|
||
|
|
labor: Decimal
|
||
|
|
material: Decimal
|
||
|
|
service: Decimal
|
||
|
|
other: Decimal
|
||
|
|
total: Decimal
|
||
|
|
|
||
|
|
|
||
|
|
class AgingBucket(BaseModel):
|
||
|
|
bucket: str
|
||
|
|
count: int
|
||
|
|
|
||
|
|
|
||
|
|
class StageCycleTime(BaseModel):
|
||
|
|
stage: str
|
||
|
|
stage_label: str
|
||
|
|
avg_days: float
|
||
|
|
samples: int
|
||
|
|
|
||
|
|
|
||
|
|
class TopJob(BaseModel):
|
||
|
|
job_number: str
|
||
|
|
count: int
|
||
|
|
|
||
|
|
|
||
|
|
class ReportsSummaryOut(BaseModel):
|
||
|
|
total_ncrs: int
|
||
|
|
open_ncrs: int
|
||
|
|
closed_ncrs: int
|
||
|
|
total_cost: Decimal
|
||
|
|
by_department: list[CountByName]
|
||
|
|
by_category: list[CountByName]
|
||
|
|
by_month: list[CountByMonth]
|
||
|
|
cost_over_time: list[CostByMonth]
|
||
|
|
aging: list[AgingBucket]
|
||
|
|
cycle_times: list[StageCycleTime]
|
||
|
|
end_to_end_avg_days: float | None
|
||
|
|
top_jobs: list[TopJob]
|