ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/eeo/ranking.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/eeo/ranking.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision1e9249840a4302ec82e123b9c9cb6f75badea3e4
Branchmaster
Path or archive memberinternal/modules/eeo/ranking.go
Original SHA-256661b583b71debf501414933f12c483f0e7431708803777ed117056fa1955de7a
Git blob SHA52262517db9df82ee7060ee0af09fbed111c4dcb
Reading-copy SHA-256661b583b71debf501414933f12c483f0e7431708803777ed117056fa1955de7a

Original source ↗

Every recorded occurrence

These 15 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/eeo/ranking.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/eeo/ranking.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/eeo/ranking.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package eeo import ( "context" "github.com/jackc/pgx/v5" ) // AdverseImpactForSelection recomputes the selection stage four fifths analysis for a caller PROVIDED selection // set, instead of the recorded approve decision. It is how the display order re ranker's promotion gate checks // the four fifths ratio UNDER a challenger's ranking: the caller (running as the migrator, with NO demographic // access) computes which candidates a ranking would surface (the top of each slate) and passes ONLY their ids; // this method, through the compliance pool, joins those ids to the consented demographics and computes the // impact ratios. The ranking features never touch the eeo schema and the demographics never touch the ranking // path; only an id keyed selection set crosses. selected maps a candidate id to whether the ranking would // select that candidate. It runs inside a tenant tx so RLS scopes the slate membership to the caller's org and // the demographics stay reachable only through the compliance pool. func (s *Service) AdverseImpactForSelection(ctx context.Context, selected map[string]bool) (AnalysisSection, error) { if s.compliance == nil || s.compliance.Pool == nil { return AnalysisSection{}, ErrNoCompliance } var section AnalysisSection err := s.compliance.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error { rows, e := s.selectionCandidateRows(ctx, tx, selected) if e != nil { return e } noDemo, e := countQuery(ctx, tx, selectionNoDemoQuery) if e != nil { return e } section = analyze("selection (challenger ranking)", rows, noDemo) return nil }) if err != nil { return AnalysisSection{}, err } return section, nil } // selectionCandidateRows reads the consented demographics of every candidate with a decided slate membership in // the caller's org, keyed by candidate id, and marks each selected per the provided set (selection under the // challenger ranking), never the recorded decision. It is the ranking analogue of stageRows over selectionQuery. func (s *Service) selectionCandidateRows(ctx context.Context, tx pgx.Tx, selected map[string]bool) ([]candRow, error) { rows, err := tx.Query(ctx, selectionCandidatesQuery) if err != nil { return nil, err } defer rows.Close() var out []candRow for rows.Next() { var candidateID string var r candRow if err := rows.Scan(&candidateID, &r.gender, &r.race, &r.genderUnknown, &r.raceUnknown); err != nil { return nil, err } r.selected = selected[candidateID] out = append(out, r) } return out, rows.Err() } // selectionCandidatesQuery returns the latest consented demographics of each candidate with a decided slate // membership in the caller's org, plus the candidate id so the caller's ranking selection can be applied in Go. // It mirrors selectionQuery but leaves the selected flag to the caller (the challenger ranking) instead of the // recorded decision. RLS scopes slate_members to the org; eeo.candidate_demographics is compliance only. const selectionCandidatesQuery = ` WITH latest AS ( SELECT DISTINCT ON (candidate_id) candidate_id, COALESCE(NULLIF(gender, ''), 'unknown') AS gender, COALESCE(NULLIF(race_ethnicity, ''), 'unknown') AS race, (NULLIF(gender, '') IS NULL) AS gender_unknown, (NULLIF(race_ethnicity, '') IS NULL) AS race_unknown FROM eeo.candidate_demographics WHERE consent_given = true ORDER BY candidate_id, collected_at DESC ) SELECT l.candidate_id::text, l.gender, l.race, l.gender_unknown, l.race_unknown FROM latest l JOIN slate_members sm ON sm.candidate_id = l.candidate_id WHERE sm.decision IN ('approved', 'rejected') GROUP BY l.candidate_id, l.gender, l.race, l.gender_unknown, l.race_unknown` // MinImpactRatio returns the smallest four fifths impact ratio across every group in the section (gender, race, // and intersectional), ignoring the not applicable rows, so a caller can compare the fairness of two rankings // with one number. It returns 1.0 when the section has no comparable group (nothing to flag). A returned value // below 0.80 means at least one group is in adverse impact under this selection. func (a AnalysisSection) MinImpactRatio() float64 { min := 1.0 seen := false for _, group := range [][]ImpactRow{a.ByGender, a.ByRace, a.Intersectional} { for _, r := range group { if r.ImpactRatio == "n/a" || r.ImpactRatio == "" { continue } v := decimalOrZero(r.ImpactRatio) f, _ := v.Float64() if !seen || f < min { min = f seen = true } } } if !seen { return 1.0 } return min }

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