Your question is Nested JSON Processing for Job Data. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Phenom job postings can store skills at different nesting levels, including role details, screening sections, and structured skill objects. Implement a function that recursively finds every skill container and returns a normalized list of unique skill names.
Given posting, a JSON-compatible Python value consisting of dictionaries, lists, strings, numbers, booleans, or None, return a list of skill-name strings.
A dictionary key is a skill container when, after lowercasing and replacing spaces or hyphens with underscores, it equals skills or required_skills. A skill container may contain strings, lists, or dictionaries. For a dictionary entry, use the first string value found under name, title, or label as the skill name. Otherwise, recursively inspect its values.
Normalize each extracted name by trimming leading and trailing whitespace and collapsing internal whitespace. Deduplicate names case-insensitively while preserving the spelling and order of their first occurrence. Ignore all strings outside skill containers. Return an empty list when no skills are present.
def extract_job_skills(posting):