[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

169
README.md
View File

@@ -61,7 +61,7 @@ npm start
EXECUTE_QUERY=true npm start
```
```
````
This will process the hardcoded natural language query and output the generated ODMDB query in JSON format. When `EXECUTE_QUERY=true`, it will also execute the query against the ODMDB server.
@@ -72,40 +72,102 @@ To test different natural language queries, edit the `NL_QUERY` constant in `poc
```javascript
// Line 16 in poc.js
const NL_QUERY = "your natural language query here";
```
````
### Example Queries
**Status-based queries:**
- `"show me seekers with status startasap and their email and experience"`
- `"find seekers looking for jobs urgently with their skills"`
- `"find seekers looking for jobs urgently with their skills and salary expectations"`
- `"get seekers who are not looking with their employment status"`
**Date-based queries:**
- `"give me new seekers since last week with email and experience"`
- `"show me seekers from yesterday with their skills"`
- `"show me seekers from yesterday with their location and availability"`
- `"find recently updated seekers with their job preferences"`
**Field-specific queries:**
**Comprehensive field queries:**
- `"find seekers with job titles and salary expectations"`
- `"show me seeker locations and availability"`
- `"show me seeker contact info and work experience"`
- `"find seekers with personality types and language skills"`
- `"get seeker salary expectations and preferred working hours"`
- `"show me seeker education and training preferences"`
- `"find seekers with their job applications and saved jobs"`
**Location & preferences:**
- `"show me seekers in Paris with remote work preferences"`
- `"find seekers available to work in multiple countries"`
- `"get seekers with specific location and salary requirements"`
**Skills & competencies:**
- `"find seekers with technical skills and years of experience"`
- `"show me seekers with language abilities and personality profiles"`
- `"get seekers with specific know-how and job radar interests"`
**Job search activity:**
- `"show me seekers who applied to jobs recently"`
- `"find seekers with saved jobs and their preferences"`
- `"get seekers who were invited to apply with their status"`
**Notifications & communication:**
- `"show me seekers with email preferences and notification settings"`
- `"find seekers who receive weekly reports and interview tips"`
**Supported filter types:**
- **Status filtering**: `seekstatus` (startasap, norush, notlooking)
- **Date filtering**: `dt_create` with date ranges
- **Index optimization**: Uses ODMDB indexes for efficient queries
- **Date filtering**: `dt_create`, `dt_update`, `matchinglastdate` with date ranges
- **Index optimization**: Uses ODMDB indexes (`lst_alias`, `seekstatus_alias`) for efficient queries
### Demo & Testing Tools
**Interactive Demo:**
This demonstrates various jq operations including:
```bash
node demo.js
```
**Live PoC demonstration** that actually uses the query generation functionality to show:
- Real query generation from natural language using OpenAI
- ODMDB schema loading and field mapping
- Current ODMDB data status and sample data
**Demo with Query Execution:**
```bash
EXECUTE_DEMO=true node demo.js
```
Runs the demo with actual query execution against real seeker data files.
**jq Processing Test:**
```bash
node test-jq.js
```
Demonstrates various jq operations including:
- Basic data formatting and field selection
- CSV conversion from JSON
- Advanced filtering and transformations
- Statistical summaries and aggregations
**jq Playground (Optional):**
```bash
node experiment-jq-playground.js
```
A playground to experiment with jq commands - not vital to the PoC but useful for learning jq syntax.
## Environment Variables
- `OPENAI_API_KEY` - Your OpenAI API key (required)
@@ -135,14 +197,66 @@ The PoC understands and generates these ODMDB DSL patterns:
- **Index queries**: `idx.<indexName>(value)`
- **Join queries**: `join(remoteObject:localKey:remoteProp:operator:value)`
## Field Mappings
## Comprehensive Field Mappings
Currently supports mapping for seekers object:
Supports extensive natural language mapping for **all 62 seeker properties**:
- `email` → `email`
- `experience` → `seekworkingyear`
- `job titles` → `seekjobtitleexperience`
- `status` → `seekstatus`
**Contact & Identity:**
- `email`, `contact`, `mail` → `email`
- `id`, `username`, `alias` → `alias`
- `bio`, `description`, `summary` → `shortdescription`
**Work Experience & Status:**
- `experience`, `years of experience`, `career length` → `seekworkingyear`
- `job titles`, `positions`, `roles`, `work history` → `seekjobtitleexperience`
- `status`, `availability`, `urgency` → `seekstatus`
- `employment`, `work status`, `job status` → `employmentstatus`
**Location & Geography:**
- `location`, `where`, `work location` → `seeklocation`
- `countries`, `work countries` → `countryavailabletowork`
- `current location`, `last location` → `lastlocation`
**Salary & Compensation:**
- `salary`, `pay`, `compensation`, `wage` → `salaryexpectation`
- `currency`, `salary currency` → `salarydevise`
- `salary unit`, `pay period` → `salaryunit`
**Skills & Competencies:**
- `skills`, `competencies`, `abilities` → `skills`
- `languages`, `language skills` → `languageskills`
- `knowledge`, `expertise`, `know-how` → `knowhow`
**Personality & Preferences:**
- `personality`, `MBTI`, `type` → `mbti`
- `likes`, `interests`, `preferences` → `thingsilike`
- `dislikes`, `avoid`, `not interested` → `thingsidislike`
**Job Search Activity:**
- `applied jobs`, `applications` → `jobadapply`
- `saved jobs`, `bookmarked jobs` → `jobadsaved`
- `viewed jobs`, `job views` → `jobadview`
- `invitations`, `invited to apply` → `jobadinvitedtoapply`
**Availability & Schedule:**
- `working hours`, `preferred hours`, `schedule` → `preferedworkinghours`
- `unavailable`, `blocked times` → `notavailabletowork`
**Dates & Activity:**
- `created`, `new`, `recent`, `since` → `dt_create`
- `updated`, `modified`, `last update` → `dt_update`
- `last matching`, `matching date` → `matchinglastdate`
_Plus comprehensive mappings for education, notifications, training, and system fields._
## Schema Context
@@ -154,9 +268,10 @@ The PoC can optionally load schema files for context:
## Limitations
- **Seekers only**: Other ODMDB objects (jobads, recruiters, etc.) are not yet implemented
- **No execution**: Only generates queries, doesn't execute them against ODMDB
- **Local execution only**: Works with file-based data, not live ODMDB server API
- **Hardcoded query**: Single query per run (no interactive mode)
- **Basic validation**: Limited DSL syntax validation
- **Performance limit**: Processes first 50 seeker files for PoC performance
- **Simplified DSL**: Basic condition parsing (date ranges, status filtering)
## Next Steps
@@ -168,7 +283,19 @@ The PoC can optionally load schema files for context:
## Files
- `poc.js` - Main PoC implementation
**Core Implementation:**
- `poc.js` - Main PoC implementation with full ODMDB integration
- `package.json` - Dependencies and scripts
- `main.json` - Optional schema context (if available)
- `lg.json` - Optional localization context (if available)
**Demo & Testing:**
- `demo.js` - **Live PoC demo** that actually generates and executes queries using real ODMDB data
- `test-jq.js` - jq processing capabilities demonstration
- `experiment-jq-playground.js` - jq learning playground (optional, not vital to PoC)
**Data & Schema:**
- `main.json` - Optional consolidated schema context (if available)
- `../smatchitObjectOdmdb/schema/seekers.json` - Real seekers schema (62 properties)
- `../smatchitObjectOdmdb/objects/seekers/itm/` - Individual seeker data files