Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/commandcenter/executive.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/commandcenter/executive.go |
| Original SHA-256 | f25cc8d8ea4cd314ba72a99efe30f97206b5c15413db2d7dd108a6b4f00695fe |
| Git blob SHA | a7be75b714646903ccf131964ec647fbb5498412 |
| Reading-copy SHA-256 | f25cc8d8ea4cd314ba72a99efe30f97206b5c15413db2d7dd108a6b4f00695fe |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/commandcenter/executive.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/commandcenter/executive.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓147 lines · 4.8 KB
package commandcenter
import (
"fmt"
"github.com/shopspring/decimal"
)
// ExecutiveCard is one executive intelligence card on the Workforce Command Center. Every card is
// backed by a real query over the org's own data; when the feeding data does not exist yet the
// card says so honestly (NoData true, DataNote naming exactly what feeds it), never a fake number.
type ExecutiveCard struct {
Key string `json:"key"`
Title string `json:"title"`
Value string `json:"value"`
Detail string `json:"detail"`
State string `json:"state"` // ok, watch, risk, empty
NoData bool `json:"no_data"`
DataNote string `json:"data_note,omitempty"`
}
// buildExecutiveCards derives the four executive cards from the assembled view plus the screening
// confidence counts. Pure: unit testable without a database.
func buildExecutiveCards(v View, greenCoveredReqs, activeReqs int64) []ExecutiveCard {
cards := make([]ExecutiveCard, 0, 4)
// Mission Readiness: the weighted coverage score already assembled.
mr := ExecutiveCard{Key: "mission_readiness", Title: "Mission Readiness"}
if v.Meta.Empty {
mr.NoData = true
mr.State = "empty"
mr.DataNote = "Feeds from your cleared workforce and active requirements. Add candidates and requirements to light this up."
} else {
mr.Value = v.MissionReadiness.Score
mr.Detail = v.MissionReadiness.Status
mr.State = bandToState(v.MissionReadiness.Band)
}
cards = append(cards, mr)
// Revenue at Risk: the exact W2 counted basis summed over the staffing gaps.
rar := ExecutiveCard{Key: "revenue_at_risk", Title: "Revenue at Risk"}
total := decimal.Zero
priced, unpriced, representative := 0, 0, false
for _, g := range v.StaffingGaps {
if g.ValueAtRisk != nil {
if d, err := decimal.NewFromString(*g.ValueAtRisk); err == nil {
total = total.Add(d)
}
}
priced += g.PricedOpportunities
unpriced += g.UnpricedOpportunities
representative = representative || g.ValueRepresentative
}
switch {
case v.Meta.Empty:
rar.NoData = true
rar.State = "empty"
rar.DataNote = "Feeds from dollar values on open opportunities joined to unfilled staffing gaps. Add opportunities and requirements to light this up."
case len(v.StaffingGaps) == 0:
rar.Value = "$0"
rar.Detail = "No unfilled staffing gaps expose revenue right now."
rar.State = "ok"
case priced == 0:
rar.NoData = true
rar.State = "empty"
rar.DataNote = "Feeds from dollar values on open opportunities joined to unfilled gaps. No impacted opportunity carries a value yet."
default:
rar.Value = "$" + total.StringFixed(0)
basis := fmt.Sprintf("Across %d priced opportunities; %d unpriced excluded.", priced, unpriced)
if representative {
basis += " Includes representative values."
}
rar.Detail = basis
rar.State = "risk"
if total.IsZero() {
rar.State = "ok"
}
}
cards = append(cards, rar)
// Growth Capacity: proposal ready bench beyond the currently unmet demand.
gc := ExecutiveCard{Key: "growth_capacity", Title: "Growth Capacity"}
unmet := 0
for _, g := range v.StaffingGaps {
unmet += g.Unmet
}
if v.Banner.TotalClearedWorkforce == 0 {
gc.NoData = true
gc.State = "empty"
gc.DataNote = "Feeds from proposal ready candidates measured against unmet requirement demand. Screen your bench to light this up."
} else {
surplus := v.Banner.ProposalReadyCandidates - unmet
if surplus < 0 {
surplus = 0
}
gc.Value = fmt.Sprintf("%d", surplus)
gc.Detail = fmt.Sprintf("Proposal ready candidates beyond current unmet demand (%d ready, %d unmet slots).",
v.Banner.ProposalReadyCandidates, unmet)
switch {
case surplus > 0:
gc.State = "ok"
case v.Banner.ProposalReadyCandidates > 0:
gc.State = "watch"
default:
gc.State = "risk"
}
}
cards = append(cards, gc)
// Staffing Confidence: how much of the open demand has at least one proposal ready screen.
sc := ExecutiveCard{Key: "staffing_confidence", Title: "Staffing Confidence"}
if activeReqs == 0 {
sc.NoData = true
sc.State = "empty"
sc.DataNote = "Feeds from stored screening evaluations against active requirements. Add requirements and screen candidates to light this up."
} else {
pct := decimal.NewFromInt(greenCoveredReqs).
Div(decimal.NewFromInt(activeReqs)).
Mul(decimal.NewFromInt(100)).Round(0)
sc.Value = pct.String() + "%"
sc.Detail = fmt.Sprintf("%d of %d active requirements have at least one proposal ready screen.",
greenCoveredReqs, activeReqs)
switch {
case pct.GreaterThanOrEqual(decimal.NewFromInt(75)):
sc.State = "ok"
case pct.GreaterThanOrEqual(decimal.NewFromInt(40)):
sc.State = "watch"
default:
sc.State = "risk"
}
}
cards = append(cards, sc)
return cards
}
func bandToState(band string) string {
switch band {
case "green":
return "ok"
case "yellow":
return "watch"
default:
return "risk"
}
}