🎯 Obiettivo
Implementare un servizio dedicato per calcolare KPI e statistiche aggregate mostrate nella Dashboard del Coordinatore.
📋 Contesto
La Dashboard (#50) richiede dati aggregati che non sono semplici query su singole entità:
- Numero pazienti totali
- Numero progetti attivi/sospesi/completati/deceased
- Numero educatori operativi
- Percentuale visite completate vs schedulate
- Andamento visite mensile (serie temporale)
- Top N educatori per numero visite registrate
Attualmente manca un servizio dedicato per orchestrare queste query e preparare i DTO per la Dashboard.
🎯 Servizio da Implementare
IReportingService + ReportingService
Metodi principali (proposta):
public interface IReportingService
{
// KPI Cards
Task<DashboardKpiDto> GetDashboardKpiAsync(CancellationToken ct = default);
// Grafici andamento
Task<VisitTrendDto> GetVisitTrendAsync(DateTime from, DateTime to, CancellationToken ct = default);
// Classifiche
Task<IReadOnlyList<TopEducatorDto>> GetTopEducatorsAsync(int count, DateTime? from = null, DateTime? to = null, CancellationToken ct = default);
// Report dettagliati (futuri)
Task<PatientStatisticsDto> GetPatientStatisticsAsync(Guid patientId, CancellationToken ct = default);
Task<EducatorStatisticsDto> GetEducatorStatisticsAsync(Guid educatorId, CancellationToken ct = default);
}
public record DashboardKpiDto(
int TotalPatients,
int ActiveProjects,
int SuspendedProjects,
int CompletedProjects,
int DeceasedProjects,
int OperationalEducators,
int ScheduledVisitsThisMonth,
int CompletedVisitsThisMonth,
decimal CompletionRate
);
public record VisitTrendDto(
DateTime PeriodStart,
DateTime PeriodEnd,
IReadOnlyList<VisitDataPoint> DataPoints
);
public record VisitDataPoint(DateTime Date, int Scheduled, int Completed, int Missed);
public record TopEducatorDto(
Guid EducatorId,
string FullName,
int VisitsRegistered,
int ActiveProjects
);
📋 Tasks
✅ Acceptance Criteria
🔗 Riferimenti
CLUSTER: Domain & Data (gap 5.1)
FASE: 2 - Core Business
PRIORITÀ: 🟡 ALTA
DIPENDENZE: #72, #73
BLOCKING: Dashboard (#50) necessita di dati aggregati
🎯 Obiettivo
Implementare un servizio dedicato per calcolare KPI e statistiche aggregate mostrate nella Dashboard del Coordinatore.
📋 Contesto
La Dashboard (#50) richiede dati aggregati che non sono semplici query su singole entità:
Attualmente manca un servizio dedicato per orchestrare queste query e preparare i DTO per la Dashboard.
🎯 Servizio da Implementare
IReportingService+ReportingServiceMetodi principali (proposta):
📋 Tasks
IReportingServiceinPTRP.Services/Interfaces/PTRP.Models/DTOs/o namespace dedicatoReportingServiceinPTRP.Services/DashboardViewModel(FASE 2 - Core Features: Dashboard Coordinatore con KPI Cards #50)✅ Acceptance Criteria
GetDashboardKpiAsyncrestituisce tutti i KPI richiesti dalla DashboardGetVisitTrendAsyncgenera serie temporale per grafico andamento visiteGetTopEducatorsAsyncrestituisce classifica educatori ordinata per numero visiteGetDashboardKpiAsync)🔗 Riferimenti
CLUSTER: Domain & Data (gap 5.1)
FASE: 2 - Core Business
PRIORITÀ: 🟡 ALTA
DIPENDENZE: #72, #73
BLOCKING: Dashboard (#50) necessita di dati aggregati