Skip to content

Commit 223701f

Browse files
committed
refact: Add named args to preprocess script
1 parent 443e2e5 commit 223701f

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

agents_mcp_usage/evaluations/mermaid_evals/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ The local dashboard (`merbench_ui.py`) provides:
102102
```bash
103103
# Convert CSV results to JSON format for the public Merbench website
104104
uv run agents_mcp_usage/evaluations/mermaid_evals/scripts/preprocess_merbench_data.py \
105-
mermaid_eval_results/<timestamp>_combined_results.csv \
106-
agents_mcp_usage/evaluations/mermaid_evals/results/<timestamp>_processed.json
105+
-i "mermaid_eval_results/<timestamp>_combined_results.csv" \
106+
-o "agents_mcp_usage/evaluations/mermaid_evals/results/<timestamp>_processed.json"
107107
```
108108

109109
## Evaluation Task & Test Cases

agents_mcp_usage/evaluations/mermaid_evals/scripts/preprocess_merbench_data.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
import pandas as pd
33
import json
44
import sys
5+
import argparse
6+
from datetime import datetime
57
from pathlib import Path
68

79
# Add parent directory to path to import modules
810
sys.path.append(str(Path(__file__).parent.parent))
911

1012
from agents_mcp_usage.evaluations.mermaid_evals.dashboard_config import DEFAULT_CONFIG
1113
from agents_mcp_usage.evaluations.mermaid_evals.schemas import DashboardConfig
14+
from agents_mcp_usage.utils import get_project_root
1215

1316
def parse_metric_details(metric_details_str):
1417
"""Safely parse JSON string from Metric_details column."""
@@ -158,8 +161,29 @@ def extract_provider(model_name):
158161
return output_data
159162

160163
def main():
161-
csv_path = "/home/ubuntu/projects/agents-mcp-usage/mermaid_eval_results/Jun_gemini_results.csv"
162-
output_path = "/home/ubuntu/projects/agents-mcp-usage/agents_mcp_usage/evaluations/mermaid_evals/results/Jun_gemini_results_processed.json"
164+
parser = argparse.ArgumentParser(description="Process CSV evaluation results for static site")
165+
parser.add_argument("-i", "--input_csv", nargs="?", help="Path to input CSV file", default=None)
166+
parser.add_argument("-o", "--output_json", nargs="?", help="Path to output JSON file", default=None)
167+
168+
args = parser.parse_args()
169+
170+
project_root = get_project_root()
171+
current_month = datetime.now().strftime("%b").lower()
172+
173+
# Set default paths if not provided
174+
if args.input_csv:
175+
csv_path = Path(args.input_csv)
176+
if not csv_path.is_absolute():
177+
csv_path = project_root / csv_path
178+
else:
179+
csv_path = project_root / "mermaid_eval_results" / f"{current_month}_gemini_results.csv"
180+
181+
if args.output_json:
182+
output_path = Path(args.output_json)
183+
if not output_path.is_absolute():
184+
output_path = project_root / output_path
185+
else:
186+
output_path = project_root / "agents_mcp_usage" / "evaluations" / "mermaid_evals" / "results" / f"{current_month}_gemini_results_processed.json"
163187

164188
print(f"Processing {csv_path}...")
165189
data = process_csv_for_static_site(csv_path)

0 commit comments

Comments
 (0)