ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/matching/intelligence/intelligence.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/matching/intelligence/intelligence.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision39df94f92b2a33f852481fe1954dabed841524bb
Branchw0-aedt-compliance
Path or archive memberinternal/modules/matching/intelligence/intelligence.go
Original SHA-2561b101f0d392ab1ef7addd94298e99ddf4b6911d51866765998a5525b2223d475
Git blob SHAf01dfb54ec30a3a5ad5fd029e5c4ca87d36c98ec
Reading-copy SHA-2561b101f0d392ab1ef7addd94298e99ddf4b6911d51866765998a5525b2223d475

Original source ↗

Recovered source transcript

// Package intelligence derives the customer-facing screenMATCH™ "Mission Readiness" panels from the // pure engine output. It is PURE (no DB/IO/clock except an explicit asOf passed in) and adds NO new // scoring — every panel is a presentation/derivation of the same deterministic MatchResult, so the // AEDT explainability and reproducibility guarantees carry through unchanged. // // Panels (from the "Defining missionMATCH/screenMATCH" brief + screenMATCH User Guide): // - MissionReadiness : the centerpiece — operational status + the 6 named readiness categories. // - NextSteps : recommended actions from the band/gaps. // - BattleCard : strengths/gaps scouting view. // - ClearanceIntel : clearance intelligence layer (eligibility, investigation age, recency). // - ContractReadiness: satisfied requirement areas + risk areas. // - WinImpact : proposal-staffing win impact + reasons. package intelligence import ( "fmt" "strings" "time" "github.com/shopspring/decimal" "github.com/missionworkforce/missionmatch/internal/modules/matching/engine" ) var hundredVal = decimal.NewFromInt(100) // ---------- Mission Readiness (the centerpiece) ---------- // MissionReadiness rebadges the engine result into operational language. type MissionReadiness struct { Status string `json:"status"` // "Mission Ready" | "Review Required" | "Recruiting Required" StatusCode string `json:"status_code"` // "ready" | "review" | "recruiting" Score string `json:"score"` // "92.00" Band string `json:"band"` // green | yellow | red Categories []ReadinessCategory `json:"categories"` } // ReadinessCategory is one named readiness dimension (the User Guide §8 breakdown). type ReadinessCategory struct { Name string `json:"name"` // "Clearance Readiness" Score string `json:"score"` // "100.00" Weight string `json:"weight"` // "0.25" State string `json:"state"` // "ready" (>=90) | "partial" (75-89) | "gap" (<75) } // engine Trace component name -> operational readiness label. var categoryLabels = map[string]string{ "Clearance": "Clearance Readiness", "Skills": "Skills Readiness", "Certifications": "Certification Readiness", "CustomerExperience": "Customer Readiness", "Experience": "Experience Readiness", "LocationAvailability": "Availability Readiness", } // Readiness builds the Mission Readiness panel from a match result. func Readiness(res engine.MatchResult) MissionReadiness { cats := make([]ReadinessCategory, 0, len(res.Trace)) for _, c := range res.Trace { name := categoryLabels[c.Component] if name == "" { name = c.Component } cats = append(cats, ReadinessCategory{ Name: name, Score: c.Raw.StringFixed(2), Weight: c.Weight.String(), State: stateFor(c.Raw), }) } status, code := missionStatus(res.Band) return MissionReadiness{ Status: status, StatusCode: code, Score: res.Total.StringFixed(2), Band: res.Band.Code(), Categories: cats, } } // MissionStatusLabel is the operational status label for a band ("Mission Ready", etc.). func MissionStatusLabel(b engine.Band) string { l, _ := missionStatus(b); return l } func missionStatus(b engine.Band) (label, code string) { switch b { case engine.BandGreen: return "Mission Ready", "ready" case engine.BandYellow: return "Review Required", "review" default: return "Recruiting Required", "recruiting" } } // stateFor classifies a 0-100 sub-score using the same band thresholds as the total. func stateFor(score decimal.Decimal) string { switch { case score.GreaterThanOrEqual(engine.BandGreenMin): return "ready" case score.GreaterThanOrEqual(engine.BandYellowMin): return "partial" default: return "gap" } } // ---------- Recommended Next Steps ---------- // NextStep is a recommended action shown after evaluation. type NextStep struct { Action string `json:"action"` Reason string `json:"reason"` } // NextSteps recommends actions from the band (User Guide §12). func NextSteps(res engine.MatchResult) []NextStep { switch res.Band { case engine.BandGreen: return []NextStep{ {"Move to Candidate Slate", "Candidate is proposal ready."}, {"Add to Talent Pipeline", "Retain for future opportunities."}, } case engine.BandYellow: return []NextStep{ {"Request Interview", "Additional validation recommended."}, {"Review Gaps", "Resolve gaps before submission."}, {"Add to Talent Pipeline", "Suitable for future opportunities."}, } default: return []NextStep{ {"Recruit Additional Candidates", "Qualification gaps identified."}, {"Add to Talent Pipeline", "Reconsider for better-fit opportunities."}, } } } // ---------- Battle Card ---------- // BattleCard is the scouting-report view (User Guide §9). type BattleCard struct { Strengths []string `json:"strengths"` Gaps []string `json:"gaps"` } // BattleCardFor derives strengths (✓) and gaps (⚠) from the candidate + result. func BattleCardFor(c engine.Candidate, r engine.Requirement, res engine.MatchResult) BattleCard { var strengths []string if res.Clearance.GreaterThanOrEqual(hundredVal) && c.Clearance.Level >= engine.ClearanceConfidential { strengths = append(strengths, fmt.Sprintf("%s %s", c.Clearance.Level.String(), c.Clearance.Status.String())) } for _, m := range res.MatchedSkills { if m.Matched { strengths = append(strengths, m.RequiredSkillName) } } if res.CustomerExperience.GreaterThanOrEqual(hundredVal) && r.CustomerAgency != "" { strengths = append(strengths, fmt.Sprintf("%s experience", r.CustomerAgency)) } if r.RequiredYears > 0 && c.YearsExperience >= r.RequiredYears { strengths = append(strengths, fmt.Sprintf("Exceeds experience requirement (%d yrs)", c.YearsExperience)) } // Held certifications that the requirement asked for. held := lowerSet(c.Certifications) for _, rc := range r.RequiredCerts { if held[lower(rc)] { strengths = append(strengths, rc) } } gaps := append([]string{}, res.GapSummary...) // unmet mandatory items (empty slice, never null) return BattleCard{Strengths: dedupe(strengths), Gaps: gaps} } // ---------- Clearance Intelligence ---------- // ClearanceFacts is the clearance input (carries dates the engine deliberately omits). type ClearanceFacts struct { Level engine.ClearanceLevel Poly engine.Polygraph Status engine.ClearanceStatus GrantedAt *time.Time ExpiresAt *time.Time ReinvestigationDueAt *time.Time CustomerAgencies []string } // ClearanceIntel is the clearance intelligence layer (Evolution #6). type ClearanceIntel struct { Current string `json:"current"` // "TS/SCI" Status string `json:"status"` // "Active" SCIEligible bool `json:"sci_eligible"` // TS or above CIPolyEligible bool `json:"ci_poly_eligible"` FullScopePoly bool `json:"full_scope_poly"` Expired bool `json:"expired"` InvestigationAgeMonths *int `json:"investigation_age_months,omitempty"` ExpiresAt *string `json:"expires_at,omitempty"` ReinvestigationDueAt *string `json:"reinvestigation_due_at,omitempty"` RecentClassifiedSupport bool `json:"recent_classified_support"` } // Clearance derives the clearance intelligence as-of a date. func Clearance(f ClearanceFacts, asOf time.Time) ClearanceIntel { ci := ClearanceIntel{ Current: f.Level.String(), Status: f.Status.String(), SCIEligible: f.Level >= engine.ClearanceTopSecret, CIPolyEligible: f.Poly >= engine.PolyCI, FullScopePoly: f.Poly == engine.PolyFullScope, RecentClassifiedSupport: len(f.CustomerAgencies) > 0, } if f.ExpiresAt != nil { ci.Expired = f.ExpiresAt.Before(asOf) s := f.ExpiresAt.Format("2006-01-02") ci.ExpiresAt = &s } if f.Status == engine.StatusExpired { ci.Expired = true } if f.ReinvestigationDueAt != nil { s := f.ReinvestigationDueAt.Format("2006-01-02") ci.ReinvestigationDueAt = &s } if f.GrantedAt != nil { m := monthsBetween(*f.GrantedAt, asOf) ci.InvestigationAgeMonths = &m } return ci } // ---------- Contract Readiness ---------- // RequirementArea is one contract requirement category and whether the candidate satisfies it. type RequirementArea struct { Area string `json:"area"` Met bool `json:"met"` } // RiskArea is a flagged staffing risk. type RiskArea struct { Severity string `json:"severity"` // "warning" | "info" Message string `json:"message"` } // ContractReadiness lists satisfied requirement areas + risk areas (Evolution #3). type ContractReadiness struct { Areas []RequirementArea `json:"areas"` Risks []RiskArea `json:"risks"` } // Contract derives contract readiness. expiringWindow is how soon a clearance expiry is a risk. func Contract(c engine.Candidate, r engine.Requirement, res engine.MatchResult, f ClearanceFacts, asOf time.Time) ContractReadiness { areas := []RequirementArea{ {"Labor Category Requirements", res.Skills.GreaterThanOrEqual(engine.BandYellowMin)}, {"Clearance Requirements", res.Clearance.GreaterThanOrEqual(hundredVal)}, {"Certification Requirements", res.Certifications.GreaterThanOrEqual(hundredVal)}, {"Customer Experience Requirements", res.CustomerExperience.GreaterThanOrEqual(hundredVal)}, {"Availability Requirements", res.Location.GreaterThanOrEqual(engine.BandGreenMin)}, } risks := []RiskArea{} // empty slice, never null if f.ExpiresAt != nil { days := int(f.ExpiresAt.Sub(asOf).Hours() / 24) switch { case days < 0: risks = append(risks, RiskArea{"warning", "Clearance is expired."}) case days <= 90: risks = append(risks, RiskArea{"warning", fmt.Sprintf("Clearance expires in %d days.", days)}) } } if len(f.CustomerAgencies) == 0 { risks = append(risks, RiskArea{"warning", "No recorded classified/customer program support."}) } if r.RequiredYears > 0 && c.YearsExperience < r.RequiredYears { risks = append(risks, RiskArea{"info", fmt.Sprintf("Experience below requirement (%d of %d years).", c.YearsExperience, r.RequiredYears)}) } if f.ReinvestigationDueAt != nil && f.ReinvestigationDueAt.Before(asOf) { risks = append(risks, RiskArea{"warning", "Periodic reinvestigation is overdue."}) } return ContractReadiness{Areas: areas, Risks: risks} } // ---------- Win Impact ---------- // WinImpact is the proposal-staffing win impact (Evolution #2). type WinImpact struct { Level string `json:"level"` // "High Impact" | "Medium Impact" | "Low Impact" LevelCode string `json:"level_code"` // high | medium | low StaffingStrength string `json:"staffing_strength"` // "92.00" Reasons []string `json:"reasons"` } // Win derives the win impact + reasons. func Win(c engine.Candidate, r engine.Requirement, res engine.MatchResult) WinImpact { var reasons []string if c.Clearance.Level == engine.ClearanceTSSCI && c.Clearance.Status == engine.StatusActive { reasons = append(reasons, "Active TS/SCI") } if res.CustomerExperience.GreaterThanOrEqual(hundredVal) && r.CustomerAgency != "" { reasons = append(reasons, fmt.Sprintf("Prior %s / similar program experience", r.CustomerAgency)) } if r.KeyPersonnel && res.Band == engine.BandGreen { reasons = append(reasons, "Matches Key Personnel requirements") } if r.RequiredYears > 0 && c.YearsExperience > r.RequiredYears { reasons = append(reasons, "Exceeds required experience") } if res.Clearance.GreaterThanOrEqual(hundredVal) { reasons = append(reasons, "Meets clearance requirement") } level, code := "Low Impact", "low" switch res.Band { case engine.BandGreen: level, code = "High Impact", "high" case engine.BandYellow: level, code = "Medium Impact", "medium" } return WinImpact{Level: level, LevelCode: code, StaffingStrength: res.Total.StringFixed(2), Reasons: reasons} } // ---------- helpers ---------- // monthsBetween returns whole calendar months from a to b (>= 0). func monthsBetween(a, b time.Time) int { m := int(b.Year()-a.Year())*12 + int(b.Month()) - int(a.Month()) if b.Day() < a.Day() { m-- } if m < 0 { m = 0 } return m } func lower(s string) string { return strings.ToLower(strings.TrimSpace(s)) } func lowerSet(items []string) map[string]bool { m := make(map[string]bool, len(items)) for _, it := range items { m[lower(it)] = true } return m } func dedupe(items []string) []string { seen := make(map[string]bool, len(items)) out := make([]string, 0, len(items)) for _, it := range items { if !seen[it] { seen[it] = true out = append(out, it) } } return out }

Mathematical records from this source

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