Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions backend/app/api/routes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
}
from app.core.exceptions import CorkedError, EmptyCellarError
from app.database.repositories.evaluation import EvaluationRepository
from app.graph.graph_factory import EvaluationMode
from app.models.graph import (
ReactFlowGraph,
TraceEvent,
ModeResponse,
EvaluationMode,
Graph3DPayload,
)
from app.services.graph_builder import (
build_six_hats_topology,
build_six_sommeliers_topology,
build_full_techniques_topology,
)
from app.services.graph_builder_3d import build_3d_graph
Expand Down Expand Up @@ -66,11 +66,11 @@ def _check_ownership(evaluation: dict[str, Any], user, evaluation_id: str) -> No
# Allow access to public demo evaluations without auth
if evaluation_id in PUBLIC_DEMO_EVALUATIONS:
return

# Require auth for non-public evaluations
if user is None:
raise CorkedError("Authentication required to view this evaluation")

if evaluation.get("user_id") != user.id:
raise CorkedError(
"Access denied: evaluation belongs to another user", status_code=403
Expand All @@ -84,14 +84,16 @@ def _determine_mode(evaluation: dict[str, Any]) -> EvaluationMode:
evaluation: The evaluation document.

Returns:
EvaluationMode (six_hats or full_techniques).
EvaluationMode (six_sommeliers, grand_tasting, or full_techniques).
"""
# Check for explicit mode in evaluation data
mode = evaluation.get("mode")
# Check for explicit evaluation_mode first, then fall back to mode
mode = evaluation.get("evaluation_mode") or evaluation.get("mode")
if mode == EvaluationMode.FULL_TECHNIQUES.value:
return EvaluationMode.FULL_TECHNIQUES
# Default to six_hats mode
return EvaluationMode.SIX_HATS
if mode == EvaluationMode.GRAND_TASTING.value:
return EvaluationMode.GRAND_TASTING
# Default to six_sommeliers mode
return EvaluationMode.SIX_SOMMELIERS


@router.get("/{evaluation_id}/graph", response_model=ReactFlowGraph)
Expand Down Expand Up @@ -133,7 +135,7 @@ async def get_graph(
if mode == EvaluationMode.FULL_TECHNIQUES:
graph = build_full_techniques_topology()
else:
graph = build_six_hats_topology()
graph = build_six_sommeliers_topology()

logger.info(f"[Graph] Returning {mode.value} graph for {evaluation_id}")
return graph
Expand All @@ -160,7 +162,7 @@ async def get_graph_structure(
if mode == EvaluationMode.FULL_TECHNIQUES:
graph = build_full_techniques_topology()
else:
graph = build_six_hats_topology()
graph = build_six_sommeliers_topology()

return graph

Expand All @@ -186,7 +188,7 @@ async def get_graph_execution(
if mode == EvaluationMode.FULL_TECHNIQUES:
graph = build_full_techniques_topology()
else:
graph = build_six_hats_topology()
graph = build_six_sommeliers_topology()

methodology_trace = evaluation.get("methodology_trace", [])
if methodology_trace:
Expand Down Expand Up @@ -268,7 +270,7 @@ async def get_mode(
) -> ModeResponse:
"""Get current evaluation mode.

Returns the evaluation mode (six_hats or full_techniques)
Returns the evaluation mode (six_sommeliers, grand_tasting, or full_techniques)
for the specified evaluation.

Public demo evaluations can be accessed without authentication.
Expand Down
13 changes: 13 additions & 0 deletions backend/app/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PASS_THRESHOLD = 70
CONCERNS_THRESHOLD = 50
COVERAGE_THRESHOLD = 0.5


def get_quality_gate(normalized_score: float, coverage_rate: float) -> str:
if coverage_rate < COVERAGE_THRESHOLD:
return "INCOMPLETE"
if normalized_score >= PASS_THRESHOLD:
return "PASS"
if normalized_score >= CONCERNS_THRESHOLD:
return "CONCERNS"
return "FAIL"
1 change: 1 addition & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Settings(BaseSettings):

# LLM APIs
GEMINI_API_KEY: str = ""
OPENAI_API_KEY: str = ""

# Vertex AI Express (API key auth)
VERTEX_API_KEY: str = ""
Expand Down
1 change: 1 addition & 0 deletions backend/app/criteria/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Evaluation criteria module for BMAD 17-item scoring system."""
Loading