分析算子收尾:复算剔除系统字段改用同一个 DERIVED_PARAMS;去掉没用的导入和小函数;测试按仓库的写法从 tests.analysis_samples 导入样例

This commit is contained in:
ThearchyHelios
2026-10-21 13:08:14 +08:00
parent 7d31922d00
commit ab98c7430c
9 changed files with 8 additions and 12 deletions
+1 -1
View File
@@ -3,8 +3,8 @@
probes,不现查)。"""
from __future__ import annotations
from analysis_samples import analyze, fixed_prober, snap
from app.analysis import comparable_reasons
from tests.analysis_samples import analyze, fixed_prober, snap
WINDOW = "SELECT SUM(amount) AS gmv FROM orders WHERE order_date >= '{a}' AND order_date < '{b}'"
RANGE = {("orders", "order_date"): ("2025-01-01", "2026-10-20")}
+1 -1
View File
@@ -9,8 +9,8 @@ from fractions import Fraction
import pytest
from analysis_samples import analyze, call_error, fixed_prober, notes, snap
from app.analysis.decompose import lmdi, ratio_effects
from tests.analysis_samples import analyze, call_error, fixed_prober, notes, snap
SQL = "SELECT region, week, SUM(amount) AS gmv FROM orders GROUP BY region, week"
TYPES = {"region": "text", "week": "text", "gmv": "number"}
+1 -1
View File
@@ -7,8 +7,8 @@ from fractions import Fraction
import pytest
from analysis_samples import analyze, call_error, snap
from app.analysis import stats
from tests.analysis_samples import analyze, call_error, snap
RATE_SQL = "SELECT region, SUM(refund_flag) AS refunds, COUNT(*) AS orders FROM orders GROUP BY region"
+1 -1
View File
@@ -9,7 +9,6 @@ from datetime import date, datetime, timedelta, timezone
import pytest
from analysis_samples import CATALOGS, recomputed, snap
from app import analysis
from app.analysis.contract import effective_settings, same
from app.analysis.probe import Book, make_prober
@@ -17,6 +16,7 @@ from app.data import introspect
from app.data.engine import engines
from app.db.base import SessionLocal
from app.db.models import DataSource
from tests.analysis_samples import CATALOGS, recomputed, snap
CLOCK = "2026-10-21T09:30:00"
#: SQLite 的 date('now') 按 UTC 算:表里的数据造到 UTC 的昨天
+1 -1
View File
@@ -7,10 +7,10 @@ from datetime import date, timedelta
import pytest
from analysis_samples import CATALOGS, analyze, call_error, fixed_prober, recomputed, snap
from app import analysis
from app.analysis import contract as c
from app.analysis.contract import CallError, effective_settings, same
from tests.analysis_samples import CATALOGS, analyze, call_error, fixed_prober, recomputed, snap
WEEKLY_SQL = "SELECT region, week, SUM(amount) AS gmv FROM orders GROUP BY region, week"
WEEKLY = snap("Q2", WEEKLY_SQL, ["region", "week", "gmv"],
+1 -1
View File
@@ -7,8 +7,8 @@ from fractions import Fraction
import pytest
from analysis_samples import analyze, call_error, fixed_prober, snap
from app.analysis.series import MAD_SCALE, run_length
from tests.analysis_samples import analyze, call_error, fixed_prober, snap
SQL = "SELECT DATE(order_date, 'weekday 0', '-6 days') AS week, COUNT(*) AS orders FROM orders GROUP BY 1"
#: 每周一的日期:最后一周是 2026-10-12(到 10-18,运行当天 10-21 之前已经过完)