⚡
PhinsIQ STUDIO
Enterprise AI ERP Middleware
Online
💬
Query Playground
Test real natural language queries against your dynamically configured clients & modules
💬 Interactive Test Console
Run queries through the live pipeline with natural language processing and ERP mapping
📥 View /questions JSON ↗
🤖
Claude AI Fallback Mode
True = Enable Claude Haiku 4.5 Fallback | False = Pure FastAPI / ERP Execution Only (No Claude calls)
🔀
Query Type Switch
(Normal / Subject Related)
📤 Live Request Payload JSON (POST /api/v1/phinsiq/chat) application/json

          
🏢 Client Institutions
Manage registered schools, ERP base URLs, auth mechanisms, and headers
Loading institutions...
🧩 Concepts & Modules
Define system concepts (Fees, Attendance, Hostel, Transport, Library, etc.)
Loading modules...
🗺️ API Registry & Dynamic ERP Field Mapper
Configure ERP endpoints and map raw client JSON response keys to PhinsIQ standard fields
📡 ERP Request Configuration
🧪 Live ERP Response Tester & Auto-Key Suggester
Call the client ERP directly to preview the JSON response and 1-click auto-map all extracted keys below!
🔄 Dynamic Field Response Mappings (Scalar fields only)
Map PhinsIQ Standard Fields → Client ERP JSON Keys. Only for direct scalar values — computed/aggregated fields are handled by the ArrayAggregator.
✓ Scalar fields only ⚡ Aggregated — configure in Schema tab
⚡ Aggregated Fields — No Mapping Needed Here
Fields like absent_count, attendance_percentage, absent_dates are computed automatically by the ArrayAggregator from the ERP array (e.g. attendance_data). You do not need to add them here in response_mapping — only add scalar fields like start_date and end_date. Configure aggregation rules in the 🏷️ Schema & Aliases tab.
🏷️ Field Definitions, NLP Aliases & Aggregation
Define fields, formats, search keywords, and optional array aggregation config for computed fields (counts, percentages, date lists)
Scalar (from ERP response_mapping) ⚡ Aggregated (computed from array)
🔧 Step 2 — What do each config fields mean?
Config Field What to enter Example
Source Array Field ★ The key in the ERP JSON response that holds the array attendance_data
holidays
calendar_events
Operation ★ What computation to do on the array (see table below) count_where
filter_dates
percentage
Filter Key The key inside each array item to filter on status
type
category
Filter Value The value that Filter Key must equal (case-insensitive) absent
holiday
public
Date Key The date field inside each item. Set it for date operations and for count_where when queries may ask for a time period. date
holiday_date
event_date
Decimal Places Only for percentage. How many decimal places to show 1 → 86.9%
0 → 87%
⚡ Step 3 — Which Operation should I pick?
Operation What it computes User query example Result type
count Total number of items in array "How many holidays are there?" Number (e.g. 14)
count_where Count items where filter_key = filter_value "How many absences?" / "How many public holidays?" Number (e.g. 8)
filter_dates List of dates where filter matches "Show my absent dates" / "List public holidays" Date list (e.g. 08 Jun, 22 Jun...)
filter_values List of any field values where filter matches "Show holiday names" Text list
percentage % of items matching filter out of total "What is my attendance %?" Percentage (e.g. 86.9%)
max_date Latest date in filtered items "When is my last holiday?" / "When was I last present?" Single date
min_date Earliest date in filtered items "When is the first holiday?" / "First absence date?" Single date
🗓️ Real Example — Adding a Holiday / Calendar Module
Say your ERP returns this for the holiday module:
{
  "academic_year": "2026-27",
  "holidays": [
    { "holiday_date": "2026-08-15", "name": "Independence Day", "type": "national" },
    { "holiday_date": "2026-10-02", "name": "Gandhi Jayanti", "type": "national" },
    { "holiday_date": "2026-09-10", "name": "School Annual Day", "type": "school" }
  ]
}
How to set up 4 fields for this module:
Field 1 — total_holidays
📡 Format: text
⚡ Aggregation: ON
🔷 Source Array: holidays
🔷 Operation: count (total items)
No filter needed — just counts all
→ "14 holidays this year"
Field 2 — national_holiday_count
📡 Format: text
⚡ Aggregation: ON
🔷 Source Array: holidays
🔷 Operation: count_where
🔷 Filter Key: type
🔷 Filter Value: national
→ "3 national holidays"
Field 3 — national_holiday_dates
📡 Format: date_list
⚡ Aggregation: ON
🔷 Source Array: holidays
🔷 Operation: filter_dates
🔷 Filter Key: type
🔷 Filter Value: national
🔷 Date Key: holiday_date
→ "15 Aug 2026, 02 Oct 2026"
Field 4 — academic_year (SCALAR)
📡 Format: text
⚡ Aggregation: OFF (it's a direct value)
→ Add academic_year → academic_year in ERP Mapper instead
→ "Academic Year: 2026-27"
⚠️ Key Rule: How do I know if aggregation is needed?
Look at the ERP JSON. Ask: "Is this field a single value, OR computed from a list of items inside an array?"
• If the ERP gives you total_holidays: 14 directly → SCALAR (map it in ERP Mapper)
• If the ERP gives you holidays: [...] and you want to count/filter/list → AGGREGATED (tick the ⚡ checkbox)
📝 Response Templates Studio
Customize phrasing for single-field responses and multi-variable summary messages
Individual Single-Field Templates
🎯 Client Sample Questions Manager
Manage client-specific natural language prompt questions stored in MongoDB
# Question Module Category Field Route Role Actions
Loading questions from MongoDB...
🌐 Website Knowledge & Web Crawler Studio
Register school website URLs by role, extract structured JSON knowledge, manage Q&A entities with NLP Aliases (RapidFuzz), and inspect live data.
Loading knowledge stats...
🏷️ Structured Q&A Entities & NLP Aliases 0 Q&A Items
Define what users can say to trigger each field/answer. RapidFuzz searches across all comma-separated NLP Aliases in real-time.
Loading Q&A entities and NLP aliases...
🏛️ Institution Subject Notes Overview
Institution-specific subject note isolation. View document counts, chunks, and select institution context.
Loading institution cards…
📚 Upload Subject Notes & Teaching Modules
Upload institution-specific syllabus and chapter notes. Documents are validated, chunked, embedded via Gemini, and indexed into Subject RAG.
Answers link these pages separately and in a different colour, so a student can open the figure.
🧾 Uploaded Subject Notes
Active notes for the selected institution. Includes embedded PDF viewing, replace, edit metadata, and deletion.
Subject Module File Status Chunks Last Modified Actions
Loading notes…
🧪 Try a student question
Ask against a chosen module to see whether it answers from that module or falls back to the linked ones.
⚙️ System Tools & Quick Seed
Quickly populate starter data, clear runtime cache, and export database configurations
🌱 1-Click Starter Seed
Populate MongoDB with default settings for SJBHS, SAGS, standard modules, fee mappings, and response templates.
🔄 Clear In-Memory Cache
Force-flush all repository caches immediately so any external MongoDB edits take effect.
💾 Export Configurations
Download a JSON backup of institutions, modules, api_registry, fields, and templates.
Request Routes & AI Usage
All chat requests by route, engine, token use, and average latency.
Loading request metrics…
LLM Provider Usage
Provider/model calls, reported tokens, cache savings, and latency from the last 24 hours.
Loading provider usage…
Redis & Cache Overview
Shared Redis key counts, this API process’s activity, and its local caches.
Loading cache summary...
📡 PhinsIQ API Reference
🚀 Core — Chat Pipeline
POST /api/v1/phinsiq/chat ▼
Main NLP pipeline endpoint. Accepts a natural language question, routes it through module detection → ERP fetch → response formatting. Optionally invokes Claude AI fallback.
Request Body (JSON)
messageNatural language query (required)
institution_idClient institution key e.g. sjbhs
user_idStudent/Staff row_id used for ERP lookup
rolestudent | staff
use_claudeBoolean. When false, skips Claude entirely
📤 Request Example
{ "message": "What is my pending fee?", "institution_id": "sjbhs", "user_id": "ST123", "role": "student", "use_claude": true }
📥 Response Example
{ "answer": "Your pending fee balance is ₹29,300.", "module": "fees", "field": "pending_fee", "route": "/fees", "confidence": 0.97, "source": "erp_direct", "institution_id": "sjbhs" }
GET /health ▼
Server health check. Returns uptime, DB connection status, and version info.
📥 Response Example
{ "status": "healthy", "version": "2.0.0", "db": "connected", "uptime_seconds": 3600 }
❓ Sample Questions Catalog
GET /questions ▼
Fetch all sample questions from MongoDB for a specific client and role. Returns grouped categories + flat list. Used by the Playground dropdown.
Query Params
institution_idClient key e.g. sjbhs
rolestudent | staff
moduleOptional filter by module e.g. fees
📥 Response Example
{ "status": "success", "institution_id": "sjbhs", "role": "student", "total_questions": 42, "total_modules": 9, "modules": ["fees", "attendance", "homework", ...], "categories": { "fees": [ { "question": "What is my total fee?", "field": "total_fee", ... }, ... ] }, "questions": ["What is my total fee?", "What is my pending fee balance?", ...] }
🏢 Admin — Institutions
GET /api/v1/admin/institutions ▼
List all configured client institutions with ERP base URLs and roles.
📥 Response Example
[ { "_id": "sjbhs", "name": "St. Joseph's Boys' High School", "status": "active", "roles": ["student", "staff"], "api_config": { "base_url": "https://demo.parrophins.in/sjbhs" } } ]
POST /api/v1/admin/institutions ▼
Create or update a client institution configuration.
📤 Request Example
{ "_id": "new_client", "name": "New Client Institution", "status": "active", "roles": ["employee"], "api_config": { "base_url": "https://erp.newclient.com", "auth_type": "bearer" } }
🧩 Admin — Modules & API Registry
GET /api/v1/admin/modules ▼
List all ERP modules configured in the system (fees, attendance, homework, etc.).
📥 Response Example
[ { "_id": "fees", "display_name": "Fees & Payments", "status": "active" }, { "_id": "attendance", "display_name": "Attendance Tracker", "status": "active" }, { "_id": "homework", "display_name": "Homework", "status": "active" } ]
GET /api/v1/admin/registry ▼
List all ERP API registry entries — maps (institution, role, module) → ERP endpoint URL + field mappings.
📥 Response Example
[ { "institution_id": "sjbhs", "role": "student", "module": "fees", "action": "summary", "endpoint": "/student/apiviewFeePaymentInfo", "method": "POST", "payload_template": { "row_id": "{{user_id}}" } } ]
POST /api/v1/admin/registry ▼
Create or update an ERP API registry entry for a module.
📤 Request Example
{ "institution_id": "sjbhs", "role": "student", "module": "fees", "action": "summary", "endpoint": "/student/apiviewFeePaymentInfo", "method": "POST", "payload_template": { "row_id": "{{user_id}}" }, "response_root": "data" }
🏷️ Admin — Fields & NLP Aliases
GET /api/v1/admin/fields ▼
List all field definitions for a module including NLP keyword aliases used for intent matching.
📥 Response Example
[ { "module": "fees", "fields": [ { "field": "pending_fee", "display_name": "Pending Fee", "aliases": ["pending", "outstanding", "balance", "unpaid", "due"], "erp_key": "feePaymentPendingAmt" } ] } ]
📝 Admin — Response Templates
GET /api/v1/admin/templates ▼
List Jinja2 response templates used to format ERP data into natural language answers.
📥 Response Example
[ { "module": "fees", "action": "summary", "template": "Your pending fee balance is ₹{{ pending_fee | currency }}.", "fields": ["pending_fee", "total_fee", "paid_fee"] } ]
❓ Admin — Sample Questions CRUD
GET /api/v1/admin/questions ▼
List all sample questions (flat expanded list) for a given institution and role.
Query Params
institution_idFilter by client e.g. sjbhs
rolestudent | staff
moduleOptional module filter
POST /api/v1/admin/questions ▼
Add a new question to the consolidated (institution_id, role) document's module sub-array.
📤 Request Example
{ "institution_id": "sjbhs", "role": "student", "module": "fees", "category_label": "💰 Fees & Payments", "question": "When is my next fee installment due?", "field": "next_due_date", "description": "Returns the upcoming fee due date.", "route": "/fees" }
DELETE /api/v1/admin/questions/{institution_id} ▼
Remove a specific question from the module's questions array by matching exact question text.
Query Params (required)
rolee.g. student
modulee.g. fees
question_textExact question string to remove
📤 Example URL
DELETE /api/v1/admin/questions/sjbhs ?role=student &module=fees &question_text=What+is+my+total+fee%3F
POST /api/v1/admin/questions/seed ▼
Seed or re-seed the full default question set for a given institution and role from the built-in catalog.
Query Params
institution_idDefault: sjbhs
roleDefault: student
⚡ System — Cache & Seed
POST /api/v1/admin/cache/flush ▼
Flush all in-memory caches (institutions, modules, fields, registry, templates, questions). Forces fresh DB reads on next request.
📥 Response Example
{ "success": true, "message": "All caches flushed successfully." }
POST /api/v1/admin/seed-defaults ▼
1-click seed all default configurations (institutions, modules, fields, registry, templates, sample questions) into MongoDB.
📥 Response Example
{ "success": true, "message": "Standard configurations and sample questions seeded and loaded into MongoDB!" }
POST /api/v1/admin/test-erp ▼
Test a live ERP endpoint directly and auto-extract all available JSON keys from the response.
📤 Request Example
{ "institution_id": "sjbhs", "endpoint": "/student/apiviewFeePaymentInfo", "method": "POST", "payload": { "row_id": "ST123" } }