cb4cb0d17811d52738545cfb2f4cc8220dc7d9f1
- ctid 游标:asyncpg 的 tid 编解码器只接受 (page, offset) 元组,直接绑 'ctid::text' 字符串到 $n::tid 会报 "list or tuple expected"(容器 crash 根因)。 解析 'ctid::text' → 元组后绑定,本地真实库 6 万行验证通过 - 默认改 recent-first 游标:按 (pub_date DESC NULLS LAST, id DESC) keyset 推进 (走 ix_gl_pub_date_sort 索引,谓词复用 search_engine._keyset_condition 的 date 分支),最新文献先回填——affiliation 搜索对近期文献先恢复可用, 而非等全量 ~10 小时(表 FILLFACTOR=100 页满 → 非 HOT → 35 索引 fan-out, 单索引删除不改善,仅改善顺序不缩短总时长) - --physical 保留原 ctid 游标作回退;本地真实库 3 批 6 万行验证倒序 + 无崩溃
SciLit Oncology — 肿瘤科文献管理平台
快速启动
# 1. 启动所有服务
docker compose up -d
# 2. 初始化数据库(首次)
docker compose exec backend alembic upgrade head
# 3. 访问
# 前端: http://localhost:5173
# 后端 API: http://localhost:8000/docs
# MinIO 控制台: http://localhost:9001 (minioadmin/minioadmin)
项目结构
backend/
├── app/
│ ├── main.py # FastAPI 入口
│ ├── config.py # 配置
│ ├── db.py # 数据库连接
│ ├── core/ # 核心:安全、权限、多租户中间件
│ ├── models/ # SQLAlchemy 模型 (32 张表)
│ ├── schemas/ # Pydantic 请求/响应
│ ├── api/v1/ # REST API 端点
│ └── tasks/ # ARQ 异步任务 (PubMed 管道)
├── alembic/ # 数据库迁移
└── config/specialties/ # 科室配置 (oncology.yaml)
frontend/
├── src/
│ ├── views/public/ # 公开页面 (无需登录)
│ ├── views/auth/ # 登录/注册
│ ├── views/app/ # 已登录应用页面
│ ├── stores/ # Pinia 状态管理
│ ├── api/ # Axios 封装
│ └── router/ # Vue Router
docs/ # 完整设计文档 (9 份)
技术栈
- 后端: FastAPI + SQLAlchemy 2.0 (async) + PostgreSQL 16 + Redis + Elasticsearch
- 前端: Vue 3 + Naive UI + Pinia + Vite
- 任务队列: ARQ
- 文件存储: MinIO / S3
- 多租户: PostgreSQL RLS + ContextVar 双层隔离
文档
详细的产品规划、数据库设计、标签体系、数据管道、UI 设计见 docs/ 目录。
Languages
Python
69.1%
Vue
25.7%
TypeScript
2.8%
Shell
1.9%
PLpgSQL
0.2%
Other
0.1%