Add HTTP endpoint for weak-topic-detection (GET /weak-topics, JWT-aut… - #107
Merged
Matee-ur-Rehman merged 1 commit intoSep 2, 2026
Conversation
…h'd); fix import paths; add pyjwt to requirements
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
Exposes Weak Topic Detection over HTTP so Team Pluto's frontend can call it (previously only usable as internal Python code — no route existed despite the file being named weak_topic_api.py).
What was added
weak_topic_detection/app/main.py (new) — FastAPI app with GET /health and GET /weak-topics
GET /weak-topics requires Authorization: Bearer , reusing the same auth dependency already built for quiz_generator (no duplicated auth logic)
Fixed broken imports across 4 files (from app.... → from weak_topic_detection.app....) — same class of bug found and fixed earlier in quiz_generator
Added pyjwt to requirements.txt (was missing despite being a real dependency)
Known limitation (documented in code)
WeakTopicService currently reads from a static demo dataset (data/quiz_results.json), not live per-user quiz submissions. Auth/user_id is correctly enforced and returned, but results aren't filtered by user yet — that requires real quiz-result ingestion, which is separate follow-up work.
Testing
Verified locally end-to-end: server starts cleanly, /health returns 200 {"status": "ok"} via the interactive /docs page.
Note
Currently tested on port 8003 locally — not yet an officially confirmed port. Needs sign-off before docs/api-contracts.md is updated.