ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

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

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

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

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/opportunity_intelligence/service.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/opportunity_intelligence/service.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original

Recovered source transcript

package oppintel import ( "context" "errors" "strings" "time" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" "github.com/missionworkforce/missionmatch/internal/platform/tenant" ) // ErrNoDatabase is returned when no pool is configured (the handler maps it to 503). var ErrNoDatabase = errors.New("oppintel: no database configured") const ( defaultLimit = 100 maxLimit = 500 ) // planningNote is the standing label on every forecast record, so the UI and any export state plainly // that the row is planning data, not a posted solicitation. const planningNote = "Planning data subject to change" // Service reads the global opportunity_records catalog. Like the SAM opportunities reader it reads // straight off the pool (the catalog is public reference data outside RLS), never a tenant transaction. type Service struct{ db *tenant.DB } // NewService builds the service. db may be nil (then every call returns ErrNoDatabase, a 503). func NewService(db *tenant.DB) *Service { return &Service{db: db} } // Filters are the optional read filters. Empty slices mean no filter on that dimension. type Filters struct { Kinds []string NAICS []string Agencies []string States []string Limit int } // List returns normalized records matching the filters, soonest closing first. func (s *Service) List(ctx context.Context, f Filters) ([]View, error) { if !s.db.Ready() { return nil, ErrNoDatabase } limit := f.Limit if limit <= 0 { limit = defaultLimit } if limit > maxLimit { limit = maxLimit } pool, release, perr := s.acquirePool(ctx) if perr != nil { return nil, perr } defer release() rows, err := dbgen.New(pool).ListOpportunityRecords(ctx, dbgen.ListOpportunityRecordsParams{ Kinds: nilIfEmpty(f.Kinds), Naics: nilIfEmpty(f.NAICS), Agencies: upperAll(nilIfEmpty(f.Agencies)), States: upperAll(nilIfEmpty(f.States)), Lim: int32(limit), }) if err != nil { return nil, err } out := make([]View, 0, len(rows)) for _, r := range rows { out = append(out, toView(r)) } return out, nil } func toView(r dbgen.OpportunityRecord) View { v := View{ ID: r.ID.String(), Source: r.SourceName, SourceRecordID: r.SourceRecordID, Kind: r.RecordKind, IsPlanning: r.IsPlanning, Title: r.Title, Agency: r.Agency, SubAgency: r.SubAgency, NAICS: r.Naics, PSC: r.Psc, PlaceOfPerformance: placeStr(r.PopCity, r.PopState, r.PopCountry), SetAside: r.SetAside, ContractVehicle: r.ContractVehicle, ValueSource: r.ValueSource, IncumbentName: r.IncumbentName, UILink: r.UiLink, SyncedAt: r.SyncedAt.Format(time.RFC3339), } if r.IsPlanning { v.PlanningNote = planningNote } if r.EstimatedValue != nil { v.EstimatedValue = r.EstimatedValue.StringFixed(2) } if r.PostedDate.Valid { v.PostedDate = r.PostedDate.Time.Format("2006-01-02") } if r.ResponseDeadline != nil { v.ResponseDeadline = r.ResponseDeadline.Format(time.RFC3339) } if r.EstimatedAwardDate.Valid { v.EstimatedAwardDate = r.EstimatedAwardDate.Time.Format("2006-01-02") } return v } func placeStr(city, state, country string) string { parts := make([]string, 0, 3) for _, p := range []string{strings.TrimSpace(city), strings.TrimSpace(state), strings.TrimSpace(country)} { if p != "" { parts = append(parts, p) } } return strings.Join(parts, ", ") } func nilIfEmpty(s []string) []string { if len(s) == 0 { return nil } return s } func upperAll(s []string) []string { if s == nil { return nil } out := make([]string, len(s)) for i, v := range s { out[i] = strings.ToUpper(v) } return out }

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