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

105 lines
2.8 KiB
JavaScript

// Persons schema mapping - person profile natural language support
import { createSchemaMapping } from "./base-mapping.js";
import fs from "node:fs";
const SCHEMA_PATH = "../smatchitObjectOdmdb/schema/persons.json";
let personsSchema = null;
try {
if (fs.existsSync(SCHEMA_PATH)) {
personsSchema = JSON.parse(fs.readFileSync(SCHEMA_PATH, "utf-8"));
}
} catch (error) {
console.warn(`Warning: Could not load persons schema: ${error.message}`);
}
export const personsMapping = createSchemaMapping(personsSchema, "persons");
// Additional persons-specific enhancements
if (personsMapping.available) {
const personsEnhancements = {
// Personal Information
"first name": "firstname",
"given name": "firstname",
name: "firstname",
"last name": "lastname",
"family name": "lastname",
surname: "lastname",
"full name": "fullname",
"display name": "fullname",
// Demographics
"birth date": "dt_birth",
birthday: "dt_birth",
"date of birth": "dt_birth",
age: "dt_birth",
born: "dt_birth",
gender: "pronom",
pronouns: "pronom",
// Contact & Communication
"personal email": "emailcom",
"communication email": "emailcom",
"contact email": "emailcom",
"email address": "emailcom",
// Profile Information
biography: "biography",
bio: "biography",
about: "biography",
description: "biography",
"personal story": "biography",
background: "biography",
hobbies: "hobbies",
interests: "hobbies",
activities: "hobbies",
pastimes: "hobbies",
leisure: "hobbies",
// Visual Profile
"profile picture": "imgavatar",
avatar: "imgavatar",
photo: "imgavatar",
image: "imgavatar",
picture: "imgavatar",
// Access & Privacy
"profile access": "profilaccess",
"privacy settings": "profilaccess",
visibility: "profilaccess",
"profile visibility": "profilaccess",
// Activity & Status
"last login": "last_login",
"last active": "last_login",
"last seen": "last_login",
"login time": "last_login",
// Account Information
"account created": "dt_create",
registration: "dt_create",
joined: "dt_create",
"sign up": "dt_create",
"profile updated": "dt_update",
"last modified": "dt_update",
};
// Merge enhancements into synonyms
Object.entries(personsEnhancements).forEach(([synonym, fieldName]) => {
personsMapping.synonyms[synonym.toLowerCase()] = fieldName;
});
// Add persons-specific context
personsMapping.context = {
description: "Personal profile information for users in the system",
primaryData: ["identity", "contact", "demographics", "profile"],
relationships: {
seekers: "Person who is seeking employment",
recruiters: "Person who is recruiting for companies",
},
};
}
export default personsMapping;