// Package sourcing fetches candidate sourcing leads behind a small swappable Provider interface, so a // different people data provider can replace People Data Labs per client without a refactor. It has no // database dependency: it searches and normalizes; the import command (cmd/import-candidates) writes // the results into the tenant candidates table tagged external, with a compliance log row each. package sourcing import ( "context" "encoding/json" ) // SourcedPerson is a normalized sourcing lead, provider independent. Clearance is intentionally absent: // these providers do not carry clearance, and absence must be treated as unknown, never as a negative. type SourcedPerson struct { ExternalID string FullName string JobTitle string Role string Location string Skills []string Years int Emails []string // populated only when contact fields are included Phones []string // populated only when contact fields are included Raw json.RawMessage } // SearchQuery is the provider independent request. ESQuery is an Elasticsearch style query object. type SearchQuery struct { ESQuery map[string]any Size int } // Provider searches for sourcing leads. A 429 maps to ErrThrottled. type Provider interface { Search(ctx context.Context, q SearchQuery) ([]SourcedPerson, error) Name() string } // GalapagosSearch is the preset query for Galapagos: people in the United States with cleared IT and // cyber skills, located in Hawaii or New Mexico (Galapagos's performance states). It does not filter on // clearance, which these providers do not carry. Note: People Data Labs forbids minimum_should_match, // so a title OR skill OR remote union is not expressible; this uses an AND of country, cyber skills, // and the two states, which is the tightest Galapagos relevant slice the query model allows. func GalapagosSearch() map[string]any { return map[string]any{ "bool": map[string]any{ "must": []any{ map[string]any{"term": map[string]any{"location_country": "united states"}}, map[string]any{"terms": map[string]any{"skills": []string{ "cybersecurity", "rmf", "ato", "information assurance", "cloud security", "information security", "network security", "systems engineering", "security clearance", }}}, map[string]any{"terms": map[string]any{"location_region": []string{"hawaii", "new mexico"}}}, }, }, } }