How minhtrietcancode/rag-migration-law-chatbot works
Project type and purpose
• This is a full-stack Retrieval-Augmented Generation (RAG) chatbot application for the Australian Migration Act 1958. It comprises two main phases:
• Data Preparation: Parses PDFs, builds hierarchical indexes, generates JSON artifacts, and populates a vector database with embeddings.
• Chatbot Application: A Flask backend with modular packages handling query interpretation, vector search, metadata lookup, and LLM-powered response generation, alongside a simple single-page JavaScript frontend.
File structure
• Top-level directories:
• data_preparation/: Python scripts grouped into extract_index_pages, building_tree_index, building_search_tree, extract_content_pages, embedding_optimized_tree.
• src/: Flask app (app.py), orchestrator modules (main.py, config.py), and four packages (search_term_handler, my_searcher, database_admin, my_metadata_loader).
• frontend/: static JS/CSS and a Jinja template.
• json_tree_index/, json_search_tree/, extracted_index_pages/, final_json_searching_material/: intermediate and final JSON/embedding artifacts.
• vector_database/: ChromaDB storage.
• Configuration files: requirements.txt, src/config.py, .env for API keys.
• Design pattern: modular pipeline + layered RAG architecture.
README for additional insights
• The README describes a two-phase workflow: pre-process and live chatbot.
• It details each data_preparation sub-step and each src package’s responsibilities.
• It notes external dependencies: OpenRouter/LLM API, ChromaDB.