운전원이 올린 엑셀 템플릿의 {{ metric=...; column=... }} 토큰을, 선택한 날짜의
결정론 계산값으로 채워 다운로드하는 셀프서비스 리포트 레이어(P0).
- 메트릭 3종: energy_efficiency·yield·control_residual (분 버킷 피벗, 클린필터,
KST→UTC 경계). history_table(60s)·fast_record(s/min) 동일 long 포맷이라 source만 교체.
- 컬럼→태그 매핑은 기존 appsettings SteamAdvisor:Columns 재사용(7컬럼 무료).
- EPPlus 토큰 치환 + 셀 주석에 해상도 메타(source/sampling/n/keep) 부착.
- report_template/report_run 테이블 + cells_json 감사 박제.
- 리포트 탭(웹 UI) + 샘플 템플릿.
검증: 빌드 0에러. E2E 라운드트립 실동작(2026-05-15 C-6111 효율 0.778·수율 0.872·
잔차 mean 0.746 — 오프라인 검증값과 일치). 결정론 검증 게이트 준수(표본0=N/A, 0 날조 금지).
⚠️ EPPlus는 NonCommercial 컨텍스트 — 상용 출시 전 라이선스 정리 필요.
설계: docs/작업플랜-셀프서비스-분석리포트-MVP-P0-상세설계.md
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.3 KiB
SQL
29 lines
1.3 KiB
SQL
-- P0 셀프서비스 리포트 — 테이블 2개 (hc900 스키마)
|
|
-- 적용: psql "host=localhost dbname=iiot_platform user=postgres" -f scripts/sql/p0_report.sql
|
|
SET search_path TO hc900;
|
|
|
|
-- 운전원이 올린 엑셀 템플릿 + 메타
|
|
CREATE TABLE IF NOT EXISTS hc900.report_template (
|
|
id serial PRIMARY KEY,
|
|
name text NOT NULL,
|
|
owner text,
|
|
xlsx_blob bytea NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
-- 생성 이력(감사·재현). 어떤 정의로 어떤 기간을 뽑았는지 박제
|
|
CREATE TABLE IF NOT EXISTS hc900.report_run (
|
|
id bigserial PRIMARY KEY,
|
|
template_id int REFERENCES hc900.report_template(id) ON DELETE CASCADE,
|
|
period_kind text NOT NULL, -- 'DAILY'
|
|
period_date date NOT NULL, -- KST 기준 날짜
|
|
source_table text NOT NULL, -- 'history_table' | 'fast_record'
|
|
generated_at timestamptz NOT NULL DEFAULT now(),
|
|
status text NOT NULL, -- 'ok' | 'partial' | 'error'
|
|
cells_json jsonb, -- 채운 셀=메트릭+파라미터+값+sampling메타 박제
|
|
out_blob bytea -- 채워진 .xlsx (다운로드 캐시)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_report_run_template ON hc900.report_run(template_id, period_date);
|