package eeo import "sort" // Report is the publication oriented adverse impact result for one org. Every figure is computed from // real recorded outcomes joined to consented demographics; nothing is fabricated. type Report struct { GeneratedAt string `json:"generated_at"` DataFrom string `json:"data_from"` DataTo string `json:"data_to"` Source string `json:"source"` Method string `json:"method"` Selection AnalysisSection `json:"selection"` Screening AnalysisSection `json:"screening"` } // AnalysisSection is one stage of the analysis (selection or screening) cut three ways, with the // unknown count surfaced so a ratio over a sparse sample is not mistaken for a finding. type AnalysisSection struct { Stage string `json:"stage"` TotalN int `json:"total_n"` UnknownCount int `json:"unknown_count"` NoDemographicsCount int `json:"no_demographics_count"` ByGender []ImpactRow `json:"by_gender"` ByRace []ImpactRow `json:"by_race_ethnicity"` Intersectional []ImpactRow `json:"intersectional"` } // ImpactRow is one demographic group's selection rate and its four fifths impact ratio. Flagged is // true when the ratio is below 0.80. type ImpactRow struct { Group string `json:"group"` Considered int `json:"considered"` Selected int `json:"selected"` Rate string `json:"rate"` ImpactRatio string `json:"impact_ratio"` Flagged bool `json:"flagged"` } func sortRows(rows []ImpactRow) { sort.Slice(rows, func(i, j int) bool { return rows[i].Group < rows[j].Group }) }