feat(ontology): add source-grounded occupational taxonomy - #719
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
# Conflicts: # CHANGELOG.md # docs/adr/README.md # docs/product-requirements.md
| if len(neighbors) != 2: | ||
| raise ValueError( | ||
| f"interest type {subject} declares {len(neighbors)} RIASEC " | ||
| f"neighbors; the published hexagon gives every type exactly " | ||
| f"two" | ||
| ) |
There was a problem hiding this comment.
📝 Info: RIASEC neighbor count measures distinct labels
The two-neighbor guard in _interest_record_for counts distinct prefLabel strings in the neighbors set, not distinct adjacency edges. Two :riasecAdjacentTo targets sharing one label would collapse to a single neighbor. The current TTL uses distinct targets, so it never triggers.
Was this helpful? React with 👍 or 👎 to provide feedback.
* feat(ontology): publish complete 2018 SOC hierarchy * docs(gaps): record complete SOC hierarchy PR * docs: assign unique SOC hierarchy ADR number * docs: reserve unique SOC hierarchy ADR number * fix: publish ontology artifact digest * fix: publish parsed canonical ontology graph * fix: label generated Turtle artifact accurately * feat(ontology): publish complete O*NET 31.0 content model (#731) * feat(ontology): publish O*NET 31 content model * docs(gaps): refresh occupational PR gates * fix(ontology): sort O*NET outline numerically * fix(ontology): order O*NET outline numerically * fix(adr): reserve O*NET content model decision number * docs(adr): resolve O*NET publication boundary --------- Co-authored-by: Codex <codex@localhost> --------- Co-authored-by: Codex <codex@localhost>
| canonical_rdf = _write_serializations(graph, ontology_dir) | ||
| # N-Triples is a strict subset of Turtle. Publishing the canonical graph | ||
| # avoids joining independent Turtle documents whose prefix/base scopes | ||
| # are document-local, while retaining a deterministic .ttl representation. | ||
| (ontology_dir / "ontology.ttl").write_text(canonical_rdf, encoding="utf-8") |
There was a problem hiding this comment.
📝 Info: Published ontology.ttl is now flat N-Triples
The served ontology.ttl is no longer the source file but the canonical N-Triples serialization of the merged graph (build_ontology_site.py). It parses as Turtle but loses all prefixes, comments, and structure. This matches the updated ADR 0159 and the 'generated equivalent' label.
Was this helpful? React with 👍 or 👎 to provide feedback.
| graph = Graph() | ||
| graph.parse(_ONTOLOGY_PATH, format="turtle") | ||
| for fragment in _ONTOLOGY_FRAGMENT_PATHS: | ||
| graph.parse(fragment, format="turtle") |
There was a problem hiding this comment.
📝 Info: Large graph parsed at import and rendered fully
load_ontology() now parses ~1.3MB of generated fragments (4453 concepts) into the module-level ONTOLOGY at import. Publication additionally canonicalizes this graph and renders every concept as an HTML term card, so build time and page size grow substantially. Correctness is unaffected.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if counts != { | ||
| "major_group": 23, | ||
| "minor_group": 98, | ||
| "broad_occupation": 459, | ||
| "detailed_occupation": 867, | ||
| }: | ||
| raise ValueError(f"2018 SOC hierarchy has unexpected level counts: {counts}") | ||
| return tuple(sorted(records, key=lambda record: record.code)) |
There was a problem hiding this comment.
📝 Info: Read models hard-fail on any count drift
soc_classification_records and content_model_records assert exact counts ({23,98,459,867} and 3006) plus full parent closure on first call, raising ValueError on any drift. Intentional fail-closed design; any future source edit changing counts hard-fails all callers. Committed fragments currently match.
Was this helpful? React with 👍 or 👎 to provide feedback.
…edes #719) (#751) * feat(ontology): add source-grounded occupational taxonomy * docs: refresh exact-head product gap evidence * feat(ontology): preserve taxonomy source provenance * feat(ontology): expose taxonomy source records * fix(ontology): fail closed on duplicate SOC codes * fix: expose taxonomy source rights --------- Co-authored-by: Codex <codex@localhost>
Summary
Research corrections
Verification
uv run pytest tests -q(1367 passed, 12 skipped)uv run pytest tests/test_worker_function_taxonomy.py tests/test_io_taxonomy.py tests/test_ontology.py tests/test_ontology_shapes.py tests/test_ontology_site.py tests/test_public_docstrings.py -q(104 passedafter rebase)git diff --checkStacked on #709 exact observed head
8ef4090c; protected-main delivery remains unavailable until the stack and required independent review/checks complete.