Phase 3 KPI 상태값 명시

This commit is contained in:
Yun Chan 2026-06-28 23:53:17 +09:00
parent 1e9f293fda
commit f7aae885b2
4 changed files with 42 additions and 21 deletions

View file

@ -16,25 +16,13 @@ from pathlib import Path
from typing import Any, Iterable, Mapping, Sequence
from uuid import UUID
PREPOST_MEASURE_NAMES = (
"self_efficacy",
"skill_proficiency",
"training_satisfaction",
from .phase3_kpi_contract import (
KPI_REPORT_PATH,
PHASE3_KPI_METRICS,
PREPOST_CSV_PATH,
PREPOST_MEASURE_NAMES,
PREPOST_TIMEPOINTS,
)
PREPOST_TIMEPOINTS = ("pre", "post")
PHASE3_KPI_METRICS = (
"embedding_consistency",
"hallucination_rate",
"icc",
"inter_rater_kappa",
"pilot_completion",
"self_efficacy_prepost",
"session_completion",
"sus",
"top1",
)
PREPOST_CSV_PATH = "02-measures/prepost_measures.csv"
KPI_REPORT_PATH = "02-measures/kpi_report.json"
class ParticipantKeys:
@ -173,7 +161,7 @@ def build_kpi_report(
) -> dict[str, Any]:
latest_rows = latest_prepost_rows(rows)
participants = {str(row.get("learner_id") or row.get("participant_id") or "") for row in latest_rows}
metrics = {name: _placeholder_metric(name) for name in PHASE3_KPI_METRICS}
metrics = {name: _design_pending_metric(name) for name in PHASE3_KPI_METRICS}
self_efficacy = paired_prepost_summary(latest_rows, "self_efficacy")
metrics["self_efficacy_prepost"] = {
@ -183,6 +171,7 @@ def build_kpi_report(
"numerator": self_efficacy["complete_pairs"],
"denominator": max(self_efficacy["participants_with_any_measure"], 0),
"method": "paired normalized post-pre delta for pilot review; no official pass/fail gate",
"status": "computed_prepost",
"source_files": [PREPOST_CSV_PATH],
"mean_pre": self_efficacy["mean_pre"],
"mean_post": self_efficacy["mean_post"],
@ -194,12 +183,13 @@ def build_kpi_report(
for measure_name in ("skill_proficiency", "training_satisfaction"):
summary = paired_prepost_summary(latest_rows, measure_name)
metrics[f"{measure_name}_prepost"] = {
**_placeholder_metric(f"{measure_name}_prepost"),
**_design_pending_metric(f"{measure_name}_prepost"),
**summary,
"value": summary["mean_delta"],
"numerator": summary["complete_pairs"],
"denominator": summary["participants_with_any_measure"],
"method": "paired normalized post-pre delta for pilot review; not a required KPI gate yet",
"status": "computed_prepost",
"source_files": [PREPOST_CSV_PATH],
}
@ -241,13 +231,14 @@ def write_kpi_report(report: Mapping[str, Any], path: Path) -> None:
)
def _placeholder_metric(name: str) -> dict[str, Any]:
def _design_pending_metric(name: str) -> dict[str, Any]:
return {
"value": 0.0,
"threshold": 0.0,
"pass": False,
"numerator": 0,
"denominator": 0,
"status": "design_pending",
"method": f"not computed by prepost export scaffold: {name}",
"source_files": [],
}