Files
AIclinicalresearch/docs/09-架构实施
HaHafeng beb7f7f559 feat(asl): Implement full-text screening core LLM service and validation system (Day 1-3)
Core Components:
- PDFStorageService with Dify/OSS adapters
- LLM12FieldsService with Nougat-first + dual-model + 3-layer JSON parsing
- PromptBuilder for dynamic prompt assembly
- MedicalLogicValidator with 5 rules + fault tolerance
- EvidenceChainValidator for citation integrity
- ConflictDetectionService for dual-model comparison

Prompt Engineering:
- System Prompt (6601 chars, Section-Aware strategy)
- User Prompt template (PICOS context injection)
- JSON Schema (12 fields constraints)
- Cochrane standards (not loaded in MVP)

Key Innovations:
- 3-layer JSON parsing (JSON.parse + json-repair + code block extraction)
- Promise.allSettled for dual-model fault tolerance
- safeGetFieldValue for robust field extraction
- Mixed CN/EN token calculation

Integration Tests:
- integration-test.ts (full test)
- quick-test.ts (quick test)
- cached-result-test.ts (fault tolerance test)

Documentation Updates:
- Development record (Day 2-3 summary)
- Quality assurance strategy (full-text screening)
- Development plan (progress update)
- Module status (v1.1 update)
- Technical debt (10 new items)

Test Results:
- JSON parsing success rate: 100%
- Medical logic validation: 5/5 passed
- Dual-model parallel processing: OK
- Cost per PDF: CNY 0.10

Files: 238 changed, 14383 insertions(+), 32 deletions(-)
Docs: docs/03-涓氬姟妯″潡/ASL-AI鏅鸿兘鏂囩尞/05-寮€鍙戣褰?2025-11-22_Day2-Day3_LLM鏈嶅姟涓庨獙璇佺郴缁熷紑鍙?md
2025-11-22 22:21:12 +08:00
..

架构实施

文档定位: 架构演进、技术改造、工程实践
适用范围: 技术架构师、技术负责人


📋 目录结构

09-架构实施/
  ├── 02-数据库连接配置.md       # ✅ Schema隔离的数据库配置
  ├── migration-scripts/         # ⏳ Schema迁移SQL脚本Week 1创建
  ├── 01-Monorepo架构设计/      # ⏳ Monorepo转换方案
  ├── 02-产品打包方案/          # ⏳ 独立产品打包流程
  └── 03-微服务拆分/            # ⏳ 微服务拆分策略

🎯 核心内容

1. Monorepo架构设计

  • Monorepo总体设计
  • 包管理策略pnpm workspaces
  • 代码共享与复用
  • 构建和部署

2. 产品打包方案

  • 独立产品打包流程
  • 依赖管理
  • 构建脚本
  • 版本管理

3. 微服务拆分

  • 拆分策略和时机
  • 服务间通信
  • API网关配置
  • 数据迁移

📅 实施计划

阶段一:模块化单体(当前)

  • 严格代码隔离
  • Schema隔离逻辑
  • 模块化设计

阶段二首次拆分6-18个月

  • Monorepo转换
  • Schema物理隔离
  • 拆分独立系统RVW
  • 引入API网关

阶段三全面微服务18个月+

  • 所有模块独立部署
  • K8s编排
  • 服务网格

📚 快速导航

当前实施中Week 1

  1. 数据库连接配置 - Schema隔离迁移配置
  2. 迁移SQL脚本 - Week 1创建

未来实施

  1. Monorepo架构设计 - 待规划
  2. 产品打包方案 - 待规划
  3. 微服务拆分 - 待规划

🔗 相关文档


最后更新: 2025-11-06
维护人: 技术架构师