diff --git a/ted/scraper.go b/ted/scraper.go index 84e05b8..0c8c998 100644 --- a/ted/scraper.go +++ b/ted/scraper.go @@ -1196,34 +1196,29 @@ func (s *TEDScraper) generateTenderID(t *tender.Tender) string { var parts []string // Source (TED) - parts = append(parts, "TED") + parts = append(parts, "1") - // Buyer code (first 8 chars of buyer organization ID, or 8 zeros if not available) - buyerCode := "00000000" - if t.BuyerOrganization != nil && t.BuyerOrganization.ID != "" { - buyerCode = s.padOrTruncate(t.BuyerOrganization.ID, 8) - } - parts = append(parts, buyerCode) - - // TED code (Contract Notice ID, first 8 chars) + // TED code (Notice Publication ID, first 8 chars) tedCode := "00000000" - if t.ContractNoticeID != "" { - tedCode = s.padOrTruncate(t.ContractNoticeID, 8) + if t.NoticePublicationID != "" { + tedCode = s.padOrTruncate(t.NoticePublicationID, 8) } parts = append(parts, tedCode) + // Buyer code (first 8 chars of buyer organization ID, or 8 zeros if not available) + // buyerCode := "00000000" + // if t.BuyerOrganization != nil && t.BuyerOrganization.ID != "" { + // buyerCode = s.padOrTruncate(t.BuyerOrganization.ID, 8) + // } + // parts = append(parts, buyerCode) + // Date (YYYYMMDD format from issue date) - dateCode := s.unixMilliToDateString(t.IssueDate) - parts = append(parts, dateCode) + parts = append(parts, s.padOrTruncate(s.unixMilliToDateString(t.IssueDate), 4)) // Location code (country code + region code, padded to 6 chars) - locationCode := "000000" + locationCode := "EURO" if t.CountryCode != "" { - location := t.CountryCode - if t.RegionCode != "" { - location += t.RegionCode - } - locationCode = s.padOrTruncate(location, 6) + locationCode = t.CountryCode } parts = append(parts, locationCode)