Add multi-mode roadmap generation (topic/document/quiz_performance); … - #134
Merged
Matee-ur-Rehman merged 1 commit intoSep 19, 2026
Conversation
…fix .env path bug in chroma_store.py and relative path bug in weak_topic_service.py
|
@Matee-ur-Rehman is attempting to deploy a commit to the mrymfarid684-3634's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements multi-mode roadmap generation per the Study Roadmap Feature Gaps task — supports document, topic, and quiz_performance generation modes on POST /generate-roadmap.
What was added
mode field on the request (document | topic | quiz_performance), dispatched to three separate generation paths in roadmap_service.py
document mode: pulls all chunks for a document_id (ownership-scoped to the authenticated user) from the shared Chroma store, extracts topics via YAKE, generates a roadmap from real document content
quiz_performance mode: reuses WeakTopicService directly (cross-module import), marks weak topics as high priority
topic mode: unchanged from the original single-mode implementation
New get_document_chunks() in embedding/chroma_store.py — direct metadata lookup (not similarity search), enforces user_id ownership so a caller can't pull another user's document by guessing a document_id
New roadmap_generator/app/utils/topic_extractor.py — YAKE-based keyword extraction, reusing quiz_generator's existing YAKE config constants
Documented all three modes' request/response formats in docs/api-contracts.md
Bugs found and fixed along the way
chroma_store.py: .env path had one extra .parent, pointing at the repo root instead of ai-ml/ — meant CHROMA_API_KEY/CHROMA_TENANT/CHROMA_DATABASE were never actually loaded from ai-ml/.env, regardless of what was set there.
weak_topic_service.py: default data file path was a bare relative string ("data/quiz_results.json"), which only worked if the process happened to be started from inside weak_topic_detection/ itself. Fixed to resolve as an absolute path anchored to the file's own location.
Testing
All three modes verified end-to-end locally with a real JWT and real Chroma Cloud data:
topic — generated a correct 4-step Algorithms roadmap
quiz_performance — generated a correct roadmap from weak-topic demo data
document — generated a correct roadmap from a real uploaded PDF's actual extracted content (verified topics matched the source document's subject matter)
Note for reviewers
Checked web/backend/routes/roadmap.py on main — it currently calls the old single-mode contract with no mode field. Per the task's Submission: line, this is expected to be Pluto's separate web/roadmap-entry-points branch updating to match this new contract, not something this PR needs to stay compatible with.