안전 이벤트 대시보드 보강

This commit is contained in:
Yun Chan 2026-07-01 12:34:46 +09:00
parent fe2796f05a
commit 51053af536
15 changed files with 1081 additions and 423 deletions

View file

@ -156,6 +156,7 @@ async def healthcheck() -> bool:
to_regclass('app.notification_delivery') IS NOT NULL AS has_notification_delivery,
to_regclass('app.sessions') IS NOT NULL AS has_sessions,
to_regclass('app.turns') IS NOT NULL AS has_turns,
to_regclass('app.safety_events') IS NOT NULL AS has_safety_events,
to_regclass('app.session_review_status') IS NOT NULL AS has_session_review_status,
EXISTS (
SELECT 1 FROM information_schema.columns
@ -171,6 +172,21 @@ async def healthcheck() -> bool:
GROUP BY table_schema, table_name
HAVING count(*) = 5
) AS has_turn_voice_metadata_columns,
EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_schema = 'app'
AND table_name = 'safety_events'
AND column_name IN (
'session_id',
'trigger_type',
'ko_risk_level',
'escalated',
'detail',
'created_at'
)
GROUP BY table_schema, table_name
HAVING count(*) = 6
) AS has_safety_event_columns,
EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_schema = 'app'
@ -198,8 +214,10 @@ async def healthcheck() -> bool:
and row["has_notification_delivery"]
and row["has_sessions"]
and row["has_turns"]
and row["has_safety_events"]
and row["has_session_review_status"]
and row["has_turn_voice_metadata_columns"]
and row["has_safety_event_columns"]
and row["has_session_review_worksheet_columns"]
)
except Exception: