[UPDATE] Enhance README and demo scripts with comprehensive query examples and improved schema mappings

This commit is contained in:
Eliyan
2025-10-15 10:01:00 +02:00
parent e863a0a5ea
commit 77c2c4ab9b
3 changed files with 635 additions and 66 deletions

233
poc.js
View File

@@ -23,7 +23,7 @@ const EXECUTE_QUERY = process.env.EXECUTE_QUERY === "true"; // Set to "true" to
// Hardcoded NL query for the PoC (no multi-turn)
const NL_QUERY =
"show me seekers with status startasap and their email and experience";
"find seekers looking for jobs urgently with their contact info and salary expectations";
// ---- Load schemas (safe) ----
function loadJsonSafe(path) {
@@ -155,17 +155,202 @@ class SchemaMapper {
generateSynonyms(fieldName, fieldDef) {
const synonyms = [];
// Common mappings based on actual schema
// Comprehensive mappings based on actual seekers schema (62 properties)
const commonMappings = {
email: ["contact", "mail", "contact email"],
seekworkingyear: ["experience", "years of experience", "work experience"],
seekjobtitleexperience: ["job titles", "job experience", "positions"],
seekstatus: ["status", "availability", "looking"],
dt_create: ["created", "creation date", "new", "recent", "since"],
salaryexpectation: ["salary", "pay", "compensation", "wage"],
seeklocation: ["location", "where", "place"],
mbti: ["personality", "type", "profile"],
alias: ["id", "identifier", "username"],
// Contact & Identity
email: ["contact", "mail", "contact email", "e-mail"],
alias: ["id", "identifier", "username", "user id"],
shortdescription: ["description", "bio", "summary", "about"],
// Work Experience & Status
seekworkingyear: [
"experience",
"years of experience",
"work experience",
"working years",
"career length",
],
seekjobtitleexperience: [
"job titles",
"job experience",
"positions",
"roles",
"previous jobs",
"work history",
],
seekstatus: [
"status",
"availability",
"looking",
"job search status",
"urgency",
],
employmentstatus: [
"employment",
"current status",
"work status",
"job status",
],
// Location & Geography
seeklocation: [
"location",
"where",
"place",
"work location",
"preferred location",
],
lastlocation: ["last location", "current location", "previous location"],
countryavailabletowork: [
"countries",
"available countries",
"work countries",
"country availability",
],
// Salary & Compensation
salaryexpectation: [
"salary",
"pay",
"compensation",
"wage",
"salary expectation",
"expected salary",
],
salarydevise: ["currency", "salary currency", "pay currency"],
salaryunit: [
"salary unit",
"pay unit",
"compensation unit",
"salary period",
],
// Job Preferences
seekjobtype: [
"job type",
"job types",
"employment type",
"contract type",
],
lookingforjobtype: [
"looking for",
"desired job type",
"preferred job type",
],
lookingforaction: ["actions", "desired actions", "preferred activities"],
lookingforother: ["other preferences", "additional requirements"],
// Skills & Competencies
skills: ["skills", "competencies", "abilities", "technical skills"],
languageskills: ["languages", "language skills", "linguistic skills"],
knowhow: ["knowledge", "expertise", "know-how", "competence"],
myworkexperience: [
"work experience",
"professional experience",
"career experience",
],
// Personality & Profile
mbti: ["personality", "type", "profile", "MBTI", "personality type"],
mywords: ["keywords", "profile words", "descriptive words"],
thingsilike: ["likes", "preferences", "interests", "things I like"],
thingsidislike: [
"dislikes",
"avoid",
"not interested",
"things I dislike",
],
// Availability & Schedule
preferedworkinghours: [
"working hours",
"preferred hours",
"work schedule",
"availability",
],
notavailabletowork: [
"unavailable",
"not available",
"blocked times",
"unavailable days",
],
// Job Search Activity
myjobradar: [
"job radar",
"tracked jobs",
"job interests",
"monitored jobs",
],
jobadview: ["viewed jobs", "job views", "seen jobs"],
jobadnotinterested: ["not interested", "rejected jobs", "dismissed jobs"],
jobadapply: ["applied jobs", "applications", "job applications"],
jobadinvitedtoapply: [
"invitations",
"invited to apply",
"job invitations",
],
jobadsaved: ["saved jobs", "bookmarked jobs", "favorite jobs"],
// Dates & Timestamps
dt_create: [
"created",
"creation date",
"new",
"recent",
"since",
"registration date",
],
dt_update: ["updated", "last update", "modified", "last modified"],
matchinglastdate: ["last matching", "matching date", "last match"],
// Education & Training
educations: [
"education",
"degree",
"diploma",
"qualification",
"studies",
],
tipsadvice: ["tips", "advice", "articles", "guidance"],
receivecommercialtraining: ["commercial training", "sales training"],
receivejobandinterviewtips: [
"interview tips",
"job tips",
"career advice",
],
// Notifications & Communication
notificationformatches: ["match notifications", "matching alerts"],
notificationforsupermatches: [
"super match notifications",
"premium matches",
],
notificationinvitedtoapply: [
"application invitations",
"invite notifications",
],
notificationrecruitprocessupdate: [
"recruitment updates",
"process updates",
],
notificationupcominginterview: [
"interview notifications",
"upcoming interviews",
],
notificationdirectmessage: ["direct messages", "chat notifications"],
emailactivityreportweekly: ["weekly reports", "weekly emails"],
emailactivityreportbiweekly: ["biweekly reports", "biweekly emails"],
emailactivityreportmonthly: ["monthly reports", "monthly emails"],
emailpersonnalizedcontent: ["personalized content", "custom content"],
emailnewsletter: ["newsletter", "news updates"],
// External IDs
polemploiid: ["pole emploi", "unemployment office", "job center ID"],
// System Fields
owner: ["owner", "account owner"],
activequizz: ["active quiz", "current quiz", "quiz"],
};
if (commonMappings[fieldName]) {
@@ -289,14 +474,22 @@ function systemPrompt() {
recruiterReadableFields.join(", "),
"",
"Field mappings for natural language:",
"- 'email' → email",
"- 'experience' → seekworkingyear",
"- 'job titles' → seekjobtitleexperience",
"- 'status' → seekstatus",
"- 'salary' → salaryexpectation",
"- 'location' → seeklocation",
"- 'email', 'contact info' → email",
"- 'experience', 'years of experience' → seekworkingyear",
"- 'job titles', 'positions', 'roles' → seekjobtitleexperience",
"- 'status', 'availability' → seekstatus",
"- 'salary', 'pay', 'compensation' → salaryexpectation",
"- 'location', 'where' → seeklocation",
"- 'skills', 'competencies' → skills",
"- 'languages' → languageskills",
"- 'personality', 'MBTI' → mbti",
"- 'new/recent' → dt_create (use prop.dt_create(>=:YYYY-MM-DD))",
"",
"Status value mappings:",
"- 'urgent', 'urgently', 'ASAP', 'quickly' → startasap",
"- 'no rush', 'taking time', 'leisurely' → norush",
"- 'not looking', 'not active' → notlooking",
"",
"Rules:",
"- Object must be 'seekers'.",
"- Use indexes when possible (idx.seekstatus_alias for status queries)",
@@ -603,7 +796,7 @@ async function processResults(results, jqFilter = ".") {
console.log("\n📋 Results Summary:");
const summary = await processResults(
results,
`.[0:3] | map({email, seekworkingyear})`
`.[0:3] | map({email, salaryexpectation, salarydevise, salaryunit})`
);
console.log(JSON.stringify(summary, null, 2));
@@ -617,8 +810,8 @@ async function processResults(results, jqFilter = ".") {
const csvData = await processResults(
results,
`
map([.email // "N/A", .seekworkingyear // "N/A"]) |
["email","experience"] as $header |
map([.email // "N/A", (.salaryexpectation | tostring) // "N/A", .salarydevise // "N/A", .salaryunit // "N/A"]) |
["email","salary","currency","unit"] as $header |
[$header] + .[0:5] |
.[] | @csv
`