Files
backend/backend/app/core/constants.py
T
34047007@qq.com 73f9468384
CI / backend (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
fix: 第8轮搜索深度审计修复 — 缓存失效、Redis重试、中文标签、翻页稳定性等12项
CRITICAL:
- invalidate_search_cache 清理 atm:* 缓存(MeSH ATM扩展不再用过期结果)
- Pro 方案 api_quota_per_day 1000→10000(修复低于 Free 的数据错误)
- CacheService/RateLimitMiddleware Redis 连接失败60秒自动重试(原永久降级)
- 普通搜索中文输入自动匹配 GlobalTag.name_zh(如"肺癌"通过MeSH标签关联文献)
- AdvancedPubSearchView resolveQuery 添加 seen Set 检测交替 #N 循环引用

HIGH:
- 限速器 _burst_windows 每500请求清理过期条目(防止内存泄漏)
- cron daily_ftp_update 末尾调用 invalidate_search_cache()(自动管道不再用过期缓存)

MEDIUM:
- _apply_order_by ASC 排序加 id tiebreaker(title/journal/first_author翻页跳行/重复)
- _keyset_condition 所有 is_(None) 加 id tiebreaker + __NULL__ 哨兵值
- _field_condition("all") 默认tsvector路径加 journal/journal_iso ILIKE 兜底
- SearchView restoreFromQuery date_preset/year_from/year_to 优先顺序修复

docs: 更新 12/13 搜索文档,移除 CLAUDE.md 陈旧 SQLite 提及
2026-07-28 11:02:29 +08:00

24 lines
1.3 KiB
Python

"""Shared constants used across the application."""
# ─── AGE 筛选层级定义 ───
AGE_GROUPS = [
("child_0_18", "Child: birth-18 years", ["D007231", "D007223", "D002675", "D002648", "D000293"], 0),
("newborn", "Newborn: birth-1 month", ["D007231"], 1),
("infant_0_23", "Infant: birth-23 months", ["D007231", "D007223"], 1),
("infant_1_23", "Infant: 1-23 months", ["D007223"], 1),
("preschool", "Preschool Child: 2-5 years", ["D002675"], 1),
("child_6_12", "Child: 6-12 years", ["D002648"], 1),
("adolescent", "Adolescent: 13-18 years", ["D000293"], 1),
("adult_19_plus", "Adult: 19+ years", ["D000328", "D008875", "D000368", "D000369"], 0),
("young_adult", "Young Adult: 19-24 years", ["D055815"], 1),
("adult_19_44", "Adult: 19-44 years", ["D000328"], 1),
("middle_aged_plus","Middle Aged + Aged: 45+ years", ["D008875", "D000368", "D000369"], 1),
("middle_aged", "Middle Aged: 45-64 years", ["D008875"], 1),
("aged", "Aged: 65+ years", ["D000368", "D000369"], 1),
("aged_80_plus", "80 and over: 80+ years", ["D000369"], 1),
]
# 预构建 key → UIs 查找表(搜索时用)
AGE_GROUP_UI_MAP: dict[str, list[str]] = {k: u for k, _, u, _ in AGE_GROUPS}