Skip to content

Commit ca60c4c

Browse files
committed
docs: add data rules doc and refactor health report decoder
- add new rule/data.md defining artifact data organization standards - update AGENTS.md and artifact READMEs to reference data rules - refactor health report decoder artifact: rename blocks and components - add new blocks for health literacy sources, lab trend review, ldl review, doctor question list and life context - update rough rule component to support tone-based styling - reorganize health report decoder artifact blocks and update dependencies - fix dependency summary and large files listings
1 parent af44772 commit ca60c4c

23 files changed

Lines changed: 200 additions & 132 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Use these routes before searching broadly.
4242
- Canvas host: `apps/docs/content/docs/host/index.mdx`
4343
- Canvas reference: `apps/docs/content/docs/reference/index.mdx`
4444
- Artifact rules: `rule/artifact.md`
45+
- Data rules: `rule/data.md`
4546
- Taste: `taste/README.md`
4647
- Taste Design: `taste/design/README.md`
4748
- Agent Ergonomics: `taste/agent-ergonomics/README.md`

agent-html/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Write normal React artifacts in `agent-html/artifacts/*.artifact.tsx`. For cold
3636
- Put Canvas CSS, tokens, and style routes in `styles`.
3737
- Put theme preset resources in `theme`; keep preset source CSS in
3838
`theme/presets` and let the registry normalize it. Put preset layout metadata
39-
- Create `data` only for fixtures or local datasets shared by multiple artifacts.
39+
- Read `../rule/data.md` before adding, splitting, or moving artifact data.
4040
- Put bundle-time imports in `assets` only when an artifact needs imported files.
4141
- Put URL-addressed static files in `public`.
4242

agent-html/artifacts/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Use it after reading `../README.md` and `../AGENTS.md`. `AGENTS.md` owns hard ar
1515

1616
## Data Placement
1717

18-
- Put artifact-private display data in `artifacts/<artifact>/data.ts`.
19-
- Create `../data` only for fixtures or local datasets shared by multiple artifacts.
18+
- Read `../../rule/data.md` before adding, splitting, or moving artifact data.
2019
- Put typed contracts and validation in `../schema`.
2120
- Put pure parsing, normalization, and transforms in `../lib`.
2221
- Keep tiny block-only constants inside the block when they do not create a reusable data surface.

agent-html/artifacts/health-report-decoder.artifact.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
import { Artifact, Block } from "@agent-html/react"
22

3-
import { DoctorPrepBlock } from "./health-report-decoder/doctor-prep.block"
4-
import { LifeContextBlock } from "./health-report-decoder/life-context.block"
5-
import { RangeDecoderBlock } from "./health-report-decoder/range-decoder.block"
3+
import { DoctorQuestionListBlock } from "./health-report-decoder/doctor-question-list.block"
4+
import { HealthLiteracySourcesBlock } from "./health-report-decoder/health-literacy-sources.block"
5+
import { LabSystemMapBlock } from "./health-report-decoder/lab-system-map.block"
6+
import { LabTrendReviewBlock } from "./health-report-decoder/lab-trend-review.block"
7+
import { LdlRangeReviewBlock } from "./health-report-decoder/ldl-range-review.block"
8+
import { RecentLifeContextBlock } from "./health-report-decoder/recent-life-context.block"
69
import { ReportLiteracyCheckBlock } from "./health-report-decoder/report-literacy-check.block"
710
import { ReportTriageBlock } from "./health-report-decoder/report-triage.block"
8-
import { SourcesBlock } from "./health-report-decoder/sources.block"
9-
import { SystemMapBlock } from "./health-report-decoder/system-map.block"
10-
import { TrendViewBlock } from "./health-report-decoder/trend-view.block"
1111

