docs(claude): sync §5/§7/§10 with Monitor+Profile; fix SeriesBucket SwiftData import
- §5 schema 重写为 7 @Model 完整列表(含 UserProfile + Indicator.seriesKey) - §7 IA 改成 5 槽 TabBar(2 内容 + 中间 + + 2 设置),记录入口 5 个 kind - §10.6 红线例外清单加 Monitor + Profile(Symptom 也补上) - SeriesBucket.swift 缺 import SwiftData(persistentModelID 报错) 全套测试 50 case pass / 0 fail / 0 warning。
This commit is contained in:
67
CLAUDE.md
67
CLAUDE.md
@@ -92,37 +92,27 @@ VL prompt 必须:
|
||||
|
||||
## 5. 数据模型(SwiftData)
|
||||
|
||||
现有 3 个 `@Model`,要新增 2 个:
|
||||
**当前 schema(2026-05-26)**:7 个 @Model。
|
||||
|
||||
```swift
|
||||
// 已有(在 Models/Models.swift)
|
||||
@Model class Indicator { name, value, unit, range, statusRaw, note, capturedAt }
|
||||
@Model class Report { title, typeRaw, reportDate, institution, note, summary, pageCount, createdAt }
|
||||
@Model class DiaryEntry { content, createdAt }
|
||||
|
||||
// 待加字段
|
||||
// Indicator + report: Report? 反向关系
|
||||
// Indicator + asset: Asset? 关联原图
|
||||
// Indicator + pinned: Bool C2 "关联到趋势" 后置 true,Trends 默认展示 pinned 指标
|
||||
// Report + indicators: [Indicator] @Relationship cascade
|
||||
// Report + assets: [Asset] @Relationship cascade
|
||||
// DiaryEntry + tags: [String] VL/LLM 抽取的标签
|
||||
|
||||
// 待加 @Model
|
||||
@Model class Asset {
|
||||
var relativePath: String // 相对 Vault/ 的路径
|
||||
var mimeType: String
|
||||
var bytes: Int
|
||||
var createdAt: Date
|
||||
@Model class Indicator {
|
||||
name, value, unit, range, statusRaw, note, capturedAt,
|
||||
report: Report?, asset: Asset?,
|
||||
pinned: Bool, // 长期监测自动 true,Trends 默认展示
|
||||
seriesKey: String? // "bp.systolic" / "glucose.fasting" / ... 长期指标分组 key
|
||||
}
|
||||
@Model class Report { title, typeRaw, reportDate, institution, note, summary, pageCount, createdAt,
|
||||
indicators: [Indicator] cascade,
|
||||
assets: [Asset] cascade }
|
||||
@Model class DiaryEntry { content, createdAt, tags: [String] }
|
||||
@Model class Symptom { name, startedAt, endedAt?, note?, severity 1-5, tags, createdAt }
|
||||
@Model class Asset { relativePath, mimeType, bytes, createdAt }
|
||||
@Model class ChatTurn { question, answer, referencedIndicatorIDs, referencedReportIDs, createdAt, decodeRate }
|
||||
|
||||
@Model class ChatTurn {
|
||||
var question: String
|
||||
var answer: String
|
||||
var referencedIndicatorIDs: [String]
|
||||
var referencedReportIDs: [String]
|
||||
var createdAt: Date
|
||||
var decodeRate: Double // 该轮问答推理速度,Me 页性能展示
|
||||
@Model class UserProfile { // 全 App 单例(UserProfileStore.loadOrCreate)
|
||||
birthYear?, biologicalSexRaw, heightCM?, bloodTypeRaw,
|
||||
allergies, chronicConditions, familyHistory, currentMedications,
|
||||
updatedAt
|
||||
}
|
||||
```
|
||||
|
||||
@@ -149,18 +139,21 @@ VL prompt 必须:
|
||||
## 7. 信息架构
|
||||
|
||||
```
|
||||
TabBar: [首页] [+ 记录] [趋势] [我的]
|
||||
│ │ │ │
|
||||
│ │ │ └─ 模型管理 / Face ID / 关于
|
||||
│ │ └─ 折线图 + AI 一句话解读
|
||||
│ └─ Modal: 选择 拍一张 / 写日记 / 问问看
|
||||
└─ 问候 + 今日摘要 + 时间线 + 影像档案入口
|
||||
TabBar: [主页] [记录] [+ 新建] [趋势] [我的]
|
||||
│ │ │ │ │
|
||||
│ │ │ │ └─ 个人资料 / 模型管理 / Face ID / 关于
|
||||
│ │ │ └─ 折线图 + AI 一句话解读
|
||||
│ │ └─ Sheet: 拍一张 / 指标记录 / 报告归档 / 写日记 / 症状
|
||||
│ └─ ArchiveListView(时间线 + 分类 chip + 年/月分组)
|
||||
└─ 问候 + 今日摘要 + 进行中症状 + 最近时间线
|
||||
```
|
||||
|
||||
- **3 Tab 不变**,中间 + 号是 Sheet
|
||||
- TabBar **5 槽**:左 2 个内容 Tab + 中间 + 号 + 右 2 个 Tab
|
||||
- "+ 新建" 是 sheet 不是 Tab
|
||||
- AI 问答以 Modal Sheet 形式出现,**不占 Tab**
|
||||
- "问问看"入口除了在 RecordSheet 里,首页摘要卡片下方也有一个常驻入口
|
||||
- 历史时间线在首页下半部分,不单独开 Tab
|
||||
- 「指标记录」sheet 顶部 LazyVGrid 是 8 个 MonitorMetric 长期监测预设(进趋势),
|
||||
下方 horizontal scroll 是化验项快捷预设(不进趋势),不选预设走自由输入
|
||||
- 「我的 · 个人资料」是 NavigationLink push 的 Form 编辑页
|
||||
|
||||
### 7.1 档案库 C1 / C2 导航(看的一半)
|
||||
|
||||
@@ -256,7 +249,7 @@ C2 解读 Tab 底部显示一段 diff 文本,**由 `ReportCompareService` 计算
|
||||
3. **UI 不直接调 AIRuntime**——必须经过 Service
|
||||
4. **AIRuntime 必须 actor 化**——禁止 class + lock
|
||||
5. **VL/LLM prompt 必须有 few-shot + 失败回退**——不能让用户卡在 AI 错误屏
|
||||
6. **新功能必须问"清单里有吗"**——清单外的功能(用药提醒、多 profile、暗黑模式、iCloud 同步……)默认不做,要做必须先讨论。**例外**:报告对比(16.1)已加回,见 §7.2
|
||||
6. **新功能必须问"清单里有吗"**——清单外的功能(用药提醒、多 profile、暗黑模式、iCloud 同步……)默认不做,要做必须先讨论。**已加回的例外**:报告对比(16.1,§7.2)、症状追踪(Symptom @Model)、长期监测指标(MonitorMetric / IndicatorQuickSheet,W2)、个人资料(UserProfile,W2)
|
||||
7. **不要在 6 周里重构现有 Tab/RecordSheet 骨架**——增量加东西,不要推倒重来
|
||||
8. **报告详情(C2)与归档元信息编辑(B3)是两个 View**——B3 是 draft 编辑(写),C2 是 detail 浏览(读),不要合并复用主框架
|
||||
|
||||
|
||||
Reference in New Issue
Block a user