| name | cancer-buddy-visit-prep |
| description | Assemble a one-page 就诊准备包 (visit prep pack) from an organized patient_dir — doctor's 30-second snapshot, the questions to ask the doctor, what to bring, and (follow-up only) what changed since last visit. Only assembles existing data + organizes questions; no treatment advice, no result interpretation, no clinical judgment. Triggers on 就诊准备, 明天看医生, 复诊准备, 该问医生什么, visit prep. |
cancer-buddy-visit-prep
Turn an already-organized patient archive into a one-page pack the patient brings to a consult: a snapshot a doctor reads in 30 seconds + a worked list of questions to ask. Assemble + organize only — no treatment advice, no interpretation, no clinical judgment.
When to use
- Patient/caregiver says: 就诊准备 / 明天要看医生 / 复诊准备 / 不知道该问医生什么 / 该问医生什么 / visit prep.
- A
patient_dir from organize already exists (patient_summary/timeline/labs/molecular/treatment episodes/document inventory/source-review flags).
Inputs
patient_dir = patients/<pid>/ — requires organize to have run. If profile.json is absent, route to cancer-buddy-organize first ("先把病历整理成档案,再回来出就诊准备包"), then return here.
- Optional
visit_type ∈ {first 初诊, followup 复诊, decision_discussion 决策讨论}. If the caller passed it, use it; if it cannot be detected from context, ask one short question before assembling.
Locale
Read ../../references/i18n.md. The pack is a patient-visible template artifact:
- If the caller / host supplies
locale (the user's explicit product UI language), use it first and write/update profile.json.locale when profile state is available.
- Otherwise read
patients/<pid>/profile.json → locale. If present, use it — do not re-detect (visit-prep runs after organize, so a locale is almost always already persisted).
- If absent, detect from the records' primary patient-facing language, tie-breaking to the language the user is conversing in (the
record-consuming generative sub-skills row in ../../references/i18n.md §2), then write it back to profile.json.locale (BCP-47).
- Render every patient-visible scaffold string in that
locale from the template's locale string table — section titles, question-group titles, "待确认" tag, disclaimer, val_pending placeholder, footer.
- Preserve the source string for drugs, genes/variants, TNM/stage, response labels, numbers, units and biomarkers. A patient-facing translation may be added beside the original and must be marked as a translation.
- Honor an explicit user language override → update
profile.json.locale and follow it.
Workflow
- Resolve locale from caller-supplied
locale, else profile.json.locale, else detection fallback + persist.
- Resolve
visit_type (caller arg → else ask one question).
- Read de-identified sources (read-only):
patient_summary.json, source/faithfulness flags, molecular.json, treatment_lines.json, labs.json, timeline.json, missing_items.json. Never read raw/.
- Map Block 1 医生速览 — direct source mapping; null →
val_pending. Do not calculate stage, ECOG, response, progression or treatment line.
- Derive Block 2 我要问医生的 per references/visit-prep-html-prompt.md: unresolved source flags become confirmation questions; document-inventory gaps remain questions about adding existing records, never recommendations to order tests; timeline content remains source-attributed. A host may use one bounded worker or do this directly; the output contract is identical.
- Assemble Block 3 带什么 and (follow-up only) Block 4 上次→这次变化 per the assembly prompt.
- Emit
.visit_prep_data.json only — never hand-write HTML. <patient_dir> is the absolute patient directory resolved via the standard chain $CANCER_BUDDY_PATIENTS_DIR → $VMTB_PATIENT_DATA_ROOT → $HOME/CancerDAO/patients (same resolution as cancer-buddy-organize) — not a path relative to this skill dir. Script and template paths below are relative to this skill's directory (skills/cancer-buddy-visit-prep/); the data + output paths are absolute under <patient_dir>. Write <patient_dir>/.visit_prep_data.json, then render the template deterministically:
python3 ../cancer-buddy-organize/scripts/render_html_template.py \
--template references/templates/visit-prep.template.html \
--data <patient_dir>/.visit_prep_data.json --out <patient_dir>/就诊准备包.html
(render_html_template.py is the generic zero-medical-logic engine in the cancer-buddy-organize skill, stdlib only.)
- Gate: validate the rendered HTML — it is not done until this passes (exit 0):
python3 scripts/validate_visit_prep_html.py <patient_dir>/就诊准备包.html
On failure, fix .visit_prep_data.json or the template and re-render + re-validate — never patch the output HTML by hand.
Full assembly contract: references/visit-prep-html-prompt.md.
Guardrails
Apply ../../references/safety-guardrails.md:
review_flags are presented as 待医生确认项 (questions to confirm), never adjudicated into facts — they render in the yellow box with the 待确认 tag.
- No treatment recommendation. No result interpretation. No clinical judgment. No ranking of treatment options. visit-prep only assembles existing data + organizes questions.
- Never fabricate — any null/absent field renders the locale
val_pending string ("资料缺失 / 待补充"), not an invented value.
- Read-only on de-identified sources — no formal-field writes, no confirm-gate involvement, never read
raw/.
- Source strings preserved, with any patient-facing translation placed beside the original and labeled (../../references/i18n.md).
- HTML is rendered by the template engine + must pass the validator — never hand-written. The LLM produces
.visit_prep_data.json only; render_html_template.py fills the template; the pack is "done" only after validate_visit_prep_html.py exits 0. Hand-writing or post-editing the rendered HTML is forbidden.
Role behavior
Authoritative matrix in ../../references/roles.md. For this skill:
- Role = patient: 患者本人备问题 — first-person question list for the patient's own consult.
- Role = caregiver: 帮家人备问题 — same pack reframed as the caregiver preparing questions for the patient's visit.
- Role = family: if authorized for this task, operate only within the documented scope; otherwise
provide a blank visit-question template without reading patient records. Relationship alone is neither
permission nor a reason to disclose.
Disclosure (../../references/disclosure-behavior.md): family preferences do not override a capable patient's explicit request for their own information. For any legally valid restriction or uncertain capacity, show only content authorized for that viewer and route disclosure decisions to the treating team.
References