Files
tm_back/ted/eform/notice_metadata.go
T
n.nakhostin 05c7eae8a2 Add TED Scraper Configuration and Cron Scheduler Implementation
- 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.
2025-09-30 16:03:53 +03:30

145 lines
7.1 KiB
Go

package eform
import "time"
// =====================================================
// NOTICE METADATA (Legacy - keeping for compatibility)
// =====================================================
// NoticeMetadata contains identification and publication information
type NoticeMetadata struct {
NoticeID string `json:"notice_id" xml:"notice_id" validate:"required,noticeIDFormat"`
NoticeType NoticeType `json:"notice_type" xml:"notice_type" validate:"required"`
NoticeVersion string `json:"notice_version" xml:"notice_version" validate:"required,semver"`
PublicationDate *time.Time `json:"publication_date,omitempty" xml:"publication_date,omitempty"`
DispatchDate time.Time `json:"dispatch_date" xml:"dispatch_date" validate:"required"`
Language LanguageCode `json:"language" xml:"language" validate:"required,iso639_1"`
TranslationLanguages []LanguageCode `json:"translation_languages,omitempty" xml:"translation_languages,omitempty" validate:"dive,iso639_1"`
LegalBasis LegalBasis `json:"legal_basis" xml:"legal_basis" validate:"required"`
PreviousNoticeID string `json:"previous_notice_id,omitempty" xml:"previous_notice_id,omitempty" validate:"omitempty,noticeIDFormat"`
ChangedNoticeID string `json:"changed_notice_id,omitempty" xml:"changed_notice_id,omitempty" validate:"omitempty,noticeIDFormat"`
CorrectionPrevious bool `json:"correction_previous" xml:"correction_previous"`
}
// NoticeType represents the eForms subtype identifier (1-40, E1-E5)
type NoticeType string
const (
// Planning notices (1-6)
NoticeTypePIN1 NoticeType = "1" // Prior Information Notice - standard
NoticeTypePIN2 NoticeType = "2" // Prior Information Notice - utilities
NoticeTypePIN3 NoticeType = "3" // Prior Information Notice - social
NoticeTypePINCallComp4 NoticeType = "4" // PIN as call for competition - standard
NoticeTypePINCallComp5 NoticeType = "5" // PIN as call for competition - utilities
NoticeTypePINCallComp6 NoticeType = "6" // PIN as call for competition - social
// Competition notices (7-14)
NoticeTypeCN7 NoticeType = "7" // Contract Notice - open/restricted
NoticeTypeCN8 NoticeType = "8" // Contract Notice - utilities
NoticeTypeCN9 NoticeType = "9" // Contract Notice - negotiated
NoticeTypeCN10 NoticeType = "10" // Contract Notice - competitive dialogue
NoticeTypeCN11 NoticeType = "11" // Contract Notice - innovation partnership
NoticeTypeCN12 NoticeType = "12" // Contract Notice - social services
NoticeTypeCN13 NoticeType = "13" // Contract Notice - concessions
NoticeTypeCN14 NoticeType = "14" // Contract Notice - design contest
// Direct award notices (15-24)
NoticeTypeCANDirect15 NoticeType = "15" // CAN without prior - direct award
NoticeTypeCANDirect16 NoticeType = "16" // CAN without prior - utilities
NoticeTypeCANDirect17 NoticeType = "17" // CAN without prior - social
NoticeTypeCANDirect18 NoticeType = "18" // CAN without prior - negotiated
NoticeTypeCANDirect19 NoticeType = "19" // CAN without prior - concessions
NoticeTypeCANDirect20 NoticeType = "20" // Voluntary ex-ante transparency - direct award
NoticeTypeCANDirect21 NoticeType = "21" // Voluntary ex-ante transparency - utilities
NoticeTypeCANDirect22 NoticeType = "22" // Voluntary ex-ante transparency - social
NoticeTypeCANDirect23 NoticeType = "23" // Voluntary ex-ante transparency - concessions
NoticeTypeCANDirect24 NoticeType = "24" // Voluntary ex-ante transparency - defence
// Result notices (25-35)
NoticeTypeCAN25 NoticeType = "25" // Contract Award Notice - standard
NoticeTypeCAN26 NoticeType = "26" // Contract Award Notice - utilities
NoticeTypeCAN27 NoticeType = "27" // Contract Award Notice - social
NoticeTypeCAN28 NoticeType = "28" // Contract Award Notice - concessions
NoticeTypeCAN29 NoticeType = "29" // Contract Award Notice - design contest results
NoticeTypeCAN30 NoticeType = "30" // Contract Award Notice - defence
NoticeTypeCAN31 NoticeType = "31" // Contract Award Notice - framework single
NoticeTypeCAN32 NoticeType = "32" // Contract Award Notice - DPS award
NoticeTypeCAN33 NoticeType = "33" // Contract Award Notice - modification
NoticeTypeCAN34 NoticeType = "34" // Contract Award Notice - completion
NoticeTypeCAN35 NoticeType = "35" // Contract Award Notice - quarterly DPS
// Modification notices (36-40)
NoticeTypeMod36 NoticeType = "36" // Contract Modification Notice - standard
NoticeTypeMod37 NoticeType = "37" // Contract Modification Notice - utilities
NoticeTypeMod38 NoticeType = "38" // Contract Modification Notice - social
NoticeTypeMod39 NoticeType = "39" // Contract Modification Notice - concessions
NoticeTypeMod40 NoticeType = "40" // Contract Modification Notice - defence
// Voluntary notices (E1-E5)
NoticeTypeVoluntaryE1 NoticeType = "E1" // Voluntary notice - below threshold
NoticeTypeVoluntaryE2 NoticeType = "E2" // Voluntary notice - modification
NoticeTypeVoluntaryE3 NoticeType = "E3" // Voluntary notice - contract completion
NoticeTypeVoluntaryE4 NoticeType = "E4" // Voluntary notice - concession award
NoticeTypeVoluntaryE5 NoticeType = "E5" // Voluntary notice - qualification system
)
// LegalBasis represents applicable EU directives
type LegalBasis string
const (
LegalBasisClassicDir LegalBasis = "32014L0024" // Directive 2014/24/EU (classic)
LegalBasisUtilitiesDir LegalBasis = "32014L0025" // Directive 2014/25/EU (utilities)
LegalBasisConcessionsDir LegalBasis = "32014L0023" // Directive 2014/23/EU (concessions)
LegalBasisDefenceDir LegalBasis = "32009L0081" // Directive 2009/81/EC (defence)
LegalBasisFinancialReg LegalBasis = "32018R1046" // Financial Regulation (EU institutions)
)
// LanguageCode represents ISO 639-1 language codes
type LanguageCode string
// IsPlanningNotice checks if notice is a planning/PIN notice
func (nt NoticeType) IsPlanningNotice() bool {
planningTypes := []NoticeType{
NoticeTypePIN1, NoticeTypePIN2, NoticeTypePIN3,
NoticeTypePINCallComp4, NoticeTypePINCallComp5, NoticeTypePINCallComp6,
}
for _, t := range planningTypes {
if nt == t {
return true
}
}
return false
}
// IsCompetitionNotice checks if notice is a competition/CN notice
func (nt NoticeType) IsCompetitionNotice() bool {
return nt >= NoticeTypeCN7 && nt <= NoticeTypeCN14
}
// IsResultNotice checks if notice is a result/CAN notice
func (nt NoticeType) IsResultNotice() bool {
return (nt >= NoticeTypeCANDirect15 && nt <= NoticeTypeCANDirect24) ||
(nt >= NoticeTypeCAN25 && nt <= NoticeTypeCAN35)
}
// IsModificationNotice checks if notice is a modification notice
func (nt NoticeType) IsModificationNotice() bool {
return nt >= NoticeTypeMod36 && nt <= NoticeTypeMod40
}
// IsVoluntaryNotice checks if notice is voluntary
func (nt NoticeType) IsVoluntaryNotice() bool {
voluntaryTypes := []NoticeType{
NoticeTypeVoluntaryE1, NoticeTypeVoluntaryE2, NoticeTypeVoluntaryE3,
NoticeTypeVoluntaryE4, NoticeTypeVoluntaryE5,
NoticeTypeCANDirect20, NoticeTypeCANDirect21, NoticeTypeCANDirect22,
NoticeTypeCANDirect23, NoticeTypeCANDirect24,
}
for _, t := range voluntaryTypes {
if nt == t {
return true
}
}
return false
}