Refactor AI summarizer client initialization to include MongoDB manager and add statistics endpoint
- Updated `InitAISummarizerClient` to accept `mongoManager` for tracking translation success. - Introduced new `Statistics` endpoint in the dashboard to fetch scraping and translation statistics. - Enhanced `TranslationWorker` to utilize the new success counter for tracking successful translations. - Added necessary data structures and query forms for statistics reporting. This refactor improves the tracking of AI translation success and provides new insights through the dashboard statistics.
This commit is contained in:
@@ -85,3 +85,24 @@ type RecentItem struct {
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
PublicationDate int64 `json:"publication_date"`
|
||||
}
|
||||
|
||||
// StatisticsReportResponse powers the statistics and charts report.
|
||||
type StatisticsReportResponse struct {
|
||||
Days int `json:"days"`
|
||||
GeneratedAt int64 `json:"generated_at"`
|
||||
Daily StatisticsDailySeries `json:"daily"`
|
||||
Totals StatisticsLifetimeTotals `json:"totals"`
|
||||
}
|
||||
|
||||
// StatisticsDailySeries contains per-day chart series.
|
||||
type StatisticsDailySeries struct {
|
||||
ScrapedTED []TrendPoint `json:"scraped_ted"`
|
||||
ScrapedDocuments []TrendPoint `json:"scraped_documents"`
|
||||
TranslatedNotices []TrendPoint `json:"translated_notices"`
|
||||
}
|
||||
|
||||
// StatisticsLifetimeTotals contains all-time totals.
|
||||
type StatisticsLifetimeTotals struct {
|
||||
ScrapedDocuments int64 `json:"scraped_documents"`
|
||||
TranslatedTenders int64 `json:"translated_tenders"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user