Skip to content

Data Dictionary · Ngân hàng đề ​

⚙️ Trang này sinh tự động từ source code bằng scripts/gen-reference.mjs — đừng sửa tay, sửa code rồi chạy npm run gen:reference.

Thuộc Data Dictionary. 5 bảng, exam_attempt_answers tới target_schools.

exam_attempt_answers ​

migration: 0004_exam_bank.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
attempt_idTEXTNOT NULL REFERENCES exam_attempts(id)
question_idTEXTNOT NULL
node_idTEXT—
selected_indexINTEGERNOT NULL
correctINTEGERNOT NULL
points_awardedREALNOT NULL DEFAULT 0
created_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))

Khóa ngoại: attempt_id → exam_attempts

Index: idx_attempt_answers_attempt(attempt_id)

exam_attempts ​

migration: 0004_exam_bank.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
exam_idTEXTNOT NULL REFERENCES exams(id)
learner_idTEXTNOT NULL REFERENCES learners(id)
subject_idTEXTNOT NULL
statusTEXTNOT NULL DEFAULT 'in_progress' CHECK (status IN ('in_progress','completed','abandoned'))
scoreREAL—
max_scoreREAL—
started_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
completed_atTEXT—

Khóa ngoại: exam_id → exams · learner_id → learners

Index: idx_exam_attempts_learner(learner_id)

exam_questions ​

migration: 0004_exam_bank.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
exam_idTEXTNOT NULL REFERENCES exams(id)
ordINTEGERNOT NULL
node_idTEXT—
subject_idTEXTNOT NULL
promptTEXTNOT NULL
options_jsonTEXTNOT NULL
correct_indexINTEGERNOT NULL
pointsREALNOT NULL DEFAULT 1
item_refTEXT—

Khóa ngoại: exam_id → exams

Index: idx_exam_questions_exam(exam_id, ord)

exams ​

migration: 0004_exam_bank.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
subject_idTEXTNOT NULL
exam_typeTEXTNOT NULL CHECK (exam_type IN ('semester','selective'))
title_viTEXTNOT NULL
gradeINTEGER—
target_school_idTEXTREFERENCES target_schools(id)
provinceTEXT—
yearINTEGER—
difficulty_tierTEXTNOT NULL DEFAULT 'basic' CHECK (difficulty_tier IN ('basic','standard','advanced'))
duration_minutesINTEGERNOT NULL DEFAULT 45
statusTEXTNOT NULL DEFAULT 'published' CHECK (status IN ('draft','published','archived'))
sourceTEXTNOT NULL DEFAULT 'generated'
created_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
termTEXTCHECK (term IN ('giua_ki_1','cuoi_ki_1','giua_ki_2','cuoi_ki_2')) — thêm ở 0015_exam_metadata.sql
exam_roundTEXTCHECK (exam_round IN ('dieu_kien','chuyen')) — thêm ở 0015_exam_metadata.sql
specialist_subjectTEXT— thêm ở 0015_exam_metadata.sql
exam_systemTEXT— thêm ở 0015_exam_metadata.sql
school_yearTEXT— thêm ở 0015_exam_metadata.sql
exam_dateTEXT— thêm ở 0015_exam_metadata.sql
source_refTEXT— thêm ở 0015_exam_metadata.sql
verifiedINTEGERNOT NULL DEFAULT 0 — thêm ở 0015_exam_metadata.sql
source_urlTEXT— thêm ở 0035_exam_provenance.sql
source_kindTEXTCHECK (source_kind IN ('generated','real')) — thêm ở 0035_exam_provenance.sql
provenance_jsonTEXT— thêm ở 0035_exam_provenance.sql
immutable_after_publishINTEGERNOT NULL DEFAULT 0 — thêm ở 0035_exam_provenance.sql
solution_authored_byTEXT— thêm ở 0035_exam_provenance.sql
paper_codeTEXT— thêm ở 0041_exam_terms.sql

Khóa ngoại: target_school_id → target_schools

Index: idx_exams_subject(subject_id, exam_type, grade) · idx_exams_source_kind(source_kind, status) · idx_exams_term(subject_id, grade, term, paper_code)

target_schools ​

Migration 0004 — Exam Bank. SDD-011 §3-4, REQ-EXAM-01..04. Turtle: đề học kỳ (semester, generic). Shark: đề theo trường (selective, target_school).

migration: 0004_exam_bank.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
nameTEXTNOT NULL
provinceTEXT—
kindTEXTNOT NULL DEFAULT 'chuyen' CHECK (kind IN ('chuyen','chon','thuong'))
sourceTEXTNOT NULL DEFAULT 'chuyenchon'
slugTEXT— thêm ở 0047_school_registry.sql
short_nameTEXT— thêm ở 0047_school_registry.sql
managed_byTEXT— thêm ở 0047_school_registry.sql
websiteTEXT— thêm ở 0047_school_registry.sql
established_yearINTEGER— thêm ở 0047_school_registry.sql
summaryTEXT— thêm ở 0047_school_registry.sql
descriptionTEXT— thêm ở 0047_school_registry.sql
logo_media_idTEXT— thêm ở 0047_school_registry.sql
hero_media_idTEXT— thêm ở 0047_school_registry.sql
statusTEXTNOT NULL DEFAULT 'draft' — thêm ở 0047_school_registry.sql
display_orderINTEGERNOT NULL DEFAULT 100 — thêm ở 0047_school_registry.sql
updated_atTEXT— thêm ở 0047_school_registry.sql

Index: idx_target_schools_slug(slug) UNIQUE · idx_target_schools_public(status, province, display_order)