Skip to content

Data Dictionary · Tri thức & Learner Model ​

⚙️ 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. 11 bảng, assessment_responses tới subjects.

assessment_responses ​

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
session_idTEXTNOT NULL REFERENCES assessment_sessions(id)
learner_idTEXTNOT NULL
item_idTEXTNOT NULL
subject_idTEXTNOT NULL
node_idTEXTNOT NULL
selected_indexINTEGERNOT NULL
correctINTEGERNOT NULL
response_msINTEGER—
created_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))

Khóa ngoại: session_id → assessment_sessions

Index: idx_responses_session(session_id) · idx_responses_learner_time(learner_id, created_at DESC, item_id) · idx_responses_learner_subject(learner_id, subject_id, created_at DESC)

assessment_sessions ​

Assessment sessions + responses.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
learner_idTEXTNOT NULL REFERENCES learners(id)
subject_idTEXTNOT NULL
kindTEXTNOT NULL DEFAULT 'diagnostic' CHECK (kind IN ('diagnostic','placement','practice','mastery_check'))
statusTEXTNOT NULL DEFAULT 'in_progress' CHECK (status IN ('in_progress','completed','abandoned'))
item_ids_jsonTEXTNOT NULL
created_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
completed_atTEXT—
adaptive_jsonTEXT— thêm ở 0069_diagnostic_adaptive.sql

Khóa ngoại: learner_id → learners

Index: idx_sessions_learner(learner_id, subject_id)

blueprints ​

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
subject_idTEXTNOT NULL REFERENCES subjects(id)
title_viTEXTNOT NULL
kindTEXTNOT NULL CHECK (kind IN ('conditional','specialized'))
cut_scoreREAL—
max_scoreREAL—
descriptionTEXT—

Khóa ngoại: subject_id → subjects

items ​

Item Bank (SDD-004 §9) — question tái sử dụng cho diagnostic/practice/assessment.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
subject_idTEXTNOT NULL
node_idTEXTNOT NULL
roleTEXTNOT NULL CHECK (role IN ('canonical','variant','boundary','discriminator'))
difficultyREALNOT NULL
promptTEXTNOT NULL
options_jsonTEXTNOT NULL
correct_indexINTEGERNOT NULL
misconceptionTEXT—
sourceTEXTNOT NULL DEFAULT 'chuyenchon'
statusTEXTNOT NULL DEFAULT 'published'
CHECK (status IN ('candidate','published','retired')) — thêm ở 0032_content_lifecycle.sql
quality_jsonTEXT— thêm ở 0032_content_lifecycle.sql
quality_scoreREAL— thêm ở 0032_content_lifecycle.sql
evaluator_countINTEGERNOT NULL DEFAULT 0 — thêm ở 0032_content_lifecycle.sql
created_atTEXT— thêm ở 0032_content_lifecycle.sql
updated_atTEXT— thêm ở 0032_content_lifecycle.sql
published_atTEXT— thêm ở 0032_content_lifecycle.sql
published_byTEXT— thêm ở 0032_content_lifecycle.sql
screen_flags_jsonTEXT— thêm ở 0032_content_lifecycle.sql
review_statusTEXTNOT NULL DEFAULT 'unreviewed' — thêm ở 0049_experience_review.sql
last_reviewed_atTEXT— thêm ở 0049_experience_review.sql
answer_kindTEXTNOT NULL DEFAULT 'mcq' — thêm ở 0073_item_answer_kinds.sql
answer_spec_jsonTEXT— thêm ở 0073_item_answer_kinds.sql
purpose_viTEXT— thêm ở 0178_item_purpose.sql

