SA-753/new release with complete socmeta#53
Merged
Conversation
- stop using parent-fallback metadata for titles, descriptions, qualifications and tasks
- require an exact SOC code match and return an error when metadata is missing
- assert code_meta matches the matched unit code and is null when SOC metadata is missing
6c85e5b to
62871f8
Compare
ivyONS
approved these changes
Jun 23, 2026
ivyONS
reviewed
Jun 23, 2026
| node.tasks = tasks_list | ||
| meta = soc_meta.get_meta_by_code_exact(code) | ||
| if "error" in meta: | ||
| node.qualifications = "" |
There was a problem hiding this comment.
Can we also retrieve the description into the node metadata?
(we may choose not to do it as part of this PR, because at some point we will want to load all this meta from xls instead anyway)
Contributor
Author
There was a problem hiding this comment.
Yes group_description is already populated on hierarchy nodes from SocMeta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Pull Request Template
✨ Summary
Release
v0.1.6ofsoc-classification-librarywith the full in-codeSOCmetamap from SOC 2020 Volume 1 and removal of silent parent-group fallback inSocMeta.get_meta_by_code().Previously,
v0.1.5shipped a stub metadata file (~13 entries). Missing unit codes silently fell back to major-group text, so lookup and classification appeared to work but returned broad parent descriptions instead of unit-level SOC 2020 detail.📜 Changes Introduced
Expanded
src/occupational_classification/meta/soc_meta.pyto the full SOC 2020 Volume 1 in-code map (~550 entries).Removed silent parent fallback from
SocMeta.get_meta_by_code()— exact match only, returns{"error": ...}on miss.get_meta_by_code_exact()now delegates toget_meta_by_code()(same behaviour).SOCLookupuses exact metadata lookup forcode_metaand all hierarchy levels.soc_hierarchyuses exact metadata lookup; missing entries get empty fields instead of parent substitution.Version bump to
0.1.6inpyproject.tomlandCHANGELOG.md.Added
tests/test_soc_meta.pyand extended lookup tests for unit-level metadata and missing-code behaviour.Feature implementation (feat:) / bug fix (fix:) / refactoring (chore:) / documentation (docs:) / testing (test:)
Updates to tests and/or documentation
Terraform changes (if applicable) - N/A
✅ Checklist
🔍 How to Test
1) Library unit tests
From
soc-classification-libraryrepo root:Observed on this branch: 61 passed.
Focused SA-753 checks:
2) Library spot-check (no parent fallback)
Expected:
1111returns unit-level metadata (codeis1111, not major group1).9999returns an error dict (no parent fallback).code_meta.codematches matched unit code1111.3) Local API verification (optional, with path deps)
Point
survey-assist-apiandsoc-classification-utilsat this library locally:Then:
Live lookup check:
Observed on this branch (local API with path dep to this library):
code:"1111"code_meta.code:"1111"(not"1")code_meta.group_title:"Chief executives and senior officials"code_minor_group_meta,code_sub_major_group_meta,code_major_group_metaExpected outcomes
code_metareflects the matched SOC code, not a parent major group.v0.1.6after tag is published.