Add planner-based analysis pipeline and optional /api/analyze planner flow#44
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a8dd7313c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if re.fullmatch(r"[가-힣A-Za-z][가-힣A-Za-z0-9_-]+", tok): | ||
| if tok.lower() not in {"top", "sample", "threshold", "임계값", "상위", "샘플"}: | ||
| if tok in columns: | ||
| continue | ||
| intent.region = tok |
There was a problem hiding this comment.
Exclude period tokens from region inference
When a question asks for a before/after comparison without naming a region (for example containing before, after, 이전, or 이후), this fallback path treats the first such token as intent.region. That makes the filter node run against region_column with a non-region value, which can drop all rows and return empty planner results for valid compare-period queries.
Useful? React with 👍 / 👎.
| result["planner"] = { | ||
| "intent": intent.__dict__, | ||
| "plan": {"nodes": plan.nodes, "warnings": plan.warnings, "fallback": plan.fallback}, | ||
| "execution": execute_plan_from_csv_text(plan, str(request_payload.get("normalized_csv_text", "") or "")), |
There was a problem hiding this comment.
Execute planner on normalized input used by analysis
This execution step always reads request_payload.normalized_csv_text, but /api/analyze still accepts legacy csv_text and build_analysis_payload_from_request promotes it when normalized text is empty. In that common compatibility path, analysis summary is built from real rows while planner execution runs on an empty CSV, producing inconsistent/empty planner output despite a successful analysis response.
Useful? React with 👍 / 👎.
Motivation
Description
bitnet_tools/planner.pydefiningAnalysisIntentandAnalysisPlandataclasses and implementingparse_question_to_intent,build_plan,execute_plan, andexecute_plan_from_csv_textwhich build and run afilter -> groupby -> agg -> rank -> sample -> exportexecution graph and returntable/sample/metawith graceful fallback on errors.bitnet_tools/web.pyby importingparse_question_to_intent,build_plan, andexecute_plan_from_csv_textand adding ause_plannerboolean option on/api/analyzethat appendsplanner.intent,planner.plan, andplanner.executionto the response when enabled.tests/test_planner.pyto validate parsing, plan-node structure, and fallback behavior for invalid nodes.tests/test_web.pywith an integration test verifying that/api/analyzereturns theplannerpayload whenuse_planneris true.Testing
pytest -q tests/test_planner.py tests/test_web.pyand all tests passed (15 passed in 1.74s).Codex Task