| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| ALTER TABLE IF EXISTS documents |
| ADD COLUMN IF NOT EXISTS education_extraction_status TEXT NOT NULL DEFAULT 'uploaded', |
| ADD COLUMN IF NOT EXISTS education_extraction_error TEXT, |
| ADD COLUMN IF NOT EXISTS education_warnings_json JSON DEFAULT '[]', |
| ADD COLUMN IF NOT EXISTS syllabus_items_count INTEGER NOT NULL DEFAULT 0, |
| ADD COLUMN IF NOT EXISTS pyq_questions_count INTEGER NOT NULL DEFAULT 0, |
| ADD COLUMN IF NOT EXISTS pyq_years_json JSON DEFAULT '[]'; |
|
|
| |
| |
| |
|
|
| ALTER TABLE IF EXISTS previous_questions |
| ADD COLUMN IF NOT EXISTS answer_type TEXT, |
| ADD COLUMN IF NOT EXISTS formula_needed BOOLEAN NOT NULL DEFAULT FALSE, |
| ADD COLUMN IF NOT EXISTS diagram_needed BOOLEAN NOT NULL DEFAULT FALSE, |
| ADD COLUMN IF NOT EXISTS extracted_answer_if_available TEXT, |
| ADD COLUMN IF NOT EXISTS confidence FLOAT NOT NULL DEFAULT 0.0, |
| ADD COLUMN IF NOT EXISTS source_origin TEXT NOT NULL DEFAULT 'user_uploaded'; |
|
|
| |
| |
| |
|
|
| |
| CREATE TABLE IF NOT EXISTS syllabus_items ( |
| id TEXT PRIMARY KEY, |
| user_id TEXT NOT NULL, |
| source_id TEXT, |
| board TEXT NOT NULL DEFAULT '', |
| class_level TEXT NOT NULL DEFAULT '', |
| stream TEXT NOT NULL DEFAULT '', |
| subject TEXT NOT NULL DEFAULT '', |
| chapter TEXT NOT NULL DEFAULT '', |
| topic TEXT NOT NULL DEFAULT '', |
| subtopic TEXT NOT NULL DEFAULT '', |
| formulas JSON DEFAULT '[]' NOT NULL, |
| derivations JSON DEFAULT '[]' NOT NULL, |
| proofs JSON DEFAULT '[]' NOT NULL, |
| numerical_patterns JSON DEFAULT '[]' NOT NULL, |
| diagrams JSON DEFAULT '[]' NOT NULL, |
| board_keywords JSON DEFAULT '[]' NOT NULL, |
| common_mistakes JSON DEFAULT '[]' NOT NULL, |
| official_status TEXT NOT NULL DEFAULT 'user_uploaded', |
| confidence FLOAT NOT NULL DEFAULT 0.0, |
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| ); |
|
|
| |
| CREATE INDEX IF NOT EXISTS ix_syllabus_items_user_id ON syllabus_items(user_id); |
| CREATE INDEX IF NOT EXISTS ix_syllabus_items_source_id ON syllabus_items(source_id); |
| CREATE INDEX IF NOT EXISTS ix_syllabus_items_subject_chapter ON syllabus_items(subject, chapter); |
|
|
| |
| CREATE TABLE IF NOT EXISTS chapter_patterns ( |
| id TEXT PRIMARY KEY, |
| user_id TEXT NOT NULL, |
| board TEXT NOT NULL DEFAULT '', |
| class_level TEXT NOT NULL DEFAULT '', |
| subject TEXT NOT NULL DEFAULT '', |
| chapter TEXT NOT NULL DEFAULT '', |
| total_questions INTEGER NOT NULL DEFAULT 0, |
| total_marks INTEGER NOT NULL DEFAULT 0, |
| repeated_topics JSON DEFAULT '[]' NOT NULL, |
| answer_type_distribution JSON DEFAULT '{}' NOT NULL, |
| years_seen JSON DEFAULT '[]' NOT NULL, |
| confidence FLOAT NOT NULL DEFAULT 0.0, |
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| ); |
|
|
| |
| CREATE INDEX IF NOT EXISTS ix_chapter_patterns_user_id ON chapter_patterns(user_id); |
| CREATE INDEX IF NOT EXISTS ix_chapter_patterns_subject_chapter ON chapter_patterns(subject, chapter); |
| CREATE INDEX IF NOT EXISTS ix_chapter_patterns_board_class_subject ON chapter_patterns(board, class_level, subject); |
|
|
| |
| |
| |
| |
| |
|
|
| |
| COMMENT ON COLUMN documents.education_extraction_status IS 'T2: Status of education extraction (uploaded, processing, completed, failed)'; |
| COMMENT ON COLUMN documents.education_extraction_error IS 'T2: Error message if extraction failed'; |
| COMMENT ON COLUMN documents.education_warnings_json IS 'T2: JSON array of extraction warnings'; |
| COMMENT ON COLUMN documents.syllabus_items_count IS 'T2: Number of syllabus items extracted from this document'; |
| COMMENT ON COLUMN documents.pyq_questions_count IS 'T2: Number of PYQ questions extracted from this document'; |
| COMMENT ON COLUMN documents.pyq_years_json IS 'T2: JSON array of years found in PYQ extraction'; |
|
|
| COMMENT ON COLUMN previous_questions.answer_type IS 'T2: Type of answer (derivation, numerical, proof, etc.)'; |
| COMMENT ON COLUMN previous_questions.formula_needed IS 'T2: Whether this question requires formula derivation'; |
| COMMENT ON COLUMN previous_questions.diagram_needed IS 'T2: Whether this question requires diagram drawing'; |
| COMMENT ON COLUMN previous_questions.extracted_answer_if_available IS 'T2: Extracted answer key if available'; |
| COMMENT ON COLUMN previous_questions.confidence IS 'T2: Confidence score for extraction (0.0 to 1.0)'; |
| COMMENT ON COLUMN previous_questions.source_origin IS 'T2: Origin of this question (user_uploaded, catalog_seed, etc.)'; |
|
|
| COMMENT ON TABLE syllabus_items IS 'T2: Extracted syllabus items from uploaded syllabus documents'; |
| COMMENT ON TABLE chapter_patterns IS 'T2: Aggregated PYQ patterns per chapter for trend analysis'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |