-- STD-25 is a period AU metric, not the daily AU_FLAG metric.
-- Keep the evaluation evidence explicit so the LLM judge accepts the valid
-- weekly result shape produced by the NL2SQL tool.

UPDATE sg_ai_qa_question
   SET expected_focus = 'Weekly AU: use one as-of snapshot (BASE_DT=2026-07-15), '
       || 'count DISTINCT GUID whose LAST_CONN_DT is in the inclusive seven-day window '
       || '(2026-07-09 through 2026-07-15), with STD_USER_YN=''Y'' and EXPT_USER_YN=''N''. '
       || 'This is one aggregate result, not daily rows. Do not substitute daily AU_FLAG=1 for the period definition.',
       baseline_sql = TO_CLOB('SELECT COUNT(DISTINCT u."GUID") AS "RECENT_7DAY_AU"' || CHR(10)
         || 'FROM "SGMP_POC"."CZN_COMN_USER_MST" u' || CHR(10)
         || 'WHERE u."BASE_DT" = DATE ''2026-07-15''' || CHR(10)
         || '  AND u."LAST_CONN_DT" BETWEEN DATE ''2026-07-09'' AND DATE ''2026-07-15''' || CHR(10)
         || '  AND u."STD_USER_YN" = ''Y''' || CHR(10)
         || '  AND u."EXPT_USER_YN" = ''N'''),
       baseline_answer = 'RECENT_7DAY_AU=0',
       evaluation_rule_json = '{"required_sql_terms":["CZN_COMN_USER_MST","LAST_CONN_DT","STD_USER_YN","EXPT_USER_YN","COUNT"],"recommended_sql_terms":["BASE_DT"],"forbidden_sql_terms":["AU_FLAG"],"required_result_shape":"SINGLE_AGGREGATE"}',
       updated_at = SYSTIMESTAMP
 WHERE question_code = 'STD-25';

/

COMMIT;

/

SELECT question_code, expected_focus, baseline_sql, baseline_answer, evaluation_rule_json
  FROM sg_ai_qa_question
 WHERE question_code = 'STD-25';
