05c7eae8a2
- Introduced a new configuration file for the TED scraper, defining database connection settings, logging preferences, and scraping parameters. - Implemented a CronScheduler to manage scheduled tasks for TED operations, utilizing the robfig/cron library for scheduling. - Added new entities and structures for handling TED XML data, including eForms and tender-related information, enhancing the scraper's functionality. - Updated the main application to initialize the TED scraper with the new configuration and set up graceful shutdown handling. - Removed the deprecated scraping implementation to streamline the codebase and focus on the new architecture.
55 lines
2.3 KiB
Go
55 lines
2.3 KiB
Go
package eform
|
|
|
|
// =====================================================
|
|
// AWARD CRITERIA
|
|
// =====================================================
|
|
|
|
// AwardCriteria defines how tenders will be evaluated
|
|
type AwardCriteria struct {
|
|
Type AwardCriteriaType `json:"type" xml:"type" validate:"required"`
|
|
PriceWeight *float64 `json:"price_weight,omitempty" xml:"price_weight,omitempty" validate:"omitempty,min=0,max=100"`
|
|
CriteriaStatement string `json:"criteria_statement,omitempty" xml:"criteria_statement,omitempty" validate:"max=10000"`
|
|
Criteria []AwardCriterion `json:"criteria,omitempty" xml:"criteria,omitempty" validate:"dive"`
|
|
CostCalculation string `json:"cost_calculation,omitempty" xml:"cost_calculation,omitempty" validate:"max=10000"`
|
|
}
|
|
|
|
// AwardCriteriaType represents the evaluation approach
|
|
type AwardCriteriaType string
|
|
|
|
const (
|
|
AwardTypePrice AwardCriteriaType = "price"
|
|
AwardTypeCost AwardCriteriaType = "cost"
|
|
AwardTypeQualPrice AwardCriteriaType = "qual-price"
|
|
)
|
|
|
|
// AwardCriterion represents an individual evaluation criterion
|
|
type AwardCriterion struct {
|
|
ID string `json:"id" xml:"id" validate:"required,acIDFormat"`
|
|
Name string `json:"name" xml:"name" validate:"required,max=200"`
|
|
Description string `json:"description,omitempty" xml:"description,omitempty" validate:"max=2000"`
|
|
Weight float64 `json:"weight" xml:"weight" validate:"required,min=0,max=100"`
|
|
Type AwardCriterionType `json:"type" xml:"type" validate:"required"`
|
|
SubCriteria []AwardCriterion `json:"sub_criteria,omitempty" xml:"sub_criteria,omitempty" validate:"dive"`
|
|
}
|
|
|
|
// AwardCriterionType represents the type of criterion
|
|
type AwardCriterionType string
|
|
|
|
const (
|
|
CriterionQuality AwardCriterionType = "quality"
|
|
CriterionCost AwardCriterionType = "cost"
|
|
CriterionPrice AwardCriterionType = "price"
|
|
CriterionSocial AwardCriterionType = "social"
|
|
CriterionEnvironmental AwardCriterionType = "environmental"
|
|
CriterionInnovative AwardCriterionType = "innovative"
|
|
)
|
|
|
|
// CalculateTotalAwardCriteriaWeight validates criteria weights sum to 100
|
|
func (ac *AwardCriteria) CalculateTotalAwardCriteriaWeight() float64 {
|
|
var total float64
|
|
for _, criterion := range ac.Criteria {
|
|
total += criterion.Weight
|
|
}
|
|
return total
|
|
}
|