1
Tables (26)
chat_message_sources
- source_tag — VARCHAR(32) — Primary key — NOT NULL — service_guide|db|document|web|solar|generated|db_rules
- message_id — VARCHAR(64) — Foreign key → chat_messages.message_id — NOT NULL — FK chat_messages.message_id
chat_messages
- message_id — VARCHAR(64) — Primary key — NOT NULL — Message UUID
- session_id — VARCHAR(64) — Foreign key → chat_sessions.session_id — NOT NULL — FK chat_sessions.session_id
- role — VARCHAR(16) — NOT NULL — user|assistant
- content — MEDIUMTEXT — NOT NULL — Message text
- created_at — VARCHAR(40) — ISO-8601
chat_sessions
- session_id — VARCHAR(64) — Primary key — NOT NULL — Client chat session id
- user_id — VARCHAR(255) — Foreign key → 회원.회원ID — FK users.user_id
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — FK documents.id when on document pages
- page_path — VARCHAR(255) — UI path e.g. /documents/{id}/translate
- created_at — VARCHAR(40) — ISO-8601
checklist_items
- id — VARCHAR(64) — Primary key — NOT NULL — Result row UUID
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- rule_id — VARCHAR(64) — NOT NULL — Rule id from checklist.yaml
- category — VARCHAR(64) — NOT NULL — formal|content|participatory|etc
- label — VARCHAR(512) — NOT NULL — Human-readable rule label
- status — VARCHAR(16) — NOT NULL — pass|warn|fail|manual
- detail — TEXT — Failure/warning detail message
checklist_reports
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- overall — VARCHAR(16) — NOT NULL — pass|warn|fail
- pass_count — INT — NOT NULL — Count of pass items
- warn_count — INT — NOT NULL — Count of warn items
- fail_count — INT — NOT NULL — Count of fail items
- manual_count — INT — NOT NULL — Count of manual-review items
- updated_at — VARCHAR(40) — ISO-8601
checklist_rules
- rule_id — VARCHAR(64) — Primary key — NOT NULL — Stable id from checklist.yaml
- category — VARCHAR(64) — NOT NULL — Rule category
- label — VARCHAR(512) — NOT NULL — Rule label
- severity — VARCHAR(16) — How it affects overall score
- enabled — TINYINT(1) — NOT NULL — 1 = active
cleared_image_slots
- user_browser_key — VARCHAR(64) — Primary key — NOT NULL — Client session key (sessionStorage today)
- line_index — INT — Primary key — NOT NULL — Item line_index user cleared with X
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- cleared_at — VARCHAR(40) — ISO-8601
document_full_text
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- full_text — MEDIUMTEXT — NOT NULL — Concatenated OCR text for whole document
document_json_backups
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- backup_path — VARCHAR(1024) — NOT NULL — Path data/docs/{doc_id}.json
- payload_json — MEDIUMTEXT — NOT NULL — DocumentResponse JSON for Vercel recovery
- updated_at — VARCHAR(40) — ISO-8601
document_pages
- page_num — INT — Primary key — NOT NULL — 1-based page index
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- page_text — MEDIUMTEXT — NOT NULL — OCR text for one page (from pages_jsoni)
document_source_files
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- storage_path — VARCHAR(1024) — NOT NULL — Path under data/uploads/{doc_id}_source.*
- original_filename — VARCHAR(512) — NOT NULL — Browser upload name
- mime_type — VARCHAR(128) — PDF/image/office mime if known
- byte_size — BIGINT — File size in bytes
- created_at — VARCHAR(40) — ISO-8601
document_summaries
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- summary_text — MEDIUMTEXT — NOT NULL — AI or manually edited summary
- generated_by — VARCHAR(32) — solar|manual|refine
- updated_at — VARCHAR(40) — ISO-8601
document_translations
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- translation_text — MEDIUMTEXT — Flat easy-read text (joined segments)
- updated_at — VARCHAR(40) — ISO-8601
export_jobs
- job_id — VARCHAR(64) — Primary key — NOT NULL — Export request id
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- user_id — VARCHAR(255) — Foreign key → 회원.회원ID — FK users.user_id if logged in
- format — VARCHAR(16) — NOT NULL — pdf|docx
- status — VARCHAR(32) — NOT NULL — pending|success|failed
- download_name — VARCHAR(512) — Attachment filename
- error_message — TEXT — Failure detail
- created_at — VARCHAR(40) — ISO-8601
- finished_at — VARCHAR(40) — ISO-8601
image_catalog
- image_file — VARCHAR(255) — Primary key — NOT NULL — PNG filename under /images
- title — VARCHAR(512) — NOT NULL — Searchable title
- source_url — VARCHAR(1024) — Optional external URL for web catalog items
image_placements
- id — VARCHAR(64) — Primary key — NOT NULL — Placement UUID
- segment_id — VARCHAR(64) — Foreign key → translation_segments.id — NOT NULL — FK translation_segments.id
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id (denormalized for queries)
- image_file — VARCHAR(255) — NOT NULL — Filename under /images or catalog key
- line_index — INT — NOT NULL — Line index in easy_text for numbered item slot
- title — VARCHAR(512) — Human title for the visual aid
- image_url — VARCHAR(1024) — Optional web/generated URL
- section_heading — VARCHAR(512) — Easy-read section heading context
- auto_filled — TINYINT(1) — NOT NULL — 1 = AI/auto fill; 0 = user drag
legal_db_entries
- entry_id — VARCHAR(64) — Primary key — NOT NULL — Surrogate key
- original_sentence — TEXT — NOT NULL — Judgment sentence key in LEGAL_DB
- easy_text — MEDIUMTEXT — NOT NULL — Canonical easy-read sentence
- title — VARCHAR(512) — Linked image title
- image_file — VARCHAR(255) — Foreign key → image_catalog.image_file — FK image_catalog.image_file
- match_priority — INT — Optional ranking hint
prompt_bundles
- bundle_id — VARCHAR(64) — Primary key — NOT NULL — summary_criminal|writing_civil|checklist|chatbot|usage_guide|...
- doc_type — VARCHAR(32) — Nullable when bundle is global
- file_path — VARCHAR(512) — NOT NULL — Path under backend/prompts or data/
- description — VARCHAR(512) — Short English description
runtime_settings
- setting_key — VARCHAR(64) — Primary key — NOT NULL — openai_api_key|chatbot_prompt|usage_guide_override|...
- setting_value — MEDIUMTEXT — YAML/JSON/text payload
- updated_at — VARCHAR(40) — ISO-8601
term_dictionaries
- dict_id — VARCHAR(32) — Primary key — NOT NULL — mohw|moleg|custom
- dict_name — VARCHAR(128) — NOT NULL — Human dictionary name
- enabled — TINYINT(1) — NOT NULL — 1=used in apply_terms_for_translation
- priority — INT — NOT NULL — Lower number = higher priority; mohw overrides moleg
- source_file — VARCHAR(255) — e.g. mohw_terms_dict.json
term_entries
- original_term — VARCHAR(512) — Primary key — NOT NULL — Source legal/hard term
- dict_id — VARCHAR(32) — Foreign key → term_dictionaries.dict_id — NOT NULL — FK term_dictionaries.dict_id
- recommended_term — VARCHAR(512) — NOT NULL — First recommended easy term
translation_segments
- id — VARCHAR(64) — Primary key — NOT NULL — Segment UUID
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- seq_no — INT — NOT NULL — Display order (0 = main full-doc segment today)
- original — TEXT — NOT NULL — Matched judgment sentence or seed snippet
- easy_text — MEDIUMTEXT — NOT NULL — Easy-read text; may include **bold** and <N>size</N>
- source — VARCHAR(16) — NOT NULL — db|solar|manual
- legacy_image_file — VARCHAR(255) — Old single-image field on segment
- legacy_image_url — VARCHAR(1024) — Old single-image URL on segment
- legacy_title — VARCHAR(512) — Old single-image title on segment
user_project_artifacts
- artifact_kind — VARCHAR(32) — Primary key — NOT NULL — source|summary|translation|translation_segments|easyread_txt|easyread_docx|easyread_pdf
- user_id — VARCHAR(255) — Foreign key → user_projects.user_id — NOT NULL — FK user_projects.user_id
- doc_id — VARCHAR(36) — Foreign key → user_projects.doc_id — NOT NULL — FK user_projects.doc_id
- file_name — VARCHAR(255) — NOT NULL — Filename inside project directory
- content_type — VARCHAR(64) — text/plain|application/pdf|docx mime
- byte_size — BIGINT — Optional size
- created_at — VARCHAR(40) — ISO-8601
user_projects
- user_id — VARCHAR(255) — Foreign key → 회원.회원ID — NOT NULL — FK users.user_id
- doc_id — VARCHAR(36) — Foreign key → 판결문.문서ID — NOT NULL — FK documents.id
- filename — VARCHAR(512) — Display filename in project list
- created_at — VARCHAR(40) — ISO-8601
- updated_at — VARCHAR(40) — ISO-8601
판결문 (documents)
- 문서ID (id) — VARCHAR(36) — Primary key — NOT NULL — Document UUID (primary business key)
- 파일명 (filename) — VARCHAR(512) — NOT NULL — Original upload filename
- 사건유형 (doc_type) — VARCHAR(32) — NOT NULL — criminal|civil|family|administrative|unknown
- 진행단계 (stage) — VARCHAR(32) — NOT NULL — uploaded|summarized|translated
- 페이지수 (page_count) — INT — NOT NULL — Number of OCR pages
- 생성일시 (created_at) — VARCHAR(40) — NOT NULL — ISO-8601 create time
- 수정일시 (updated_at) — VARCHAR(40) — NOT NULL — ISO-8601 last update time
회원 (users)
- 회원ID (user_id) — VARCHAR(255) — Primary key — NOT NULL — Login id / email. Sent as HTTP header X-User-Id
- 표시이름 (display_name) — VARCHAR(255) — Optional display name from signup
- 관리자여부 (is_admin) — TINYINT(1) — NOT NULL — 1 if email is in ADMIN_EMAILS
- 생성일시 (created_at) — VARCHAR(40) — ISO-8601 timestamp