Readers oracle to workday and the providers hand on the host's words; their word tables move to app/prep/hosts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 11:07:07 +02:00
1 parent a66aac95cf
commit 06eb929eaf
48 files changed
+460 -388

No files matched your search

+7 -23
View File
@@ -13,15 +13,12 @@ ignores a remote parameter, so remote is not filtered.
from __future__ import annotations
import json
import logging
import re
from collections.abc import Callable
from typing import Any
from ._contract import Ask, Fields, Filters, Place, Reads
from ._shared import Get, Page, Row, only, parse_dt, path_slug_ok, table_word
log = logging.getLogger(__name__)
from ._shared import Get, Page, Row, only, parse_dt, path_slug_ok
NAME = "smartrecruiters"
LABEL = "SmartRecruiters"
@@ -41,17 +38,6 @@ READS = Reads(
_API = "api.smartrecruiters.com"
#: `experienceLevel.id` -> the app's levels. The three in the middle name no
#: level ("associate" is half of Bosch's roles) and are known, so they map to
#: none; an id not listed is logged at debug level.
_SENIORITY = {"internship": "intern", "entry_level": "junior", "director": "director",
"executive": "exec", "associate": "", "mid_senior_level": "",
"not_applicable": ""}
#: `typeOfEmployment.id` -> the app's employment words.
_EMPLOYMENT = {"permanent": "", "intern": "internship", "temporary": "temporary",
"contract": "contract", "part_time": "part_time", "full_time": "full_time"}
#: The page size asked for, which is also the most the host serves per page.
PAGE_SIZE = 100
@@ -94,10 +80,9 @@ def parse(body: bytes, slug: str) -> list[Row]:
return rows(json.loads(body), slug)
def _word(job: dict[str, Any], key: str, table: dict[str, str]) -> str | None:
"""The `id` of the object `job[key]` looked up in `table`; none for a word
the table maps to none, and a word it does not know is logged."""
return table_word(table, (job.get(key) or {}).get("id"), log, key)
def _word(job: dict[str, Any], key: str) -> str | None:
"""The `id` of the object `job[key]`, as given."""
return str((job.get(key) or {}).get("id") or "").strip() or None
def rows(data: dict[str, Any], slug: str) -> list[Row]:
@@ -122,7 +107,6 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
loc_text = ", ".join(part.strip() for part in (loc_text or "").split(",")
if part.strip())
place: Place = {"text": loc_text, "remote": location.get("remote")}
country = str(location.get("country") or "").strip().upper()
out.append({
"source_id": job_id,
"title": title,
@@ -134,8 +118,8 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
"description": "",
"remote": location.get("remote"),
"salary_text": "", # SmartRecruiters' list endpoint states no pay at all
"country": country if len(country) == 2 else None,
"seniority": _word(j, "experienceLevel", _SENIORITY),
"employment": _word(j, "typeOfEmployment", _EMPLOYMENT),
"country": str(location.get("country") or "").strip() or None,
"seniority": _word(j, "experienceLevel"),
"employment": _word(j, "typeOfEmployment"),
})
return out