ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/awards/service.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/awards/service.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/awards/service.go
Original SHA-256169a4f27cebcaf7f2b7115676c88791ddc68ce406a694036289b9aa68fc0b0ff
Git blob SHAff031fc3fa38a89f224041c79ee9dd187da8e976
Reading-copy SHA-256169a4f27cebcaf7f2b7115676c88791ddc68ce406a694036289b9aa68fc0b0ff

Original source ↗

Every recorded occurrence

These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/modules/awards/service.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/awards/service.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original

Recovered source transcript

package awards import ( "context" "errors" "time" "github.com/jackc/pgx/v5/pgtype" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" "github.com/missionworkforce/missionmatch/internal/platform/tenant" ) // ErrNoDatabase is returned when no pool is configured. var ErrNoDatabase = errors.New("awards: no database configured") const ( defaultIncumbentLimit = 5 maxLimit = 50 ) // Service reads the cached awards catalog. type Service struct{ db *tenant.DB } // NewService builds the service. db may be nil (then calls return ErrNoDatabase). func NewService(db *tenant.DB) *Service { return &Service{db: db} } // Incumbents returns the largest comparable awards for the given NAICS codes, excluding Galapagos own // awards. Returns an empty slice when no NAICS is supplied. func (s *Service) Incumbents(ctx context.Context, naics []string, limit int) ([]Award, error) { if !s.db.Ready() { return nil, ErrNoDatabase } if len(naics) == 0 { return []Award{}, nil } pool, release, perr := s.acquirePool(ctx) if perr != nil { return nil, perr } defer release() rows, err := dbgen.New(pool).ListAwardsByNaics(ctx, dbgen.ListAwardsByNaicsParams{ Naics: naics, Lim: int32(clampLimit(limit, defaultIncumbentLimit)), }) if err != nil { return nil, err } return toViews(rows), nil } // Galapagos returns Galapagos own past performance, largest first. func (s *Service) Galapagos(ctx context.Context, limit int) ([]Award, error) { if !s.db.Ready() { return nil, ErrNoDatabase } pool, release, perr := s.acquirePool(ctx) if perr != nil { return nil, perr } defer release() rows, err := dbgen.New(pool).ListGalapagosAwards(ctx, int32(clampLimit(limit, 10))) if err != nil { return nil, err } return toViews(rows), nil } func clampLimit(v, def int) int { if v <= 0 { return def } if v > maxLimit { return maxLimit } return v } func toViews(rows []dbgen.UsaspendingAward) []Award { out := make([]Award, 0, len(rows)) for _, r := range rows { out = append(out, toView(r)) } return out } func toView(r dbgen.UsaspendingAward) Award { amount := "" if r.AwardAmount != nil { amount = r.AwardAmount.StringFixed(2) } return Award{ AwardUID: r.GeneratedInternalID, AwardID: r.AwardID, RecipientName: r.RecipientName, RecipientUEI: r.RecipientUei, AwardAmount: amount, AwardingAgency: r.AwardingAgency, AwardingSubAgency: r.AwardingSubAgency, POPStartDate: dateStr(r.PopStartDate), POPEndDate: dateStr(r.PopEndDate), NaicsCode: r.NaicsCode, NaicsDescription: r.NaicsDescription, Description: r.Description, IsGalapagos: r.IsGalapagos, Source: r.Source, SyncedAt: r.SyncedAt.Format(time.RFC3339), } } func dateStr(d pgtype.Date) string { if !d.Valid { return "" } return d.Time.Format("2006-01-02") }

Search equations, builds, manuscript text, and recovered sources.