How apple-pie-h/mira works
MIRA is a civic legal assistant for Nepal. Citizens enter through the web app to upload documents for OCR-based simplification and rights mapping, ask land-law questions answered with retrieved legal context, or access civic document services and advocate listings. The backend exposes these capabilities through FastAPI routes; its RAG service coordinates embedding, retrieval, and answer generation. The README documents several product capabilities whose detailed implementations were not sampled, so those links are cited to the README rather than inferred from module names.
Main entry points: router.py API router · rag_service.py RAG answering · main.py FastAPI application · App.jsx Web app
Components 30
Web experience
- Web app
frontend/src/App.jsx - Landing page
frontend/src/pages/Landing.jsx - Dashboard
frontend/src/pages/Dashboard.jsx - Upload UI
frontend/src/components/Upload/UploadBox.jsx - Chat UI
frontend/src/components/Chat/ChatInterface.jsx - Advisor marketplace UI
frontend/src/components/Advisor/AdvisorGrid.jsx - Document services
frontend/src/components/Documents/DocumentServices.jsx - API client
frontend/src/services/api.js
API entrypoints
- FastAPI application
backend/app/main.py - API router
backend/app/api/router.py - Upload route
backend/app/api/routes/upload.py - Chat route
backend/app/api/routes/chat.py - Document Q&A route
backend/app/api/routes/ask.py - Marketplace route
backend/app/api/routes/advisor_marketplace.py - Voice route
backend/app/api/routes/voice.py
Document workflows
- OCR extraction
backend/app/services/ocr/extract.py - OCR preprocessing
backend/app/services/ocr/preprocess.py - Document analysis
backend/app/services/rag_service.py - Procedure roadmaps
backend/app/services/roadmap_service.py
Legal intelligence
- RAG answering
backend/app/services/rag_service.py - Text embeddings
backend/app/services/embedding_service.py - Legal sections
backend/app/services/legal_service.py - Citations
backend/app/services/citation_service.py - LLM generation
backend/app/services/llm_service.py
Platform data
- Qdrant vector store
backend/app/database/qdrant.py - PostgreSQL
backend/app/database/postgres.py - Groq API
- Advocate directory
backend/app/services/advisor_marketplace_service.py - Speech processing
backend/app/services/speech_service.py
Other components
- Citizen
Connections 30
- Citizen → Web app: uses
frontend/src/App.jsx - Web app → Landing page: shows
frontend/src/App.jsx - Web app → Dashboard: opens
frontend/src/App.jsx - Landing page → Dashboard: starts
frontend/src/App.jsx - Upload UI → API client: requests
frontend/src/components/Upload/UploadBox.jsx - Chat UI → API client: requests
frontend/src/components/Chat/ChatInterface.jsx - Advisor marketplace UI → API client: requests
frontend/src/components/Advisor/AdvisorGrid.jsx - FastAPI application → API router: mounts
backend/app/main.py - API router → Upload route: registers
backend/app/api/router.py - API router → Chat route: registers
backend/app/api/router.py - API router → Voice route: registers
backend/app/api/router.py - API router → Document Q&A route: registers
backend/app/api/router.py - API router → Marketplace route: registers
backend/app/api/router.py - FastAPI application → PostgreSQL: initializes
backend/app/main.py - FastAPI application → Qdrant vector store: prepares
backend/app/main.py - Upload route → OCR extraction: processes uploads
README.md - OCR extraction → OCR preprocessing: uses preprocessing
backend/app/services/ocr/extract.py - OCR extraction → Document analysis: summarizes and maps rights
README.md - Chat route → RAG answering: answers questions
README.md - Document Q&A route → RAG answering: answers document questions
README.md - RAG answering → Text embeddings: encodes query
backend/app/services/rag_service.py - RAG answering → Qdrant vector store: retrieves sections
backend/app/services/rag_service.py - RAG answering → LLM generation: generates answer
backend/app/services/rag_service.py - LLM generation → Groq API: calls
backend/app/services/llm_service.py - RAG answering → Legal sections: uses legal sections
backend/app/services/rag_service.py - Procedure roadmaps → Legal sections: looks up sections
backend/app/services/roadmap_service.py - Marketplace route → Advocate directory: serves listings
- Voice route → Speech processing: handles voice
- Document services → Citizen: generates downloadable forms
README.md - Citizen → Advisor marketplace UI: browses advocates
README.md