数据看板分享模式:新增 series 接口、免登录路径、时间范围查询
- 新增 /api/v1/data-dashboard/ocr/series 路由(按采集轮次序列) - ocr_dashboard_service 新增 get_series 透传 - /api/v1/data-dashboard/ 加入免登录 open_paths - summary/comparison 路由透传 start_date/end_date - evidences 放宽必填校验(支持时间范围替代批次)
This commit is contained in:
15
app.py
15
app.py
@@ -18,6 +18,7 @@ from config import Config
|
||||
from database import init_database
|
||||
from ocr_dashboard_service import (
|
||||
get_comparison as get_ocr_dashboard_comparison,
|
||||
get_series as get_ocr_dashboard_series,
|
||||
get_result_matches as get_ocr_result_matches,
|
||||
get_summary as get_ocr_dashboard_summary,
|
||||
list_batches as list_ocr_batches,
|
||||
@@ -79,7 +80,7 @@ def create_app() -> Flask:
|
||||
g.request_id = request.headers.get("X-Request-Id") or f"req_{secrets.token_hex(10)}"
|
||||
if request.method == "OPTIONS":
|
||||
return None
|
||||
open_paths = ("/health", "/api/v1/auth/", "/api/v1/skill/")
|
||||
open_paths = ("/health", "/api/v1/auth/", "/api/v1/skill/", "/api/v1/data-dashboard/")
|
||||
if request.path == "/health" or any(request.path.startswith(path) for path in open_paths):
|
||||
return None
|
||||
user = local_dev_user() or get_user_by_session_token(request.cookies.get(Config.SESSION_COOKIE_NAME))
|
||||
@@ -342,6 +343,16 @@ def create_app() -> Flask:
|
||||
return jsonify({"data": get_ocr_dashboard_summary(
|
||||
request.args.get("batch_key", "").strip(),
|
||||
request.args.get("collection_key", "").strip(),
|
||||
request.args.get("start_date", "").strip(),
|
||||
request.args.get("end_date", "").strip(),
|
||||
), "request_id": g.request_id})
|
||||
|
||||
@app.route("/api/v1/data-dashboard/ocr/series", methods=["GET"])
|
||||
def query_ocr_dashboard_series():
|
||||
return jsonify({"data": get_ocr_dashboard_series(
|
||||
request.args.get("batch_key", "").strip(),
|
||||
request.args.get("start_date", "").strip(),
|
||||
request.args.get("end_date", "").strip(),
|
||||
), "request_id": g.request_id})
|
||||
|
||||
@app.route("/api/v1/data-dashboard/ocr/comparison", methods=["GET"])
|
||||
@@ -349,6 +360,8 @@ def create_app() -> Flask:
|
||||
return jsonify({"data": get_ocr_dashboard_comparison(
|
||||
request.args.get("batch_key", "").strip(),
|
||||
request.args.get("collection_key", "").strip(),
|
||||
request.args.get("start_date", "").strip(),
|
||||
request.args.get("end_date", "").strip(),
|
||||
), "request_id": g.request_id})
|
||||
|
||||
@app.route("/api/v1/data-dashboard/ocr/results", methods=["GET"])
|
||||
|
||||
Reference in New Issue
Block a user