Files
tm_back/internal/dashboard/entity.go
T
Mazyar 7a9de273bb
continuous-integration/drone/push Build is passing
Enhance dashboard statistics with TED notice tracking
- Added a new field, ScrapedTEDNotices, to the StatisticsLifetimeTotals struct to track the total number of TED notices scraped.
- Updated the Statistics method in the statistics repository to include a background process for retrieving total scraped TED notices, improving the accuracy of dashboard statistics.
- Introduced new methods in the Counter to increment and retrieve daily counts for scraped TED notices, ensuring reliable metrics for reporting.
- Modified the TEDScraper to increment the TED notice scraped counter upon successful import, enhancing the tracking of scraping activity.

This update improves the dashboard's statistics by providing detailed insights into TED notice scraping activities, contributing to better data visibility and reporting.
2026-06-30 23:28:12 +03:30

110 lines
3.6 KiB
Go

package dashboard
// SummaryResponse powers hero pills and stat cards.
type SummaryResponse struct {
TotalTenders int64 `json:"total_tenders"`
ActiveTenders int64 `json:"active_tenders"`
AwardedTenders int64 `json:"awarded_tenders"`
ExpiredTenders int64 `json:"expired_tenders"`
CancelledTenders int64 `json:"cancelled_tenders"`
ClosingSoon int64 `json:"closing_soon"`
TotalEstimatedValue float64 `json:"total_estimated_value"`
ValueCurrency string `json:"value_currency"`
GeneratedAt int64 `json:"generated_at"`
}
// TrendResponse powers the tender flow chart.
type TrendResponse struct {
Metric string `json:"metric"`
Days int `json:"days"`
Series []TrendPoint `json:"series"`
}
// TrendPoint is a single day in the trend series.
type TrendPoint struct {
Date string `json:"date"`
Count int64 `json:"count"`
}
// CountriesResponse powers the country distribution widget.
type CountriesResponse struct {
Total int64 `json:"total"`
Items []CountryItem `json:"items"`
OtherCount int64 `json:"other_count"`
}
// CountryItem is a country bucket in the distribution.
type CountryItem struct {
CountryCode string `json:"country_code"`
Count int64 `json:"count"`
}
// NoticeTypesResponse powers the notice type mix widget.
type NoticeTypesResponse struct {
Total int64 `json:"total"`
Items []NoticeTypeItem `json:"items"`
}
// NoticeTypeItem is a notice type bucket.
type NoticeTypeItem struct {
Type string `json:"type"`
Count int64 `json:"count"`
}
// ClosingSoonResponse powers the closing soon card.
type ClosingSoonResponse struct {
Items []ClosingSoonItem `json:"items"`
}
// ClosingSoonItem is a tender closing within the configured window.
type ClosingSoonItem struct {
ID string `json:"id"`
Title string `json:"title"`
CountryCode string `json:"country_code"`
BuyerName string `json:"buyer_name"`
SubmissionDeadline int64 `json:"submission_deadline"`
TenderDeadline int64 `json:"tender_deadline"`
Status string `json:"status"`
EstimatedValue float64 `json:"estimated_value"`
Currency string `json:"currency"`
}
// RecentResponse powers the recent tenders feed.
type RecentResponse struct {
Items []RecentItem `json:"items"`
NextCursor *string `json:"next_cursor"`
}
// RecentItem is a row in the recent tenders list.
type RecentItem struct {
ID string `json:"id"`
Title string `json:"title"`
CountryCode string `json:"country_code"`
Status string `json:"status"`
BuyerName string `json:"buyer_name"`
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"`
ScrapedTEDNotices int64 `json:"scraped_ted_notices"`
}