mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 16:03:41 +00:00
Extends DashboardKPIs with total_abgerechnet/pending_abrechnung. Adds new GET /reports/dashboard/top-gutachter endpoint (admin-only). Frontend shows Abrechnungsstatus donut + Gutachter-Verteilung progress bars in a new third row, visible only to admins. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.3 KiB
Python
58 lines
1.3 KiB
Python
"""Pydantic schemas for dashboard KPIs, weekly data points, and report metadata."""
|
|
|
|
from datetime import date, datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class DashboardKPIs(BaseModel):
|
|
"""Top-level KPI summary for the dashboard."""
|
|
|
|
total_cases: int
|
|
pending_icd: int
|
|
pending_coding: int
|
|
total_gutachten: int
|
|
total_abgerechnet: int = 0
|
|
pending_abrechnung: int = 0
|
|
fallgruppen: dict[str, int] # e.g. {"onko": 123, "kardio": 45, ...}
|
|
|
|
|
|
class WeeklyDataPoint(BaseModel):
|
|
"""A single calendar-week row for the dashboard chart / table."""
|
|
|
|
kw: int
|
|
erstberatungen: int = 0
|
|
unterlagen: int = 0
|
|
ablehnungen: int = 0
|
|
keine_rm: int = 0
|
|
gutachten: int = 0
|
|
|
|
|
|
class DashboardResponse(BaseModel):
|
|
"""Combined dashboard payload: KPIs + weekly time-series."""
|
|
|
|
kpis: DashboardKPIs
|
|
prev_kpis: Optional[DashboardKPIs] = None
|
|
weekly: list[WeeklyDataPoint]
|
|
|
|
|
|
class ReportMeta(BaseModel):
|
|
"""Metadata for a generated weekly report (no file content)."""
|
|
|
|
id: int
|
|
jahr: int
|
|
kw: int
|
|
report_type: str = "gesamt"
|
|
report_date: date
|
|
generated_at: datetime
|
|
generated_by: Optional[int] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class ReportListResponse(BaseModel):
|
|
"""Paginated list of report metadata."""
|
|
|
|
items: list[ReportMeta]
|
|
total: int
|