Files
Poc-dashboard/schema-mappings/jobads-mapping.js
2025-10-15 11:28:10 +02:00

152 lines
3.9 KiB
JavaScript

// JobAds schema mapping - job posting natural language support
import { createSchemaMapping } from "./base-mapping.js";
import fs from "node:fs";
const SCHEMA_PATH = "../smatchitObjectOdmdb/schema/jobads.json";
let jobadsSchema = null;
try {
if (fs.existsSync(SCHEMA_PATH)) {
jobadsSchema = JSON.parse(fs.readFileSync(SCHEMA_PATH, "utf-8"));
}
} catch (error) {
console.warn(`Warning: Could not load jobads schema: ${error.message}`);
}
export const jobadsMapping = createSchemaMapping(jobadsSchema, "jobads");
// Additional jobads-specific enhancements
if (jobadsMapping.available) {
const jobadsEnhancements = {
// Job Identification
"job id": "jobadid",
"posting id": "jobadid",
"ad id": "jobadid",
"advertisement id": "jobadid",
"job posting": "jobadid",
// Job Details
"job title": "jobtitle",
position: "jobtitle",
role: "jobtitle",
"job name": "jobtitle",
"position title": "jobtitle",
"job role": "jobtitle",
// Job Status & State
"job status": "state",
"posting status": "state",
"publication status": "state",
availability: "state",
"job state": "state",
active: "state",
published: "state",
draft: "state",
archived: "state",
// Company & Organization
company: "siret",
employer: "siret",
organization: "siret",
business: "siret",
firm: "siret",
// Job Compensation
salary: "salary",
pay: "salary",
compensation: "salary",
wage: "salary",
remuneration: "salary",
payment: "salary",
// Job Location
"job location": "joblocation",
"work location": "joblocation",
workplace: "joblocation",
"office location": "joblocation",
where: "joblocation",
place: "joblocation",
// Job Description & Requirements
"job description": "description",
"job details": "description",
requirements: "description",
responsibilities: "description",
duties: "description",
"job requirements": "description",
"role description": "description",
// Job Type & Contract
"employment type": "jobtype",
"contract type": "jobtype",
"job type": "jobtype",
"work type": "jobtype",
"position type": "jobtype",
// Remote Work
"remote work": "remote",
"work from home": "remote",
telecommute: "remote",
"remote job": "remote",
"home office": "remote",
// Dates & Timeline
"published date": "dt_publish",
"posting date": "dt_publish",
"publication date": "dt_publish",
"went live": "dt_publish",
"closing date": "dt_close",
deadline: "dt_close",
"application deadline": "dt_close",
expires: "dt_close",
// Skills & Qualifications
"required skills": "skills",
qualifications: "skills",
competencies: "skills",
"abilities required": "skills",
"expertise needed": "skills",
// Experience Requirements
"experience required": "experiencerequired",
"years of experience": "experiencerequired",
"work experience": "experiencerequired",
"professional experience": "experiencerequired",
// Education Requirements
"education required": "education",
"degree required": "education",
"qualification needed": "education",
"educational background": "education",
};
// Merge enhancements into synonyms
Object.entries(jobadsEnhancements).forEach(([synonym, fieldName]) => {
jobadsMapping.synonyms[synonym.toLowerCase()] = fieldName;
});
// Add state value mappings
jobadsMapping.statusValues = {
state: {
active: "publish",
published: "publish",
live: "publish",
online: "publish",
available: "publish",
draft: "draft",
unpublished: "draft",
"in progress": "draft",
ready: "ready",
pending: "ready",
waiting: "ready",
closed: "archive",
archived: "archive",
expired: "archive",
inactive: "archive",
ended: "archive",
},
};
}
export default jobadsMapping;