How favas-fv8/hr_policy_assistant works
HR Policy Assistant supports HR-admin account and policy-document management, plus employee authentication, document browsing, and grounded policy Q&A. The central workflow is PDF upload, extraction and chunking, embedding and storage, then question embedding, similarity retrieval, and an answer with source references. The graph includes the frontend, API/domain areas, and the RAG internals. Some backend views and frontend pages were not excerpted; their capabilities and links are included only where the README or source index supports them.
Main entry points: pipeline.py RAG pipeline · App.tsx Application routes · chatService.ts Chat service · documentService.ts Document service
Components 22
Web application
- Application routes
frontend/hr-frontend/src/App.tsx - Chat interface
frontend/hr-frontend/src/pages/chat.tsx - Document library
frontend/hr-frontend/src/pages/documents.tsx - Employee management
frontend/hr-frontend/src/pages/employees.tsx - HTTP client
frontend/hr-frontend/src/services/http.ts - Chat service
frontend/hr-frontend/src/services/chatService.ts - Document service
frontend/hr-frontend/src/services/documentService.ts
Identity and access
- Auth state
frontend/hr-frontend/src/state/authContext.tsx - Accounts API
backend/accounts
Policy documents
- Documents API
backend/documents - Processing task
backend/documents/tasks.py
Retrieval and answers
- Chat API
backend/chat/api/views.py - RAG pipeline
backend/rag/pipeline.py - Text chunking
backend/rag/chunking.py - Embedding generator
backend/embeddings/generator.py - Similarity search
backend/vector/similarity.py
Persistent data
- Document and chunk models
backend/documents/models.py - Conversations and messages
backend/chat/models.py - PostgreSQL
Other components
- Employee
- HR admin
- Google Gemini
Connections 28
- Employee → Application routes: uses
- HR admin → Application routes: uses
- Application routes → Chat interface: routes to
frontend/hr-frontend/src/App.tsx - Application routes → Document library: routes to
frontend/hr-frontend/src/App.tsx - Application routes → Employee management: routes to
frontend/hr-frontend/src/App.tsx - Application routes → Auth state: uses
frontend/hr-frontend/src/App.tsx - Chat interface → Chat service: calls
frontend/hr-frontend/src/pages/chat.tsx - Document library → Document service: calls
frontend/hr-frontend/src/pages/documents.tsx - Employee management → Accounts API: manages users
- Auth state → HTTP client: calls
frontend/hr-frontend/src/state/authContext.tsx - Chat service → HTTP client: calls
frontend/hr-frontend/src/services/chatService.ts - Document service → HTTP client: calls
frontend/hr-frontend/src/services/documentService.ts - Auth state → Accounts API: requests auth
frontend/hr-frontend/src/state/authContext.tsx - Chat service → Chat API: requests chat
- Document service → Documents API: requests documents
frontend/hr-frontend/src/services/documentService.ts - Documents API → Processing task: starts processing
backend/documents/tasks.py - Processing task → RAG pipeline: calls
backend/documents/tasks.py - Chat API → RAG pipeline: calls
backend/chat/api/views.py - RAG pipeline → Text chunking: chunks text
backend/rag/pipeline.py - RAG pipeline → Embedding generator: generates vectors
backend/rag/pipeline.py - RAG pipeline → Similarity search: searches vectors
backend/rag/pipeline.py - RAG pipeline → Document and chunk models: reads and writes
backend/rag/pipeline.py - Embedding generator → Google Gemini: requests embeddings
- RAG pipeline → Google Gemini: requests answers
- Similarity search → Document and chunk models: retrieves chunks
- Document and chunk models → PostgreSQL: persists
- Conversations and messages → PostgreSQL: persists
- Chat API → Conversations and messages: manages history