smp
Tables (18)
business_changes
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- category — VARCHAR(100)
- title — VARCHAR(255)
- has_changed — TINYINT(1)
- change_date — DATE
- details — TEXT
- impact_scope — TEXT
business_profiles
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- factories — JSON
- machinery_value — DECIMAL(18,2)
- estimated_revenue — DECIMAL(18,2)
- export_destinations — JSON
- employee_process — JSON
chat_messages
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- user_id — CHAR(36) — Foreign key → users.id
- sender_type — ENUM( 'ai', 'user' )
- message — TEXT
- source_citation_ids — JSON
- created_at — DATETIME
citations
- id — CHAR(36) — Primary key — NOT NULL
- document_id — CHAR(36) — Foreign key → insurance_documents.id — NOT NULL
- page_number — INT
- section_title — VARCHAR(255)
- raw_snippet — TEXT
- bounding_box — JSON
companies
- id — CHAR(36) — Primary key — NOT NULL
- name — VARCHAR(255)
- business_number — VARCHAR(255)
- industry — VARCHAR(255)
- main_products — JSON
- headquarters — VARCHAR(255)
- annual_revenue — DECIMAL(18,2)
- created_at — DATETIME
company_memberships
- id — CHAR(36) — Primary key — NOT NULL
- company_id — CHAR(36) — Foreign key → companies.id — NOT NULL
- user_id — CHAR(36) — Foreign key → users.id — NOT NULL
- role — VARCHAR(50)
- joined_at — DATETIME
comparison_rows
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- category — VARCHAR(100)
- field_key — VARCHAR(255)
- field_name — VARCHAR(255)
- display_order — INT
comparison_values
- id — CHAR(36) — Primary key — NOT NULL
- comparison_row_id — CHAR(36) — Foreign key → comparison_rows.id — NOT NULL
- option_id — CHAR(36) — Foreign key → contract_options.id — NOT NULL
- citation_id — CHAR(36) — Foreign key → citations.id
- normalized_value — TEXT
- diff_status — ENUM( 'identical', 'expanded', 'reduced', 'added', 'excluded', 'changed', 'unknown', 'incomparable' )
- diff_note — TEXT
contract_fields
- id — CHAR(36) — Primary key — NOT NULL
- option_id — CHAR(36) — Foreign key → contract_options.id — NOT NULL
- citation_id — CHAR(36) — Foreign key → citations.id
- field_key — VARCHAR(255)
- field_name — VARCHAR(255)
- ai_value — TEXT
- confirmed_value — TEXT
- review_status — ENUM( 'confirmed', 'conflict', 'review_required', 'unknown' )
- confidence — DECIMAL(5,4)
contract_options
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- option_type — ENUM( 'current', 'proposal_a', 'proposal_b' )
- label — VARCHAR(255)
- insurer_name — VARCHAR(255)
- display_order — INT
decision_packs
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- version — INT
- generation_status — VARCHAR(30)
- snapshot — JSON
- file_url — VARCHAR(500)
- generated_at — DATETIME
followup_questions
- id — CHAR(36) — Primary key — NOT NULL
- risk_item_id — CHAR(36) — Foreign key → risk_items.id — NOT NULL
- why_asked — TEXT
- question_text — TEXT
- options — JSON
- answer — TEXT
- status — ENUM( 'pending', 'answered' )
insurance_documents
- id — CHAR(36) — Primary key — NOT NULL
- option_id — CHAR(36) — Foreign key → contract_options.id — NOT NULL
- document_type — ENUM( 'policy', 'special_terms', 'endorsement', 'standard_terms', 'proposal' )
- file_name — VARCHAR(255)
- storage_key — VARCHAR(500)
- processing_status — ENUM( 'processing', 'processed', 'needs_type_check', 'failed' )
- page_count — INT
- uploaded_at — DATETIME
official_references
- id — CHAR(36) — Primary key — NOT NULL
- insurer — VARCHAR(255)
- title — VARCHAR(255)
- document_type — VARCHAR(100)
- section — VARCHAR(255)
- excerpt — TEXT
- source_url — VARCHAR(500)
review_sessions
- id — CHAR(36) — Primary key — NOT NULL
- company_id — CHAR(36) — Foreign key → companies.id — NOT NULL
- created_by — CHAR(36) — Foreign key → users.id — NOT NULL
- title — VARCHAR(255)
- coverage_start — DATE
- coverage_end — DATE
- current_stage — ENUM( 'upload', 'business', 'risk_map', 'compare', 'decision_pack' )
- status — ENUM( 'draft', 'in_progress', 'completed' )
- updated_at — DATETIME
risk_assessments
- id — CHAR(36) — Primary key — NOT NULL
- risk_item_id — CHAR(36) — Foreign key → risk_items.id — NOT NULL
- option_id — CHAR(36) — Foreign key → contract_options.id — NOT NULL
- citation_id — CHAR(36) — Foreign key → citations.id
- status — ENUM( 'covered', 'partial', 'lack_of_evidence', 'review_required', 'gap_candidate' )
- note — TEXT
risk_items
- id — CHAR(36) — Primary key — NOT NULL
- review_id — CHAR(36) — Foreign key → review_sessions.id — NOT NULL
- official_reference_id — CHAR(36) — Foreign key → official_references.id
- category — VARCHAR(100)
- risk_title — VARCHAR(255)
- business_evidence — TEXT
- connected_field_key — VARCHAR(255)
- status — ENUM( 'covered', 'partial', 'lack_of_evidence', 'review_required', 'gap_candidate' )
- status_reason — TEXT
users
- id — CHAR(36) — Primary key — NOT NULL
- email — VARCHAR(255)
- name — VARCHAR(255)
- password_hash — VARCHAR(255)
- status — VARCHAR(30)
- created_at — DATETIME