Index: idx_items_node(subject_id, node_id) · idx_items_status(status, subject_id, node_id) · idx_items_quality(status, quality_score) · idx_items_node_status(node_id, status) · idx_items_prompt_norm(LOWER(TRIM(prompt)

learner_evidence ​

Evidence Registry (SDD-002 §5) — immutable, idempotency key.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
event_idTEXTNOT NULL UNIQUE
learner_idTEXTNOT NULL REFERENCES learners(id)
subject_idTEXTNOT NULL
node_idTEXTNOT NULL
sourceTEXTNOT NULL
typeTEXTNOT NULL
observed_performanceREALNOT NULL
reliabilityREALNOT NULL
difficultyREAL—
payload_jsonTEXT—
occurred_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
mastery_beforeREAL— thêm ở 0044_evidence_mastery_delta.sql
mastery_afterREAL— thêm ở 0044_evidence_mastery_delta.sql

Khóa ngoại: learner_id → learners

Index: idx_evidence_learner_node(learner_id, subject_id, node_id) · idx_evidence_learner_time(learner_id, occurred_at)

learner_goals ​

Learner goal (chọn blueprint mục tiêu) — SDD-002 §3, SDD-008 §5.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
learner_idTEXTNOT NULL REFERENCES learners(id)
blueprint_idTEXTNOT NULL REFERENCES blueprints(id)
statusTEXTNOT NULL DEFAULT 'active' CHECK (status IN ('active','achieved','dropped'))
created_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
—table constraintPRIMARY KEY (learner_id, blueprint_id)

Khóa ngoại: learner_id → learners · blueprint_id → blueprints

learner_skill_state ​

Learner mastery state (SDD-002 §2, SDD-007 §14) — computed state, mastery/confidence 0..1.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
learner_idTEXTNOT NULL REFERENCES learners(id)
subject_idTEXTNOT NULL
node_idTEXTNOT NULL
masteryREALNOT NULL DEFAULT 0
confidenceREALNOT NULL DEFAULT 0
trajectoryTEXTNOT NULL DEFAULT 'unknown' CHECK (trajectory IN ('improving','stable','declining','unknown'))
evidence_countINTEGERNOT NULL DEFAULT 0
last_evidence_atTEXT—
updated_atTEXTNOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
—table constraintPRIMARY KEY (learner_id, subject_id, node_id)

Khóa ngoại: learner_id → learners

skill_edges ​

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
subject_idTEXTNOT NULL
from_nodeTEXTNOT NULL
to_nodeTEXTNOT NULL
typeTEXTNOT NULL CHECK (type IN ('prereq','related'))
—table constraintPRIMARY KEY (subject_id, from_node, to_node, type)

Index: idx_skill_edges_to(subject_id, to_node)

skill_nodes ​

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
subject_idTEXTNOT NULL REFERENCES subjects(id)
idTEXTNOT NULL
strandTEXTNOT NULL
gradeINTEGER—
levelINTEGER—
title_viTEXTNOT NULL
title_enTEXT—
descriptionTEXT—
effort_minutesINTEGER—
lab_slugTEXT—
sourceTEXTNOT NULL DEFAULT 'chuyenchon'
—table constraintPRIMARY KEY (subject_id, id)
title_enTEXT— thêm ở 0012_bilingual_taxonomy.sql
unitTEXT— thêm ở 0020_node_units.sql
unit_orderINTEGER— thêm ở 0020_node_units.sql
moduleTEXT— thêm ở 0023_node_modules.sql
module_orderINTEGER— thêm ở 0023_node_modules.sql
module_enTEXT— thêm ở 0025_module_unit_en.sql
unit_enTEXT— thêm ở 0025_module_unit_en.sql
module_shortTEXT— thêm ở 0042_short_names.sql
module_short_enTEXT— thêm ở 0042_short_names.sql
unit_shortTEXT— thêm ở 0042_short_names.sql
unit_short_enTEXT— thêm ở 0042_short_names.sql
review_statusTEXTNOT NULL DEFAULT 'unreviewed' — thêm ở 0049_experience_review.sql
hidden_atTEXT— thêm ở 0049_experience_review.sql
hidden_reasonTEXT— thêm ở 0049_experience_review.sql
last_reviewed_atTEXT— thêm ở 0049_experience_review.sql
reviewed_byTEXT— thêm ở 0049_experience_review.sql
objective_viTEXT— thêm ở 0049_experience_review.sql
depth_levelTEXT— thêm ở 0049_experience_review.sql
bloomTEXT— thêm ở 0049_experience_review.sql
pedagogyTEXT— thêm ở 0049_experience_review.sql
prerequisites_noteTEXT— thêm ở 0049_experience_review.sql
common_misconceptionTEXT— thêm ở 0049_experience_review.sql
why_painTEXT— thêm ở 0053_unit_why.sql
why_gainTEXT— thêm ở 0053_unit_why.sql
why_exampleTEXT— thêm ở 0053_unit_why.sql
can_doTEXT— thêm ở 0054_unit_can_do.sql
i_willTEXT— thêm ở 0057_i_will.sql
module_i_willTEXT— thêm ở 0057_i_will.sql
unit_evidenceTEXT— thêm ở 0065_unit_pearl_notes.sql
unit_misconceptionTEXT— thêm ở 0065_unit_pearl_notes.sql

Khóa ngoại: subject_id → subjects

Index: idx_skill_nodes_subject_grade(subject_id, grade) · idx_skill_nodes_unit(subject_id, strand, grade, unit_order) · idx_skill_nodes_module(subject_id, strand, module_order, unit_order) · idx_skill_nodes_course_source(source, subject_id)

strands ​

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
subject_idTEXTNOT NULL REFERENCES subjects(id)
codeTEXTNOT NULL
name_viTEXTNOT NULL
shortTEXT—
accentTEXT—
iconTEXT—
—table constraintPRIMARY KEY (subject_id, code)
name_enTEXT— thêm ở 0012_bilingual_taxonomy.sql
short_enTEXT— thêm ở 0042_short_names.sql
ordINTEGER— thêm ở 0043_strand_order.sql
i_willTEXT— thêm ở 0057_i_will.sql
big_ideaTEXT— thêm ở 0066_strand_big_idea.sql

Khóa ngoại: subject_id → subjects

Index: idx_strands_ord(subject_id, ord)

subjects ​

Migration 0002 — Knowledge Registry + Skill Graph + Item Bank + Learner Mastery. SDD-003 §2-3 (registry, graph), SDD-004 §9 (item bank), SDD-002 §2/§5 (learner state, evidence). Canonical skill (SDD-007 §5): PK (subject_id, id); school chỉ thêm context, không nhân bản.

migration: 0002_knowledge_learner.sql

CộtKiểuRàng buộc / ghi chú
idTEXTPRIMARY KEY
name_viTEXTNOT NULL
sourceTEXTNOT NULL DEFAULT 'chuyenchon'
name_enTEXT— thêm ở 0012_bilingual_taxonomy.sql