Extraction wrote straight into `questions`, so a machine's first attempt took a permanent id the moment it was produced. Ids come from a sequence and are never reissued: every rejected draft burned one, and every draft that needed fixing was sitting in the bank while it was being fixed. A run now lands in a batch of drafts with their own table and their own sequence. They are read, corrected and decided there, and `accept` is the only place a Question is created — a copy rather than a translation, because every field a draft holds is a field a question has, so nothing is lost at the moment of acceptance. Accepting is all or nothing, and everything is checked before anything is created: a call that reports failure must not leave questions behind from the drafts it got through first. My own test caught that — the first question existed before the second draft was refused. Readiness is reported for every draft rather than only on the attempt to accept it, so a reviewer sees what needs work before opening anything. A decided draft keeps its row and records what it became, so a batch reads as a history of what was decided rather than emptying as it is worked through. An acceptance cannot be undone from here: the question exists, and deciding twice would make a second one. No embeddings for drafts. A vector is for finding a question in the bank, and a draft is not in the bank. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
from app.models.user import User
|
|
from app.models.pdf_document import PDFDocument
|
|
from app.models.section import Section
|
|
from app.models.quiz import Quiz
|
|
from app.models.question import Question
|
|
from app.models.attempt import QuizAttempt, AttemptAnswer
|
|
from app.models.ai_model_config import AIModelConfig
|
|
from app.models.favorite import Favorite
|
|
from app.models.user_note import UserNote
|
|
from app.models.lab_reference import LabReference, LabReferenceCardLink
|
|
from app.models.article import Article, QuestionArticleLink
|
|
from app.models.flashcard import FlashcardDeck, Flashcard, FlashcardDeckRating, FlashcardQuestionLink, FlashcardArticleLink
|
|
from app.models.question_category import QuestionCategory, QuestionCategoryLink
|
|
from app.models.collection import UserCollection, UserCollectionQuestion
|
|
|
|
__all__ = [
|
|
"User",
|
|
"PDFDocument",
|
|
"Section",
|
|
"Quiz",
|
|
"Question",
|
|
"QuizAttempt",
|
|
"AttemptAnswer",
|
|
"AIModelConfig",
|
|
"Favorite",
|
|
"UserNote",
|
|
"LabReference",
|
|
"LabReferenceCardLink",
|
|
"Article",
|
|
"QuestionArticleLink",
|
|
"FlashcardDeck",
|
|
"Flashcard",
|
|
"FlashcardDeckRating",
|
|
"FlashcardQuestionLink",
|
|
"FlashcardArticleLink",
|
|
"QuestionCategory",
|
|
"QuestionCategoryLink",
|
|
"UserCollection",
|
|
"UserCollectionQuestion",
|
|
]
|
|
|
|
from app.models.feedback import QuestionFeedback # noqa: F401
|
|
from app.models.invite import InviteCode # noqa: F401
|
|
from app.models.draft_question import DraftBatch, DraftQuestion # noqa: F401
|