diff --git a/plugins/atshosts/oracle.py b/plugins/atshosts/oracle.py new file mode 100644 index 0000000..1e44cb6 --- /dev/null +++ b/plugins/atshosts/oracle.py @@ -0,0 +1,183 @@ +"""Oracle Recruiting Cloud: `oracle:/`, for example +`oracle:fa-ewto-saasfaprod1.fa.ocs.oraclecloud.com/CX_1001`. A paged REST +listing that states its total, and a per-role resource for the description. + +The host is the tenant's Fusion pod (`fa-...ocs.oraclecloud.com`), not the +company's own domain: Nokia's `jobs.nokia.com` only redirects to it. The site +number is `CX_1001` or `CX_1` on the tenants read so far, and the site's own +name (`SinchCareer`) is taken in its place. Written from live boards on +2026-09-29 (Milestone Systems, Nokia, Danske Bank, Sinch); jobhunt-hq did not +read Oracle. +""" + +from __future__ import annotations + +import html +import json +import re +from collections.abc import Callable +from typing import Any +from urllib.parse import quote + +from desk.sources import strip_html + +from ._shared import Get, Page, Row, only, parse_dt + +NAME = "oracle" +LABEL = "Oracle Recruiting Cloud" +KEEP_CASE = True +PATTERNS = ( + # The candidate site or one role's page: `/hcmUI/CandidateExperience/en/sites/CX_1/jobs`. + r"https?://([a-z0-9-]+(?:\.[a-z0-9-]+)*\.oraclecloud\.(?:com|eu))" + r"/hcmUI/CandidateExperience/[A-Za-z_-]+/sites/([A-Za-z0-9_-]+)", + # The REST call a company's own page makes, which names the site as `siteNumber=`. + r"https?://([a-z0-9-]+(?:\.[a-z0-9-]+)*\.oraclecloud\.(?:com|eu))" + r"/hcmRestApi/resources/[a-z0-9.]+/recruitingCEJobRequisitions[^\"'\s]*?siteNumber=([A-Za-z0-9_-]+)", + # No slug: another page of a tenant's Fusion UI (its sign-in, say), which names + # the host but no candidate site. + r"oraclecloud\.(?:com|eu)/hcmUI(?!/CandidateExperience/[A-Za-z_-]+/sites/)", +) + +#: The page size asked for. 200 was answered in full by Nokia (600 roles in +#: three calls of about 360 KB, 2026-09-29); the cursor advances by what a page +#: returned, so a tenant that caps `limit` lower would not skip a role. +PAGE_SIZE = 200 + +#: A pod: `fa-ewto-saasfaprod1.fa.ocs.oraclecloud.com`. Oracle's regions also +#: use `.eu` (Danske Bank's `ejqi.fa.ocs.oraclecloud.eu`). A host name has no +#: case, so a slug written with capitals is allowed as its lowercase. +_HOST = r"[a-z0-9-]+(?:\.[a-z0-9-]+)*\.oraclecloud\.(?:com|eu)" +_SLUG = re.compile(rf"({_HOST})/([A-Za-z0-9_-]+)", re.IGNORECASE) + +#: `WorkplaceTypeCode` -> `store._remote`'s words. A role that states none +#: has an empty code, which stays unknown. +_REMOTE = {"ora_remote": "remote", "ora_hybrid": "hybrid", "ora_on_site": "onsite"} + + +def _parts(slug: str) -> tuple[str, str]: + """`(host, site number)` of a slug that passed `slug_ok`.""" + host, _, site = slug.partition("/") + return host.lower(), site + + +def slug_ok(slug: str) -> bool: + return bool(_SLUG.fullmatch(slug)) + + +def allowed(slug: str) -> Callable[[str], bool]: + return only(_parts(slug)[0]) + + +def _base(slug: str) -> str: + host, site = _parts(slug) + return f"https://{host}/hcmUI/CandidateExperience/en/sites/{site}" + + +def careers_url(slug: str) -> str: + return f"{_base(slug)}/jobs" + + +def robots_page(slug: str) -> str: + return careers_url(slug) + + +def _api(slug: str) -> str: + return f"https://{_parts(slug)[0]}/hcmRestApi/resources/latest" + + +def page(get: Get, slug: str, cursor: Any) -> Page: + """One page of `recruitingCEJobRequisitions`. The answer's outer `count`, + `hasMore` and `limit` describe the one search wrapper in `items`, so the + total (`TotalJobsCount`) and the roles (`requisitionList`) are read from + `items[0]`. Without the `expand` only the facets come back; asking for + `requisitionList.secondaryLocations` gives the roles and each one's other + locations, which the plain `requisitionList` leaves out. Past the last role + the list is empty.""" + offset = int(cursor or 0) + site = _parts(slug)[1] + data = json.loads(get( + f"{_api(slug)}/recruitingCEJobRequisitions?onlyData=true" + f"&expand=requisitionList.secondaryLocations" + f"&finder=findReqs;siteNumber={site},limit={PAGE_SIZE},offset={offset}")) + search = (data.get("items") or [{}])[0] + roles = search.get("requisitionList") or [] + # `_paged` counts `id`, which Oracle spells `Id`. + results = [{"id": str(role.get("Id") or "")} for role in roles] + return search, results, search.get("TotalJobsCount"), offset + len(roles) if roles else None + + +def parse(body: bytes, slug: str) -> list[Row]: + return rows((json.loads(body).get("items") or [{}])[0], slug) + + +def _text(value: Any) -> str: + return value.strip() if isinstance(value, str) else "" + + +def _plain(value: Any) -> str: + """Plain text from a field of HTML, entities (`&`, ` `) included.""" + return html.unescape(strip_html(_text(value))).replace("\xa0", " ").strip() + + +def rows(search: dict[str, Any], slug: str) -> list[Row]: + """The roles of one page's search wrapper. The list carries the title, the + id, `PostedDate` (a date), `PrimaryLocation` ("Copenhagen, Denmark"; a + country alone where the role names no city), `secondaryLocations`, + `WorkplaceTypeCode` and `ShortDescriptionStr`, one paragraph that Nokia + and Milestone fill for most roles. The department fields (`JobFamily`, + `Department`, `Organization`) were null on every role of all four boards + read, and are taken when a tenant fills them. The full description is in + the role's own resource, see `detail`. No pay is stated.""" + out = [] + for role in search.get("requisitionList") or []: + role_id = str(role.get("Id") or "").strip() + title = _text(role.get("Title")) + # The id goes into a URL, and a listing is external content. + if not title or not re.fullmatch(r"[A-Za-z0-9_-]+", role_id): + continue + places: list[str] = [] + for name in (_text(role.get("PrimaryLocation")), + *(_text(s.get("Name")) for s in role.get("secondaryLocations") or [] + if isinstance(s, dict))): + if name and name not in places: + places.append(name) + out.append({ + "source_id": role_id, + "title": title, + "location": "; ".join(places), + "url": f"{_base(slug)}/job/{role_id}", + "posted": parse_dt(role.get("PostedDate")), + "department": (_text(role.get("JobFamily")) or _text(role.get("JobFunction")) + or _text(role.get("Department")) or _text(role.get("Organization"))), + "description": _plain(role.get("ShortDescriptionStr")), + "remote": _REMOTE.get(_text(role.get("WorkplaceTypeCode")).lower()), + "salary_text": "", # the resource states no pay + }) + return out + + +def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: + """The role's own resource (`recruitingCEJobRequisitionDetails`, found by + `Id` and site). Only here is the full text: `ExternalDescriptionStr`, with + the responsibilities and qualifications strings after it where a tenant + fills them (Milestone leaves them empty), all HTML. `ExternalPostedStartDate` + is a timestamp where the listing has a date. A role that is no longer open + answers 200 with no items, and has nothing to read.""" + site = _parts(slug)[1] + role_id = quote(str(row["source_id"]), safe="") + data = json.loads(get( + f"{_api(slug)}/recruitingCEJobRequisitionDetails?expand=all&onlyData=true" + f"&finder=ById;Id=%22{role_id}%22,siteNumber={site}")) + items = data.get("items") or [] + if not items: + return {} + role = items[0] + text = " ".join(part for key in ("ExternalDescriptionStr", "ExternalResponsibilitiesStr", + "ExternalQualificationsStr") + if (part := _plain(role.get(key)))) + out: dict[str, Any] = {} + if text: + out["description"] = text + if posted := parse_dt(role.get("ExternalPostedStartDate")): + out["posted"] = posted + return out diff --git a/tests/fixtures/ats/oracle-detail.json b/tests/fixtures/ats/oracle-detail.json new file mode 100644 index 0000000..0365d0a --- /dev/null +++ b/tests/fixtures/ats/oracle-detail.json @@ -0,0 +1,107 @@ +{ + "items": [ + { + "Id": "24594", + "Title": "Support Professional", + "Category": "Customer Support", + "RequisitionType": "Full time Permanent", + "JobGrade": null, + "RequisitionId": 300000164708671, + "ExternalPostedStartDate": "2026-09-28T15:09:24+00:00", + "JobLevel": null, + "JobSchedule": null, + "JobShift": null, + "StudyLevel": null, + "InternationalTravelRequired": null, + "ExternalContactName": null, + "ExternalContactEmail": null, + "ContractType": null, + "ExternalPostedEndDate": null, + "JobFamilyId": 300000004434468, + "GeographyId": 100000037181451, + "GeographyNodeId": 100000092726195, + "ExternalDescriptionStr": "

Be the key in unlocking business opportunities in the convergent world of Open Platform IP Video Management Systems! Join Milestone!

Milestone Systems, Inc. is looking for a skilled Support Professional to work in a hybrid position (Tuesday through Thursday) at our US Headquarters located in beautiful Lake Oswego, Oregon. The shift for this role is 6:00 a.m. to 3:00 p.m. Relocation assistance is not provided for this position, and minimum pay is $70,000 per year and can go up depending on experience. 

We are looking for someone who enjoys working with cutting edge technology and helping individuals use it effectively. If you are a believer in the use of technology to enhance daily living, then this is the place for you. The Technical Support Professional is typically a first point of contact with Milestone customers and therefore has a key role in helping Milestone achieve its mission goal of delivering excellent customer experiences. The SP delivers responsive and reliable solutions to Milestone Partners through application of knowledge of Milestone organization, services, and products. This position will report to our Manager, Technical Support.

As a Technical Support Professional, you have a key role in helping Milestone to achieve its mission goal of delivering great customer and partner experience. 

As part of an international support team, you will operate in a fast-paced dynamic environment united in one common passion \u2013 to be the ...", + "CorporateDescriptionStr": "", + "OrganizationDescriptionStr": "", + "ShortDescriptionStr": "", + "ContentLocale": "en", + "PrimaryLocation": "Lake Oswego, OR, United States", + "PrimaryLocationCountry": "US", + "ObjectVerNumberProfile": null, + "ApplyWhenNotPostedFlag": null, + "ExternalQualificationsStr": "", + "InternalQualificationsStr": "", + "InternalResponsibilitiesStr": "", + "ExternalResponsibilitiesStr": "", + "JobFunctionCode": null, + "HotJobFlag": false, + "TrendingFlag": false, + "BeFirstToApplyFlag": false, + "WorkplaceTypeCode": null, + "WorkplaceType": "", + "OtherRequisitionTitle": null, + "NumberOfOpenings": null, + "HiringManager": null, + "Organization": null, + "BusinessUnitId": 300000004214148, + "LegalEmployerId": 300000004310622, + "OrganizationId": 1, + "WorkerType": null, + "JobType": null, + "WorkMonths": null, + "WorkYears": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "DomesticTravelRequired": null, + "JobFunction": null, + "secondaryLocations": [], + "media": [], + "workLocation": [ + { + "LocationId": 300000004214036, + "LocationName": "Portland", + "AddressLine1": "5300 Meadows Rd, Suite 400", + "AddressLine2": null, + "AddressLine3": null, + "AddressLine4": null, + "Building": null, + "TownOrCity": "Lake Oswego", + "PostalCode": "OR 97035", + "Country": "US", + "Region1": null, + "Region2": null, + "Region3": null, + "Longitude": "-122.72792", + "Latitude": "45.41083" + } + ], + "otherWorkLocations": [], + "requisitionFlexFields": [], + "primaryLocationCoordinates": [ + { + "GeographyNodeId": 100000092726195, + "GeographyId": 100000037181451, + "Latitude": "45.38764", + "Longitude": "-122.74389", + "CountryCode": "US" + } + ], + "skills": [] + } + ], + "count": 1, + "hasMore": false, + "limit": 499, + "offset": 0, + "links": [ + { + "rel": "self", + "href": "https://fa-ewto-saasfaprod1.fa.ocs.oraclecloud.com:443/hcmRestApi/resources/11.13.18.05/recruitingCEJobRequisitionDetails", + "name": "recruitingCEJobRequisitionDetails", + "kind": "collection" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/ats/oracle.json b/tests/fixtures/ats/oracle.json new file mode 100644 index 0000000..3350995 --- /dev/null +++ b/tests/fixtures/ats/oracle.json @@ -0,0 +1,302 @@ +{ + "items": [ + { + "SearchId": 1, + "Keyword": null, + "CorrectedKeyword": null, + "UseExactKeywordFlag": false, + "SuggestedKeyword": null, + "ExecuteSpellCheckFlag": true, + "Location": null, + "LocationId": null, + "Radius": 0, + "RadiusUnit": "MI", + "Facets": "TITLES;LOCATIONS;LOCATION_LEVEL1;LOCATION_LEVEL2;LOCATION_LEVEL3;CATEGORIES;POSTING_DATES;WORK_LOCATIONS;FLEX_FIELDS;ORGANIZATIONS;WORKPLACE_TYPES", + "Offset": 0, + "Limit": 5, + "SortBy": "RELEVANCY", + "TotalJobsCount": 600, + "Latitude": null, + "Longitude": null, + "SiteNumber": "CX_1", + "JobFamilyId": null, + "PostingStartDate": null, + "PostingEndDate": null, + "RequisitionId": null, + "CandidateNumber": null, + "WorkLocationZipCode": null, + "WorkLocationCountryCode": null, + "SelectedFlexFieldsFacets": null, + "OrganizationId": null, + "UserTargetFacetName": null, + "UserTargetFacetInputTerm": null, + "HotJobFlag": null, + "WorkplaceType": null, + "BotQRShortCode": null, + "requisitionList": [ + { + "Id": "39905", + "Title": "Supply Chain Program Manager", + "PostedDate": "2026-09-28", + "PostingEndDate": null, + "Language": "US", + "PrimaryLocationCountry": "TH", + "GeographyId": 300000000480081, + "HotJobFlag": true, + "WorkplaceTypeCode": "ORA_HYBRID", + "JobFamily": null, + "JobFunction": null, + "WorkerType": null, + "ContractType": null, + "ManagerLevel": null, + "JobSchedule": null, + "JobShift": null, + "JobType": null, + "StudyLevel": null, + "DomesticTravelRequired": null, + "InternationalTravelRequired": null, + "WorkDurationYears": null, + "WorkDurationMonths": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "Organization": null, + "BusinessUnitId": 300000006664259, + "LegalEmployerId": 300000006365816, + "OrganizationId": 10003297, + "MediaThumbURL": null, + "ShortDescriptionStr": "Nokia is searching for a Supply Chain Program Management Leader to support our local contract manufacturers in SE Asia across multiple Subsystems products. This person will be accountable to work in a cross functional team with local Nokia teams and our ...", + "PrimaryLocation": "Thailand", + "Distance": 15, + "TrendingFlag": false, + "BeFirstToApplyFlag": false, + "Relevancy": 15, + "WorkplaceType": "Hybrid", + "ExternalQualificationsStr": null, + "ExternalResponsibilitiesStr": null, + "secondaryLocations": [ + { + "RequisitionLocationId": 300002190470822, + "GeographyNodeId": 100002145190119, + "GeographyId": 300000000471904, + "Name": "Malaysia", + "CountryCode": "MY", + "Latitude": 4.38933, + "Longitude": 102.08986 + } + ] + }, + { + "Id": "37189", + "Title": "IP NPI Specialist", + "PostedDate": "2026-09-24", + "PostingEndDate": null, + "Language": "US", + "PrimaryLocationCountry": "MY", + "GeographyId": 300000000471904, + "HotJobFlag": true, + "WorkplaceTypeCode": "ORA_HYBRID", + "JobFamily": null, + "JobFunction": null, + "WorkerType": null, + "ContractType": null, + "ManagerLevel": null, + "JobSchedule": null, + "JobShift": null, + "JobType": null, + "StudyLevel": null, + "DomesticTravelRequired": null, + "InternationalTravelRequired": null, + "WorkDurationYears": null, + "WorkDurationMonths": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "Organization": null, + "BusinessUnitId": 300000006664259, + "LegalEmployerId": 300000006365205, + "OrganizationId": 53235948, + "MediaThumbURL": null, + "ShortDescriptionStr": "The New Product Introduction Specialist defines and execute demos, proof of concept, type approvals tests, field trials, and in general any New Product Introduction (NPI) related activities with our customer for any new product or solution. Accountable from ...", + "PrimaryLocation": "Malaysia", + "Distance": 13, + "TrendingFlag": false, + "BeFirstToApplyFlag": false, + "Relevancy": 13, + "WorkplaceType": "Hybrid", + "ExternalQualificationsStr": null, + "ExternalResponsibilitiesStr": null, + "secondaryLocations": [ + { + "RequisitionLocationId": 300001975383156, + "GeographyNodeId": 100002145190018, + "GeographyId": 300000000471961, + "Name": "Philippines", + "CountryCode": "PH", + "Latitude": 17.20662, + "Longitude": 121.6106 + }, + { + "RequisitionLocationId": 300002107689780, + "GeographyNodeId": 100002145190100, + "GeographyId": 300000000471733, + "Name": "Indonesia", + "CountryCode": "ID", + "Latitude": 2.82116, + "Longitude": 99.61807 + }, + { + "RequisitionLocationId": 300002107689781, + "GeographyNodeId": 100002145190039, + "GeographyId": 300000000480081, + "Name": "Thailand", + "CountryCode": "TH", + "Latitude": 13.75336, + "Longitude": 100.50483 + } + ] + }, + { + "Id": "40316", + "Title": "Safety Manager 3", + "PostedDate": "2026-09-28", + "PostingEndDate": null, + "Language": "US", + "PrimaryLocationCountry": "IN", + "GeographyId": 300000000471745, + "HotJobFlag": true, + "WorkplaceTypeCode": "ORA_ON_SITE", + "JobFamily": null, + "JobFunction": null, + "WorkerType": null, + "ContractType": null, + "ManagerLevel": null, + "JobSchedule": null, + "JobShift": null, + "JobType": null, + "StudyLevel": null, + "DomesticTravelRequired": null, + "InternationalTravelRequired": null, + "WorkDurationYears": null, + "WorkDurationMonths": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "Organization": null, + "BusinessUnitId": 300000006664246, + "LegalEmployerId": 300000006387938, + "OrganizationId": 10008015, + "MediaThumbURL": null, + "ShortDescriptionStr": "The Safety Manager is responsible for leading Health, Safety, and Environment (HSE) operations at the Nokia Repair Factory in Gurgaon. This role ensures a safe, healthy, and compliant workplace by driving risk management initiatives, regulatory compliance, ...", + "PrimaryLocation": "India", + "Distance": 15, + "TrendingFlag": true, + "BeFirstToApplyFlag": false, + "Relevancy": 15, + "WorkplaceType": "Onsite", + "ExternalQualificationsStr": null, + "ExternalResponsibilitiesStr": null, + "secondaryLocations": [] + }, + { + "Id": "40975", + "Title": "High-Speed Converters Test and Validation Engineer", + "PostedDate": "2026-09-28", + "PostingEndDate": null, + "Language": "US", + "PrimaryLocationCountry": "DE", + "GeographyId": 300000000471601, + "HotJobFlag": false, + "WorkplaceTypeCode": null, + "JobFamily": null, + "JobFunction": null, + "WorkerType": null, + "ContractType": null, + "ManagerLevel": null, + "JobSchedule": null, + "JobShift": null, + "JobType": null, + "StudyLevel": null, + "DomesticTravelRequired": null, + "InternationalTravelRequired": null, + "WorkDurationYears": null, + "WorkDurationMonths": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "Organization": null, + "BusinessUnitId": 300000006664259, + "LegalEmployerId": 300001149364006, + "OrganizationId": 300000806569044, + "MediaThumbURL": null, + "ShortDescriptionStr": "We are looking for a High-Speed ADC/DAC Test Engineer with strong hands-on laboratory experience. This is a practical, lab-focused engineering position for someone who is comfortable working directly with high-frequency test and measurement equipment and has ...", + "PrimaryLocation": "Germany", + "Distance": 9, + "TrendingFlag": false, + "BeFirstToApplyFlag": false, + "Relevancy": 9, + "WorkplaceType": "", + "ExternalQualificationsStr": null, + "ExternalResponsibilitiesStr": null, + "secondaryLocations": [] + }, + { + "Id": "31680", + "Title": "Sr. Director of Application Engineering", + "PostedDate": "2026-07-15", + "PostingEndDate": null, + "Language": "US", + "PrimaryLocationCountry": "US", + "GeographyId": 300000000480126, + "HotJobFlag": true, + "WorkplaceTypeCode": "ORA_REMOTE", + "JobFamily": null, + "JobFunction": null, + "WorkerType": null, + "ContractType": null, + "ManagerLevel": null, + "JobSchedule": null, + "JobShift": null, + "JobType": null, + "StudyLevel": null, + "DomesticTravelRequired": null, + "InternationalTravelRequired": null, + "WorkDurationYears": null, + "WorkDurationMonths": null, + "WorkHours": null, + "WorkDays": null, + "LegalEmployer": null, + "BusinessUnit": null, + "Department": null, + "Organization": null, + "BusinessUnitId": 300000006664259, + "LegalEmployerId": 300001149319675, + "OrganizationId": 300000806569328, + "MediaThumbURL": null, + "ShortDescriptionStr": "As the Sr. Director of Applications Engineering for Photonic Component Solutions at Nokia, you will be at the forefront of integrating advanced photonics technology into the Hyperscaler and optical module markets. Your core mission is to connect innovative ...", + "PrimaryLocation": "United States", + "Distance": 7, + "TrendingFlag": true, + "BeFirstToApplyFlag": false, + "Relevancy": 7, + "WorkplaceType": "Remote", + "ExternalQualificationsStr": null, + "ExternalResponsibilitiesStr": null, + "secondaryLocations": [] + } + ] + } + ], + "count": 1, + "hasMore": false, + "limit": 5, + "offset": 0 +} \ No newline at end of file