ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/ontology/adapters/psc_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/ontology/adapters/psc_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/ontology/adapters/psc_test.go
Original SHA-256aa8c409e201bd4367b71528a51d77c5a352f13eacb349d58aba977d489de7bce
Git blob SHAde36c0d654069ddf7a311dfebc5bd4c8ac2a5cff
Reading-copy SHA-256aa8c409e201bd4367b71528a51d77c5a352f13eacb349d58aba977d489de7bce

Original source ↗

Every recorded occurrence

These 2 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/ontology/adapters/psc_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/ontology/adapters/psc_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original

Recovered source transcript

package adapters import ( "bytes" "context" "os" "path/filepath" "testing" "github.com/xuri/excelize/v2" "github.com/missionworkforce/missionmatch/internal/modules/ontology" ) // buildPSCXLSX mirrors the real PSC manual sheet, which carries several decoy columns that loosely match // CODE or NAME (a FULL NAME column and a Parent PSC Code column) plus an END DATE that marks expired codes. // A loose substring column match would pick the wrong columns; this fixture guards against that. func buildPSCXLSX(t *testing.T) []byte { t.Helper() f := excelize.NewFile() sh := f.GetSheetName(0) headers := []string{"PSC CODE", "PRODUCT AND SERVICE CODE NAME", "START DATE", "END DATE", "PRODUCT AND SERVICE CODE FULL NAME", "Parent PSC Code"} for i, h := range headers { cell, _ := excelize.CoordinatesToCellName(i+1, 1) _ = f.SetCellValue(sh, cell, h) } // rows: code, name, start, end, full name, parent data := [][]string{ {"R425", "Engineering and Technical Services", "2003-01-01", "", "Full R425", "R4"}, {"AC12", "National Defense R and D Services", "2003-01-01", "", "Full AC12", "AC"}, {"9999", "Expired Code", "2000-01-01", "2010-01-01", "Full 9999", "99"}, // expired, skipped {"1000", "", "2003-01-01", "", "Full 1000", "10"}, // empty name, skipped } for r, row := range data { for c, v := range row { cell, _ := excelize.CoordinatesToCellName(c+1, r+2) _ = f.SetCellValue(sh, cell, v) } } var buf bytes.Buffer if err := f.Write(&buf); err != nil { t.Fatalf("write xlsx: %v", err) } return buf.Bytes() } func TestParsePSC(t *testing.T) { recs, err := parsePSC(buildPSCXLSX(t)) if err != nil { t.Fatalf("parse: %v", err) } if len(recs) != 2 { t.Fatalf("want 2 active records (expired and empty name skipped), got %d", len(recs)) } if recs[0].Code != "R425" || recs[0].SourceRecordID != "R425" || recs[0].Kind != ontology.KindPSC { t.Fatalf("bad first record, expected the PSC CODE column not a decoy: %+v", recs[0]) } // The term must come from PRODUCT AND SERVICE CODE NAME, never the FULL NAME decoy column. if recs[0].Term != "Engineering and Technical Services" { t.Fatalf("term should be the CODE NAME column, got %q", recs[0].Term) } if recs[1].Code != "AC12" || recs[1].Term != "National Defense R and D Services" { t.Fatalf("bad second record: %+v", recs[1]) } } // TestPSCSourceLocalFile proves the adapter loads from a local file path, the air gapped GovCloud posture, // not only from an http URL. func TestPSCSourceLocalFile(t *testing.T) { path := filepath.Join(t.TempDir(), "psc.xlsx") if err := os.WriteFile(path, buildPSCXLSX(t), 0o600); err != nil { t.Fatalf("write fixture: %v", err) } src := NewPSCSource(path, nil) var got []ontology.VocabRecord if err := src.Fetch(context.Background(), func(r ontology.VocabRecord) error { got = append(got, r) return nil }); err != nil { t.Fatalf("fetch from local file: %v", err) } if len(got) != 2 || got[0].Code != "R425" { t.Fatalf("local file load: got %d records, first %+v", len(got), got) } }

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