pdf-quiz-generator/backend/app/models/section.py
ifedan-ed b876f13fac Initial commit: PDF Quiz Generator app
- FastAPI backend with JWT auth, roles (admin/moderator/user)
- PDF upload (up to 500MB) with streaming, PyMuPDF text extraction
- ChromaDB vectorization per page with metadata
- LiteLLM AI question extraction from PDF (not generation)
- Image extraction from PDF pages, graceful fallback
- Quiz modes: timed (countdown timer) + learning (answers shown inline)
- Page-by-page question navigation with dot navigator
- TTS endpoint using LiteLLM (Google Vertex / OpenAI voices)
- Admin dashboard: AI model management per task, user role management
- Moderator role: upload PDFs, create sections, generate quizzes
- Spaced repetition reminders via SMTP email (SM-2 intervals)
- APScheduler daily reminder jobs
- Celery + Redis for background PDF processing
- React frontend with all pages
- Docker Compose deployment (nginx + backend + celery + redis)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:04:53 +00:00

17 lines
622 B
Python

from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship
from app.database import Base
class Section(Base):
__tablename__ = "sections"
id = Column(Integer, primary_key=True, index=True)
document_id = Column(Integer, ForeignKey("pdf_documents.id"), nullable=False)
name = Column(String, nullable=False)
start_page = Column(Integer, nullable=False)
end_page = Column(Integer, nullable=False)
document = relationship("PDFDocument", back_populates="sections")
quizzes = relationship("Quiz", back_populates="section", cascade="all, delete-orphan")