How tejas05wini/career_simulation_sys works
Project Type and Purpose
• Full-stack web application (Next.js + TypeScript) with embedded AI logic and rule/ontology engines.
• Purpose: Guide users through a simulated 10-year career path by combining user input, decision trees, rule-based matching, ontology lookups, and calls to Google’s Gemini AI.
Main Components
a. Client / Browser
– Next.js 13 “app” directory delivers React pages (app/layout.tsx, app/page.tsx).
– UI Components (components/ui/* and domain-specific components like career-matching.tsx, decision-tree.tsx).
b. Next.js Server / API Layer
– Server-Side Rendering (SSR) / Routing (app/page.tsx, app/layout.tsx).
– Serverless function: app/api/gemini/route.ts handles HTTP requests to our Gemini API client (lib/gemini-client.ts).
c. Business Logic Layer (Backend Utility Modules)
– Rule Engine (utils/career-matching.ts, rule-based logic in utils and Python scripts).
– Decision-Tree logic (components/decision-tree.tsx and possibly enhanced_simulation.py for advanced algorithms).
– Ontology-Based Matching (data/career-ontology.json + utils/ontology-map.ts).
– Report Generation (utils/report-generator.ts and template_generator.py for .txt outputs).
d. External AI Service
– Google Gemini API (accessed via lib/gemini-client.ts).
e. Data Layer
– JSON files (data/career-ontology.json).
– Potential file-based storage (.txt reports).
– No centralized DB—uses in-repo JSON and ephemeral state in memory or serverless functions.
f. Static Assets & Styling
g. Auxiliary Scripts (Offline/Microservice)
– statistical_model.py, enhanced_simulation.py, template_generator.py—can be represented as separate batch jobs or microservices that preprocess data or generate advanced simulations.
Relationships & Data Flow
• User interacts with the Browser UI → submits form (user-input-form.tsx) → request to Next.js API or page route.
• Next.js API (route.ts) orchestrates:
1. Validate input → forward to Rule Engine (utils/reporter, utils/career-matching).
2. Lookup ontology (data/career-ontology.json).
3. Call Gemini API (lib/gemini-client.ts) for narrative generation.
4. Post-process with Decision Tree logic.
5. Package results → return JSON response.
• Frontend consumes the response → updated simulation-results.tsx, enhanced-simulation-results.tsx.
• User can trigger report download → Report Generator creates .txt via template_generator.py or client-side download utility.
Architectural Patterns & Principles
– Separation of concerns: UI layer (React), API layer (Next.js serverless), business logic modules (utils + Python).
– Serverless functions for easy scaling of the AI call.
– Modular, file-based “data store” using JSON and Python scripts for offline analytics.
– Layered design: Presentation → API → Business Logic → Data/External Services.
a. Components & Layout
1. Top row “Clients”: Browser / Mobile App
2. Middle row “Frontend”: Next.js React Pages & Components
3. Middle row “API Layer”: Next.js Serverless Routes
4. Lower row “Business Logic”: Rule Engine, Ontology Service, Decision-Tree Module, Report Generator
5. External block “Gemini AI” (external)
6. Data block “Career Ontology JSON”
7. Optional block “Python Batch Services” (statistical_model.py, enhanced_simulation.py)
– Blue rectangles for UI components.
– Green for serverless/API modules.
– Orange for core logic engines.
– Gray for external services (Gemini AI).
– Clear labels: e.g., “Next.js Serverless API (/api/gemini)”, “Rule Engine (utils/career-matching.ts)”.
– Call-out key technologies: Next.js, React, Tailwind CSS, Google Gemini API, JSON Ontology.