How archiecodespiece/patrarekhaai works
PatraRekha’s documented primary workflow takes a PDF through preprocessing, semantic chunking, Gemini embeddings, and Pinecone upsert; Pinecone also supports search and deletion. The repository additionally contains a web interface and a Supabase-backed file/email backend, but the excerpts do not establish an end-to-end connection from those interfaces to vector search. Edges reflect shown calls, source-index references, or README-documented stages; unsampled wiring is omitted.
Main entry points: main.py Pipeline entrypoint · pdf_processor.py PDF processing · Chunking/pipeline.py Chunk pipeline · embedding/pipeline.py Embedding pipeline
Components 28
Document preprocessing
- PDF processing
document preprocessing/pdf_processor.py - OCR engine
document preprocessing/ocr_engine.py - Table extraction
document preprocessing/table_extraction.py - Text cleaning
document preprocessing/text_cleaner.py - Document metadata
document preprocessing/document_metadata.py
AI ingestion pipeline
- Pipeline entrypoint
main.py - Chunk pipeline
AI pipeline/Chunking/pipeline.py - Document and chunk models
AI pipeline/Chunking/models.py - Semantic chunking
AI pipeline/Chunking/semantic.py - Token chunk splitter
AI pipeline/Chunking/splitter1.py - Embedding pipeline
AI pipeline/embedding/pipeline.py - Embedding results
AI pipeline/embedding/models.py
File and vector storage
- Vector store pipeline
AI pipeline/vectorstore/pipeline.py - Pinecone connector
AI pipeline/vectorstore/pinecone_store.py - Backend API
backend/api/main.py - Email ingestion
backend/email-ingestion/ingest.py - File operations
backend/db/files.py
Web application
- Home page
frontend/src/app/page.js - Navigation sidebar
frontend/src/components/sidebar.jsx - Chat page
frontend/src/app/chat/page.js - PDF chat interface
frontend/src/components/chatpdf.jsx - Calendar page
frontend/src/app/calendar/page.js - Calendar interface
frontend/src/components/calendar.jsx
Other components
- PDF user
- Gemini API
- Pinecone index
- Supabase
- Web user
Connections 24
- PDF user → Pipeline entrypoint: submits PDF
- Pipeline entrypoint → PDF processing: preprocesses PDF
main.py - PDF processing → OCR engine: runs OCR
document preprocessing/pdf_processor.py - OCR engine → Table extraction: reconstructs tables
document preprocessing/ocr_engine.py - PDF processing → Table extraction: extracts tables
document preprocessing/pdf_processor.py - PDF processing → Text cleaning: cleans text
document preprocessing/pdf_processor.py - Pipeline entrypoint → Chunk pipeline: chunks JSON
main.py - Chunk pipeline → Document and chunk models: builds documents
AI pipeline/Chunking/pipeline.py - Chunk pipeline → Semantic chunking: processes document
AI pipeline/Chunking/pipeline.py - Semantic chunking → Document and chunk models: uses models
AI pipeline/Chunking/semantic.py - Token chunk splitter → Document and chunk models: uses models
AI pipeline/Chunking/splitter1.py - Pipeline entrypoint → Embedding pipeline: embeds chunks
main.py - Embedding pipeline → Embedding results: builds results
AI pipeline/embedding/pipeline.py - Embedding pipeline → Gemini API: requests embeddings
- Pipeline entrypoint → Vector store pipeline: uploads embeddings
main.py - Vector store pipeline → Pinecone connector: delegates storage
AI pipeline/vectorstore/pipeline.py - Pinecone connector → Pinecone index: upserts and queries
AI pipeline/vectorstore/pinecone_store.py - Backend API → File operations: uses file operations
backend/api/main.py - Email ingestion → File operations: uses file operations
backend/email-ingestion/ingest.py - File operations → Supabase: stores and lists files
backend/db/files.py - Web user → Home page: uses web app
frontend/src/app/page.js - Home page → Navigation sidebar: renders navigation
- Chat page → PDF chat interface: renders chat
frontend/src/app/chat/page.js - Calendar page → Calendar interface: renders calendar
frontend/src/app/calendar/page.js