1212
export default function HealthReportDecoderArtifact() {
1313
return (
1414
<Artifact title="这次体检怎么记">
15-
<Block id="report-triage" title="先记三件事">
15+
<Block id="report-triage" title="报告优先级">
1616
<ReportTriageBlock />
1717
</Block>
1818

19-
<Block id="system-map" title="按项目归好类">
20-
<SystemMapBlock />
19+
<Block id="lab-system-map" title="检验项目分组">
20+
<LabSystemMapBlock />
2121
</Block>
2222

23-
<Block id="range-decoder" title="这次先看 LDL-C">
24-
<RangeDecoderBlock />
23+
<Block id="ldl-range-review" title="LDL-C 范围复核">
24+
<LdlRangeReviewBlock />
2525
</Block>
2626

27-
<Block id="trend-view" title="这几年有没有变">
28-
<TrendViewBlock />
27+
<Block id="lab-trend-review" title="检验趋势复核">
28+
<LabTrendReviewBlock />
2929
</Block>
3030

31-
<Block id="report-literacy-check" title="读报告前自查">
31+
<Block id="report-literacy-check" title="报告阅读自查">
3232
<ReportLiteracyCheckBlock />
3333
</Block>
3434

35-
<Block id="doctor-prep" title="下次就诊小纸条">
36-
<DoctorPrepBlock />
35+
<Block id="doctor-question-list" title="就诊问题清单">
36+
<DoctorQuestionListBlock />
3737
</Block>
3838

39-
<Block id="life-context" title="近期背景备忘">
40-
<LifeContextBlock />
39+
<Block id="recent-life-context" title="近期生活背景">
40+
<RecentLifeContextBlock />
4141
</Block>
4242

43-
<Block id="sources" title="参考资料">
44-
<SourcesBlock />
43+
<Block id="health-literacy-sources" title="健康阅读资料">
44+
<HealthLiteracySourcesBlock />
4545
</Block>
4646
</Artifact>
4747
)

agent-html/artifacts/health-report-decoder/doctor-prep.block.tsx renamed to agent-html/artifacts/health-report-decoder/doctor-question-list.block.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
function DoctorPrepIllustration() {
1111
return (
1212
<svg
13-
aria-labelledby="doctor-prep-illustration-title"
13+
aria-labelledby="doctor-question-list-illustration-title"
1414
className="max-h-80 w-full object-contain"
1515
role="img"
1616
viewBox="0 0 738.21997 557.74675"
1717
>
18-
<title id="doctor-prep-illustration-title">
18+
<title id="doctor-question-list-illustration-title">
1919
整理就诊问题的待办清单插图
2020
</title>
2121
<use
@@ -42,11 +42,11 @@ function DoctorPrepIllustration() {
4242
)
4343
}
4444

45-
export function DoctorPrepBlock() {
45+
export function DoctorQuestionListBlock() {
4646
return (
4747
<section className="canvas-stack-lg">
4848
<div className="canvas-stack-sm">
49-
<Badge variant="secondary">下次就诊小纸条</Badge>
49+
<Badge variant="secondary">就诊问题清单</Badge>
5050
<h2 className="canvas-text-heading">
5151
到诊室前,把要问的事写短一点。
5252
</h2>

agent-html/artifacts/health-report-decoder/sources.block.tsx renamed to agent-html/artifacts/health-report-decoder/health-literacy-sources.block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { Badge } from "../../components/ui/badge"
44
import { sourceGroups } from "./data"
55
import { SourceLinks } from "./source-links"
66

7-
export function SourcesBlock() {
7+
export function HealthLiteracySourcesBlock() {
88
return (
99
<section className="canvas-stack-lg">
1010
<div className="canvas-stack-sm">
11-
<Badge variant="secondary">来源</Badge>
11+
<Badge variant="secondary">健康阅读资料</Badge>
1212
<h2 className="canvas-text-heading">
1313
参考资料放在最后。
1414
</h2>

agent-html/artifacts/health-report-decoder/system-map.block.tsx renamed to agent-html/artifacts/health-report-decoder/lab-system-map.block.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ function SystemItem({ item }: { item: LabItem }) {
3737
function SystemMapIllustration() {
3838
return (
3939
<svg
40-
aria-labelledby="system-map-illustration-title"
40+
aria-labelledby="lab-system-map-illustration-title"
4141
className="max-h-56 w-full object-contain pt-3"
4242
role="img"
4343
viewBox="0 0 888 618.10603"
4444
>
45-
<title id="system-map-illustration-title">医疗护理记录插图</title>
45+
<title id="lab-system-map-illustration-title">医疗护理记录插图</title>
4646
<use
4747
className="fill-border"
4848
href="/__agent-html/public/health-report-decoder/undraw_medical-care.svg#undraw-medical-care-muted"
@@ -118,12 +118,12 @@ function SystemHealthIcon({ systemId }: { systemId: string }) {
118118
)
119119
}
120120

121-
export function SystemMapBlock() {
121+
export function LabSystemMapBlock() {
122122
return (
123123
<section className="canvas-stack-lg">
124124
<div className="canvas-grid-gap md:grid-cols-2">
125125
<div className="canvas-stack-sm">
126-
<Badge variant="secondary">按项目归好类</Badge>
126+
<Badge variant="secondary">检验项目分组</Badge>
127127
<h2 className="canvas-text-heading">
128128
一张体检单,先分成几摞。
129129
</h2>

agent-html/artifacts/health-report-decoder/trend-view.block.tsx renamed to agent-html/artifacts/health-report-decoder/lab-trend-review.block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ const chartConfig = {
2626
},
2727
} satisfies ChartConfig
2828

29-
export function TrendViewBlock() {
29+
export function LabTrendReviewBlock() {
3030
return (
3131
<section className="canvas-stack-lg">
3232
<div className="canvas-stack-sm">
33-
<Badge variant="secondary">这几年有没有变</Badge>
33+
<Badge variant="secondary">检验趋势复核</Badge>
3434
<h2 className="canvas-text-heading">
3535
有些项目要看今年,也要看前几年。
3636
</h2>

agent-html/artifacts/health-report-decoder/range-decoder.block.tsx renamed to agent-html/artifacts/health-report-decoder/ldl-range-review.block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ const relatedItems = sampleReport.labItems.filter(
2222
(item) => item.systemId === activeItem.systemId && item.code !== activeItem.code
2323
)
2424

25-
export function RangeDecoderBlock() {
25+
export function LdlRangeReviewBlock() {
2626
const meta = statusFor(activeItem.status)
2727

2828
return (
2929
<section className="canvas-stack-lg">
3030
<div className="canvas-grid-gap md:grid-cols-2">
3131
<div className="canvas-stack-sm">
32-
<Badge variant="secondary">这次先看 LDL-C</Badge>
32+
<Badge variant="secondary">LDL-C 范围复核</Badge>
3333
<h2 className="canvas-text-heading">
3434
它不是最吓人的数字,但值得带着旧记录问一次。
3535
</h2>

agent-html/artifacts/health-report-decoder/life-context.block.tsx renamed to agent-html/artifacts/health-report-decoder/recent-life-context.block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ function LifeContextIcon({ fieldLabel }: { fieldLabel: string }) {
5858
)
5959
}
6060

61-
export function LifeContextBlock() {
61+
export function RecentLifeContextBlock() {
6262
return (
6363
<section className="canvas-stack-lg">
6464
<div className="canvas-stack-sm">
65-
<Badge variant="secondary">近期背景备忘</Badge>
65+
<Badge variant="secondary">近期生活背景</Badge>
6666
<h2 className="canvas-text-heading">
6767
复查前,先把最近两周写下来。
6868
</h2>

0 commit comments

Comments
 (0)