omarketlab_v3

Tables (8)

customer_result

  • customer_id — VARCHAR(50) — Foreign key → customers.customer_id — NOT NULL
  • segment — VARCHAR(10) — NOT NULL — 세그먼트 결과 값
  • recency — INTEGER — NOT NULL — 최근성
  • frequency — INTEGER — NOT NULL — 빈도
  • monetary — NUMERIC(14,2) — NOT NULL — 구매 금액
  • r_score — SMALLINT — NOT NULL — 최근성을 점수로 변환한 값
  • f_score — SMALLINT — NOT NULL — 빈도를 점수로 변환한 값
  • m_score — SMALLINT — NOT NULL — 구매 금액을 점수로 변환한 값
  • rfm_score — SMALLINT — NOT NULL — RFM 종합 점수(r+f+m 3~15)
  • rationale — TEXT — NOT NULL — 분류 근거(자연어)
  • analyzed_at — TIMESTAMPTZ — NOT NULL — 분석 실행 날짜
  • created_at — TIMESTAMPTZ — NOT NULL — 결과 생성 날짜

customers

  • customer_id — VARCHAR(50) — Primary key — NOT NULL

employees

  • employee_id — BIGSERIAL — Primary key — NOT NULL
  • username — VARCHAR(50) — NOT NULL — 사원 아이디
  • password — VARCHAR(255) — NOT NULL — 비밀번호
  • name — VARCHAR(100) — NOT NULL — 사원 이름
  • role — VARCHAR(20) — NOT NULL — 권한
  • created_at — TIMESTAMPTZ — NOT NULL — 가입 날짜
  • updated_at — TIMESTAMPTZ — NOT NULL — 수정 날짜

invoice_line

  • invoice_line_id — BIGSERIAL — Primary key — NOT NULL
  • invoice_id — VARCHAR(50) — Foreign key → invoices.invoice_id — NOT NULL — 송장 번호 (헤더 FK)
  • customer_id — VARCHAR(50) — Foreign key → invoices.customer_id — NOT NULL — 고객 ID (헤더와 동일하게 유지)
  • stock_code — VARCHAR(20) — Foreign key → products.stock_code — NOT NULL — 상품 코드
  • description — VARCHAR(100) — NOT NULL — 상품 이름 (구매 시점 스냅샷)
  • quantity — INTEGER — NOT NULL — 수량
  • price — NUMERIC(12,2) — NOT NULL — 개당 가격
  • total — NUMERIC(14,2) — NOT NULL — 총액

invoices

  • invoice_id — VARCHAR(50) — Primary key — NOT NULL — 송장 번호
  • customer_id — VARCHAR(50) — Foreign key → customers.customer_id — NOT NULL — 고객 ID
  • invoice_date — TIMESTAMPTZ — NOT NULL — 구매 날짜

products

  • stock_code — VARCHAR(20) — Primary key — NOT NULL
  • description — VARCHAR(100) — NOT NULL — 상품 이름 (정본)

recommend_products

  • recommend_id — BIGSERIAL — Primary key — NOT NULL
  • customer_id — VARCHAR(50) — Foreign key → customer_result.customer_id — NOT NULL
  • stock_code — VARCHAR(20) — Foreign key → products.stock_code — NOT NULL — 추천 상품 코드
  • similarity_score — NUMERIC(7,6) — NOT NULL — 유사도 점수
  • rank — SMALLINT — 추천 순위(유사도 후보 기준)
  • created_at — TIMESTAMPTZ — NOT NULL

recommend_reasons

  • customer_id — VARCHAR(50) — Foreign key → customer_result.customer_id — NOT NULL
  • input_data — JSONB — NOT NULL — 인풋값: Agent 입력 스냅샷(JSON)
  • rationale — TEXT — NOT NULL — 근거: 추천 사유(자연어)
  • result — JSONB — NOT NULL — 결과: 최종 추천 상품 목록(JSON)
  • created_at — TIMESTAMPTZ — NOT NULL