How ayushsaini9156/studypal works
Studypal is a Python-based, document-centric assistant built around Class 12 Biology study material. The repository is organized more like a content ingestion + retrieval system than a general web app.
1. Primary purpose
The core function appears to be turning biology PDFs into a searchable knowledge base for question answering or chatbot-style study help.
2. Source content boundary
The repository keeps the original source corpus in data_original/class_12/biology/ and a smaller working set in data/class_12/biology/. This separation suggests a raw-vs-processed split, where the original PDFs are preserved and the data/ tree is used for curated or transformed inputs.
3. Document ingestion layer
src/vectorize_book.py is the main signal for PDF-to-index processing. It likely extracts text from biology books, chunks content, and prepares embeddings or other searchable representations.
4. Additional ingestion path
src/vectorize_scripts.py indicates a second vectorization path for non-book content, likely scripts or transcript-like text sources. This suggests the system can ingest more than just PDFs.
5. External media acquisition
src/get_yt_video.py points to YouTube as an external content source. Architecturally, this is a separate utility that likely downloads or prepares video-derived study material before it enters the same vectorization pipeline.
6. Runtime application
src/main.py is the execution entry point. It likely loads the prepared knowledge base, accepts user queries, and routes them through retrieval plus response generation.
7. Shared chatbot logic
src/chatbot_utility.py likely holds reusable functions for prompt construction, retrieval formatting, conversation state, or response post-processing. This is the main shared boundary between ingestion artifacts and the interactive assistant.
8. Configuration and environment
src/env_template suggests the application relies on environment variables for runtime configuration, likely including model/provider credentials or paths to persisted artifacts. requirements.txt defines the Python dependency set that supports PDF handling, embedding/vectorization, and chatbot runtime behavior.
9. Offline vs online split
The architecture has a clear two-stage flow:
- Offline batch processing: PDFs or other media are ingested, transformed, and vectorized.
- Online query time: main.py uses the prebuilt index to answer questions interactively.
This is the main boundary to show in a diagram.
10. Data flow summary
Raw study material enters from data_original/ or external sources like YouTube, is normalized into data/ or intermediate text, then passed through vectorization scripts, and finally consumed by the main chatbot runtime.
11. What is not present
There is no sign of a separate database service, frontend application, or microservice layout. The repository looks like a compact Python monolith with utility scripts, data assets, and a runtime entry point.
12. Best diagram framing
Draw three boxes: content sources (data_original, YouTube), processing/indexing utilities (vectorize_book.py, vectorize_scripts.py, get_yt_video.py), and assistant runtime (main.py + chatbot_utility.py). The key artifact flowing between them is the processed vector/index representation of the biology corpus.
Main entry points: vectorize_book.py Book vectorizer · vectorize_scripts.py Script vectorizer · main.py Main app · requirements.txt Dependencies
Components 12
Content sources
Raw and curated study material inputs.
- Raw biology PDFs · Preserved original Class 12 Biology PDFs.
data_original/class_12/biology - Working biology PDFs · Smaller working set used for processing and experimentation.
data/class_12/biology - YouTube input · Video-based study material acquired from YouTube.
src/get_yt_video.py
Ingestion pipeline
Utilities that extract, normalize, and vectorize content.
- Book vectorizer · Extracts and chunks biology PDFs for indexing.
src/vectorize_book.py - Script vectorizer · Processes non-book or script-like study content into the same retrieval format.
src/vectorize_scripts.py - Video fetcher · Downloads or prepares YouTube-derived material before ingestion.
src/get_yt_video.py - Vector index · Persisted embeddings or searchable knowledge base built from study material.
Assistant runtime
Interactive query-time components.
- Main app · Runs the interactive assistant and handles user queries.
src/main.py - Chatbot utils · Common retrieval, prompt, and response helpers used by the runtime.
src/chatbot_utility.py - Env template · Environment variable template for runtime configuration.
src/env_template - Dependencies · Python packages supporting extraction, vectorization, and chat runtime.
requirements.txt
Corpus storage
Raw and working biology document sets.
- Biology corpus · Class 12 Biology document set as the primary domain corpus.
Connections 16
- Raw biology PDFs → Book vectorizer: source PDFs · Original PDFs are the main input to book ingestion.
- Working biology PDFs → Book vectorizer: working PDFs · Curated PDFs may also feed the same vectorization path.
- YouTube input → Video fetcher: fetch · External video content is acquired before processing.
- Video fetcher → Script vectorizer: transcript/text · Downloaded video-derived text enters the script ingestion path.
- Book vectorizer → Vector index: build index · Book ingestion produces searchable vectors or chunks.
- Script vectorizer → Vector index: build index · Script ingestion contributes to the same retrieval artifact.
- Vector index → Main app: retrieve · The runtime loads the prebuilt knowledge base at query time.
- Chatbot utils → Main app: shared helpers · Reusable chat and retrieval logic supports the main app.
- Env template → Main app: configure · Environment settings control runtime behavior and paths.
- Dependencies → Book vectorizer: supports · Dependencies enable PDF extraction and embedding work.
- Dependencies → Script vectorizer: supports · Dependencies also support script and media processing.
- Dependencies → Main app: supports · Runtime dependencies power the assistant entrypoint.
- Biology corpus → Raw biology PDFs: stored as · The primary biology corpus is preserved in the raw data tree.
- Biology corpus → Working biology PDFs: curated as · A smaller working subset is kept for processing.
- Book vectorizer → Chatbot utils: formats context · Ingestion output is shaped for downstream retrieval and prompt assembly.
- Script vectorizer → Chatbot utils: formats context · Script-derived content is normalized for the assistant pipeline.