ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / cmd/promote-ontology/main.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / cmd/promote-ontology/main.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision2178e7298d0e5d9af83afa12402fd587f0ba6ed8
Branchfeature/aioe-upgrade
Path or archive membercmd/promote-ontology/main.go
Original SHA-2565265b01b6d19d82ce4bbd00bd1a3f73acfe1723223cbc94c1af4f0321c6d781e
Git blob SHA8e6804c8551a95b144065389c08892aca14d5735
Reading-copy SHA-2565265b01b6d19d82ce4bbd00bd1a3f73acfe1723223cbc94c1af4f0321c6d781e

Original source ↗

Recovered source transcript

// Command promote-ontology promotes curated, mined, and O*NET technology terms into the global // skills table. It runs three idempotent INSERT ... ON CONFLICT DO NOTHING passes as the migrator // role and writes one AEDT audit row recording the counts. It carries NO org context because skills // is a global reference table outside Row Level Security. Safe to re-run at any time. // // Sources promoted: // - db/seed/cleared_skills.sql curated cleared workforce terms (source='curated') -- apply that // seed separately via psql; this command handles the ontology_terms and mission_spine paths. // - ontology_terms rows where term_kind='skill' and source_name='Corpus Mining'. // - mission_spine rows for version='v1', promoted as mission_area skills. // - ontology_terms rows sourced from O*NET Web Services technology tools filtered to cleared // relevant tech categories (development, operating system, network, security, database, etc.). // // Usage: // // promote-ontology [-dsn $MM_MIGRATOR_DATABASE_URL] package main import ( "context" "encoding/json" "flag" "log" "os" "github.com/jackc/pgx/v5/pgxpool" ) func main() { dsn := flag.String("dsn", os.Getenv("MM_MIGRATOR_DATABASE_URL"), "migrator DSN (defaults to MM_MIGRATOR_DATABASE_URL)") flag.Parse() if *dsn == "" { log.Fatal("promote-ontology: -dsn or MM_MIGRATOR_DATABASE_URL is required") } ctx := context.Background() pool, err := pgxpool.New(ctx, *dsn) if err != nil { log.Fatalf("promote-ontology: db connect: %v", err) } defer pool.Close() var nMined, nSpine, nOnet int64 // Pass 1: corpus mined skills from ontology_terms. tag, err := pool.Exec(ctx, ` INSERT INTO skills (name, category, source) SELECT DISTINCT ot.term, COALESCE(NULLIF(ot.category,''),'mined'), ot.source_name FROM ontology_terms ot WHERE ot.term_kind = 'skill' AND ot.source_name = 'Corpus Mining' AND NOT EXISTS (SELECT 1 FROM skills s WHERE lower(s.name) = lower(ot.term)) ON CONFLICT (name) DO NOTHING`) if err != nil { log.Fatalf("promote-ontology: corpus mined insert: %v", err) } nMined = tag.RowsAffected() log.Printf("promote-ontology: corpus mined skills inserted: %d", nMined) // Pass 2: mission_spine IC terms for version v1, promoted as mission_area skills. tag, err = pool.Exec(ctx, ` INSERT INTO skills (name, category, source) SELECT ms.term, 'mission_area', 'mission_spine' FROM mission_spine ms WHERE ms.version = 'v1' AND NOT EXISTS (SELECT 1 FROM skills s WHERE lower(s.name) = lower(ms.term)) ON CONFLICT (name) DO NOTHING`) if err != nil { log.Fatalf("promote-ontology: mission spine insert: %v", err) } nSpine = tag.RowsAffected() log.Printf("promote-ontology: mission spine terms inserted: %d", nSpine) // Pass 3: O*NET technology tools filtered to cleared tech relevant categories. // The regex matches category values that indicate development, OS, networking, security, // database, programming, configuration, virtualization, cloud, analytical, or data management // tool types. The soc_code column on skills stores the O*NET code for later crosswalk use. tag, err = pool.Exec(ctx, ` INSERT INTO skills (name, category, source, soc_code) SELECT DISTINCT ot.term, COALESCE(NULLIF(ot.category,''),'tool'), 'onet', ot.code FROM ontology_terms ot WHERE ot.source_name = 'O*NET Web Services' AND ot.source_record_id LIKE 'onet-tech:%' AND lower(ot.category) ~ 'development environment|web platform development|operating system|object or component|network monitoring|program testing|transaction security|data base management system|network security|virtual private network|cloud-based|configuration management|virtualiz' AND NOT EXISTS (SELECT 1 FROM skills s WHERE lower(s.name) = lower(ot.term)) ON CONFLICT (name) DO NOTHING`) if err != nil { log.Fatalf("promote-ontology: onet tech insert: %v", err) } nOnet = tag.RowsAffected() log.Printf("promote-ontology: onet tech tools inserted: %d", nOnet) total := nMined + nSpine + nOnet log.Printf("promote-ontology: total skills inserted across all sources: %d", total) // Write one AEDT audit row. No PII: skills are global reference data, not candidate or org data. payload, _ := json.Marshal(map[string]any{ "corpus_mined": nMined, "mission_spine": nSpine, "onet_tech": nOnet, "total": total, }) _, err = pool.Exec(ctx, `INSERT INTO audit_logs (organization_id, action, entity_type, new_values) VALUES (NULL, 'aedt.ontology.promoted', 'skills', $1)`, payload) if err != nil { log.Printf("promote-ontology: audit write warning (non-fatal): %v", err) } log.Printf("promote-ontology: DONE (mined=%d spine=%d onet=%d total=%d)", nMined, nSpine, nOnet, total) }

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