Skip to content

Source enlisted AFSC data from the official DAFECD (versioned, as-of lookup)#51

Open
saturnflyer wants to merge 3 commits into
mainfrom
pdf-extraction-pipeline
Open

Source enlisted AFSC data from the official DAFECD (versioned, as-of lookup)#51
saturnflyer wants to merge 3 commits into
mainfrom
pdf-extraction-pipeline

Conversation

@saturnflyer

Copy link
Copy Markdown
Member

Summary

Moves the gem's enlisted AFSC data from Wikipedia-derived guesses to the authoritative DAFECD (Department of the Air Force Enlisted Classification Directory), and makes it version-aware.

  • Ruby 4.0.5.tool-versions, lockfile bundler, and CI matrix updated; suite green on 4.0.5.
  • Concrete-code lookup fixed — codes an app actually stores (e.g. 1A172Y, skill level 7 = Craftsman) now resolve. Previously only the X-placeholder form (1A1X2) worked; concrete codes returned nil.
  • Authoritative source — 136 enlisted specialties extracted deterministically from the DAFECD (31 Oct 25). Every emitted code is verified verbatim against the source (0 unverified). Titles de-glued (pdf-reader drops spaces) via a governed model step gated so only spacing/case may change — no letters. 1A1X2 now includes shredout Y = General, which Wikipedia lacked.
  • Versioned by document releasefind(code, as_of: date) resolves the directory in effect on a date (defaults to latest); every result carries effective_date. Releases are additive and independently diffable; only 2025-10-31 ships, structured to add future DAFECD/DAFOCD releases. Consumers can extend/override via the load path (DEC-004), including adding a whole new release.
  • Officer / RI unchanged — still Wikipedia-sourced; only enlisted moved (its names shift from sentence-case to the directory's Title Case).

Each phase was spec- and code-quality-reviewed; reviews caught (and fixed) a silent specialty-drop bug and a manifest-merge foot-gun. The anti-hallucination verification gate is real — it fails the build if a de-glued title drifts from its source.

Test plan

  • bundle exec rake (Minitest + StandardRB): 155 runs, 0 failures, clean
  • find("1A172Y") → name "General", specialty_name "Mobility Force Aviator", skill_level_name "Craftsman", effective_date 2025-10-31
  • find("1A172", as_of: "2000-01-01") → nil (predates the shipped release); invalid as_of → clear ArgumentError
  • find("11MX") (officer) and find("8A400") (RI) unchanged
  • Reproducible extraction: ruby bin/extract_afsc_from_pdf.rb "<DAFECD pdf>" (source PDFs are git-ignored; provenance in docs/plans/)

Follow-ups (not in this PR)

  • C.2 — rich prose (specialty summary / duties / qualifications) + lazy content tier
  • C.3 — officer (DAFOCD), RI/SDI, SEI, prefixes, Space Force (SFSC)
  • Remove the superseded WIP extractor tooling (lib/gov_codes/{pdf_extractor,claude_processor,yaml_merger}.rb) now replaced by the deterministic Dafecd::* pipeline
  • Later: the structured requirement graph (deferred by design)

@saturnflyer saturnflyer requested a review from a team as a code owner July 8, 2026 21:39
Pin the toolchain to Ruby 4.0.5 and add it to the CI matrix alongside
3.3.8 and 3.4.3.

Changed: Test against Ruby 4.0.5
Deterministic, offline pipeline that parses the DAFECD PDF into a
verified, specialty-keyed index: record splitting, header/shredout
parsing, a verification gate, and a governed title de-gluer whose
output is checked to differ from the source by whitespace/case only.
Requires pdf-reader (a dev dependency); never loaded by the runtime.
Source PDFs are git-ignored.
@saturnflyer saturnflyer force-pushed the pdf-extraction-pipeline branch from 9716f15 to 4580e0b Compare July 9, 2026 13:33
Replace the Wikipedia-derived enlisted data with the official DAF
Enlisted Classification Directory (31 Oct 2025), extracted verbatim.
Concrete skill-level codes now resolve, and lookups are versioned by
document release date (defaulting to the latest).

Added: Concrete skill-level AFSC code lookup (e.g. 1A172Y)
Added: Version-aware lookup via find(code, as_of:) with effective_date
Changed: Source enlisted AFSC data from the official DAFECD instead of Wikipedia
@saturnflyer saturnflyer force-pushed the pdf-extraction-pipeline branch from 4580e0b to 1cea6af Compare July 9, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant