This project is a Node.js and Express application backed by PostgreSQL.
It supports the task 3 profiles API requirements:
GET /api/profileswith filtering, sorting, and pagination.GET /api/profiles/searchwith rule-based natural language parsing.- A separate seed command that loads
seed_profiles.jsoninto PostgreSQL without duplicating existing rows.
The search endpoint is rule-based only. It does not use AI or an LLM.
Supported keyword mappings:
male,males,man,men,boy,boysmap togender=male.female,females,woman,women,girl,girlsmap togender=female.youngmaps tomin_age=16andmax_age=24.teenagerorteenagersmap toage_group=teenager.adultoradultsmap toage_group=adult.seniororseniorsmap toage_group=senior.childorchildrenmap toage_group=child.- Comparison phrases like
above 30,over 30,older than 30,at least 30, andminimum age of 30map tomin_age=30. - Comparison phrases like
below 20,under 20,younger than 20, andat most 20map tomax_age=20. - Country names are matched against the seeded country names and a small alias list for common variants.
Parsing works by normalizing the query to lowercase text, scanning it for supported tokens, and combining every recognized token into the final filter set. If nothing supported is found, the endpoint returns Unable to interpret query.
- Only rule-based keyword parsing is supported.
- The parser does not understand arbitrary grammar, synonyms outside the documented list, or free-form semantic intent.
- Country matching is limited to the seeded country names plus a small alias list for common variants.
- Sorting is only supported on the fields required by the task.
GET /api/profiles/searchonly usesq,page, andlimit.
npm installnpm startnpm run seedThe seed command reads the root-level seed_profiles.json file and inserts every profile into PostgreSQL using the unique name constraint to avoid duplicates.