Watch Closely → Measurements + Cancer Pain Breakthrough Design
Version: 1.1
Last Updated: 2026-06-15 20:02:59
Status: Partially implemented — urine beaker + Bristol capture UI shipped on /vitals (2026-06-15); fever inline flags and cancer breakthrough remain per phase table below
Parent: 2026-06-09-care-profile-capability-platform-design.md
Proof point: Cancer at Home (cancer_at_home)
1. Goal
Section titled “1. Goal”Move Watch Closely from passive list rows on the cancer board into real, graphable measurements on the right LynCareOS surfaces — with inviting visual capture controls, not form fields.
| Watch item (today) | Target surface | Stored as |
|---|---|---|
| Urine colour / volume | Vital Signs (/vitals) | Intake/output record + trend |
| Stool / bowel changes | Vital Signs (/vitals) | Bristol-type record + trend |
| Fever / infection signs | Vital Signs (/vitals) | Temperature (existing) + derived fever band + optional symptom flags |
| Breakthrough pain | Pain & Stats (/pain) | patient_pain_entries with breakthrough context — same 0–10 score, cancer-specific presentation |
| Neuro changes (brain site) | Pain & Stats (/pain) | Nerve-layer / neuro-region pain entries + optional symptom checklist |
| Oxygen / breathing equipment | Vital Signs + link to Breathing board when entitled | SpO₂ (existing) + oxygen therapy session record |
The cancer board keeps a compact “Needs attention” strip (status + deep links + “last recorded”) — not the full capture UI.
2. Vital Signs page — new sections
Section titled “2. Vital Signs page — new sections”Layout below existing Pulse / SpO₂ / Temperature cards:
Vital Signs├── Date strip (existing)├── Core vitals row (existing)├── Fever & temperature ← enhanced├── Urine today ← new├── Bowel today ← new└── Oxygen (when active) ← new, profile-gated2.1 Fever & temperature (enhanced)
Section titled “2.1 Fever & temperature (enhanced)”Recording: User taps Temperature card (existing flow) — numeric °C/°F entry stays.
Visual fever band (derived, not a separate score):
| Band | °C (clinical) | Family label | Visual |
|---|---|---|---|
| Normal | < 37.5 | Normal | Cool blue-green thermometer fill |
| Elevated | 37.5 – 38.4 | Watch — possible fever | Amber fill + subtle pulse |
| High fever | ≥ 38.5 | High fever — call plan | Red fill + stronger alert styling |
After save, the temp card shows value + band label + thermometer arc (not just a dot). Trend chart plots temperature with coloured band background zones.
Optional (Phase 1b): Two tap chips under the thermometer after a high reading: “Feeling unwell” / “Shivering or sweating” — stored as optional flags on the same vitals row (fever_symptoms jsonb or boolean columns). Cancer fever pathway (call clinic now) remains a care-board session overlay until inline cards ship.
2.2 Urine — beaker + colour
Section titled “2.2 Urine — beaker + colour”Implementation status (2026-06-15): ✅ Shipped on Vital Signs → Intake/Output.
| Deliverable | Component / file |
|---|---|
| Hybrid PNG shell + SVG liquid fill | UrineVolumeBeaker.tsx, urineBeakerConstants.ts |
| mL slider (vertical desktop / horizontal mobile) | UrineVolumeSlider.tsx, UrineCapturePanel.tsx |
| Seven-step colour strip + SVG droplet | UrineColourSelector.tsx |
| Mobile full-screen capture + sticky Save | VitalsCaptureSheet.tsx, StickyActionBar.tsx |
| Collapsed today row (visual strip) | UrineEntryStrip.tsx in IntakeOutputSection.tsx |
| Daily stacked-bar trend | UrineTrendChart.tsx |
See 14-FRONTEND-PRESENTATION-STACK.md and 2026-06-15-vitals-ui-sophistication-roadmap.md.
One combined entry per time (default: once per day; allow multiple with time picker like core vitals).
Beaker slider (volume bands):
| Level | Label | Approx. volume |
|---|---|---|
| 0 | Very little | < 50 mL |
| 1 | Small | ~50–100 mL |
| 2 | Moderate | ~100–200 mL |
| 3 | Good | ~200–500 mL |
| 4 | Large | > 500 mL |
SVG glass beaker fills with animated liquid as the slider moves. Stored as urine_volume_band (0–4) — graphable as ordinal trend.
Colour tuner: Horizontal strip of six swatches (family labels):
- Pale straw
- Yellow
- Dark yellow / amber
- Brown
- Red or pink
- Cloudy or unusual
Stored as urine_color enum. Trend: stacked or categorical chart by day (most recent colour per day).
2.3 Bowel — Bristol-style picker
Section titled “2.3 Bowel — Bristol-style picker”Implementation status (2026-06-15): ✅ Shipped on Vital Signs → Intake/Output.
| Deliverable | Component / file |
|---|---|
| Types 1–7 PNG grid (desktop) / scroll-snap carousel (mobile) | BristolStoolSelector.tsx, public/assets/bristol/ |
| Concern flags (blood, black/tarry, …) | BristolStoolSelector.tsx — min-h-11 chips |
| Collapsed today row | BowelEntryVisual.tsx in IntakeOutputSection.tsx |
| BSFS trend chart | BristolStoolTrendChart.tsx |
Bristol type grid (Types 1–7) with simplified illustrations + one-line plain-language labels (not clinical jargon on the tile).
| Type | Plain label |
|---|---|
| 1–2 | Hard or lumpy — constipation |
| 3–4 | Normal |
| 5–7 | Loose or watery — diarrhoea |
Optional flags (multi-select chips): Blood seen · Black/tarry · Mucus · Pain with bowel movement.
Stored as stool_bristol (1–7) + stool_flags[]. Trend: Bristol type over time + flag markers on chart.
3. Pain & Stats — breakthrough pain (cancer presentation)
Section titled “3. Pain & Stats — breakthrough pain (cancer presentation)”Not a separate card. Breakthrough is a mode of recording on the existing body map — same patient_pain_entries.pain_level (0–10), stored in PostgreSQL like any other pain score.
3.1 Data model
Section titled “3.1 Data model”Add to patient_pain_entries:
| Column | Type | Purpose |
|---|---|---|
pain_context | text CHECK IN (general, breakthrough, neuro) | Default general; breakthrough for cancer rescue pain |
No parallel table. Trends API filters by pain_context. Existing entries backfill as general.
Alternative considered: Fixed body_region = 'breakthrough' — rejected; context column keeps analytics clean and works without map coordinates.
3.2 Cancer-specific UI (only when care_profile_slug = cancer_at_home)
Section titled “3.2 Cancer-specific UI (only when care_profile_slug = cancer_at_home)”On Record view, below or beside the body map:
- Breakthrough pain entry strip — distinct amber/violet accent (not default pain rose), Zap iconography, label “Breakthrough pain (cancer)”.
- Tap opens compact 0–10 scale (reuse
PainScaleBar) — optional “where does it hurt?” quick region picker, but score is required; region defaults to last breakthrough region or treatment-related site from primary cancer site. - Saved entries render on the map as breakthrough markers (different icon/shape from standard pain dots) and appear on Trend as a separate series: Breakthrough pain vs Body pain.
Dose logging: After scoring ≥7, offer “Log breakthrough dose” → existing /log?reason=breakthrough&source=cancer (CANC-C08). Score and dose stay linked by timestamp, not FK (Phase 1).
3.3 Non-cancer tenants
Section titled “3.3 Non-cancer tenants”Breakthrough context hidden unless cancer profile active (or breakthrough reason type configured). Other profiles can enable later via capability matrix.
4. Neuro + oxygen placement
Section titled “4. Neuro + oxygen placement”4.1 Neuro (brain primary site or neuro watch capability)
Section titled “4.1 Neuro (brain primary site or neuro watch capability)”Primary home: Pain & Stats
- Enable Mind layer + nerve anatomy type (already in schema).
- Cancer adds Neuro watch quick checklist on Record tab when
cancer_primary_site = brain:- Headache change · Confusion · Weakness · Speech change · Vision change · Seizure activity
- Each item: None / Mild / Significant (3-level tap) → stored as
care_module_events(Phase 1) orpatient_observationsslugneuro_watch(Phase 2). - High-significance taps surface on cancer board attention strip + visit prep.
Why Pain & Stats: Neuro symptoms are body/brain/mind mapped — not vitals.
4.2 Oxygen / breathing equipment
Section titled “4.2 Oxygen / breathing equipment”Primary home: Vital Signs (when cancer lung site OR oxygen treatment mode OR breathing profile)
- SpO₂ already on Vitals and Pain (Complete tier).
- New Oxygen today subsection:
- Equipment type (icon grid: concentrator, cylinder, cannula, mask — from platform equipment catalogue lite)
- Flow rate (L/min) optional
- Hours used today (stepper)
- Stored in new
patient_oxygen_sessionsor JSON on extended vitals row — graphable hours + flow trend.
Secondary: Deep link to Breathing board when breathing_difficulties profile also active.
5. Cancer board — Watch Closely becomes “Needs attention”
Section titled “5. Cancer board — Watch Closely becomes “Needs attention””Replace full CancerWatchClosely list with compact status row (max 4 items):
Needs attention today[Urine — not recorded] [Temp — normal 36.8] [Breakthrough — 2 today] [Neuro — review]Each chip: colour by status (missing / ok / alert), tap → /vitals or /pain with date + focus param.
buildWatchItems() evolves to buildAttentionItems() — reads measurement summaries from new APIs, not static copy.
6. Backend (Phase 1)
Section titled “6. Backend (Phase 1)”6.1 Migration V0xx__intake_output_vitals.sql
Section titled “6.1 Migration V0xx__intake_output_vitals.sql”Extend patient_vitals or add patient_intake_output:
-- Preferred: dedicated table (clean trends, multiple IO entries per day)CREATE TABLE patient_intake_output ( id serial PRIMARY KEY, tenant_id int NOT NULL, patient_id int NOT NULL, date text NOT NULL, recorded_time text NOT NULL DEFAULT '12:00', urine_volume_band smallint CHECK (urine_volume_band BETWEEN 0 AND 4), urine_color text CHECK (urine_color IN (...)), stool_bristol smallint CHECK (stool_bristol BETWEEN 1 AND 7), stool_flags jsonb DEFAULT '[]', fever_symptoms jsonb DEFAULT '[]', recorded_by int NOT NULL, created_at timestamptz DEFAULT now(), ...);Temperature stays on patient_vitals.temp_celsius. Fever band computed in service layer.
6.2 APIs
Section titled “6.2 APIs”| Method | Path | Purpose |
|---|---|---|
| GET | /api/patients/{id}/intake-output?date= | Day entries |
| POST | /api/patients/{id}/intake-output/{date} | Create urine/stool record |
| GET | /api/patients/{id}/intake-output/trend?days=30 | Charts |
| PATCH | /api/patients/{id}/pain/entries | Add pain_context on create |
| GET | /api/patients/{id}/pain/trend?context=breakthrough | Breakthrough series |
Module gate: vitals_tracking for IO; pain_tracking for breakthrough context UI on Complete.
6.3 OpenAPI
Section titled “6.3 OpenAPI”Export + npm run generate:types per REQ-PLAT-10.
7. Frontend components (new)
Section titled “7. Frontend components (new)”| Component | Location |
|---|---|
UrineBeakerCapture.tsx | components/vitals/ |
UrineColourPicker.tsx | components/vitals/ |
StoolBristolPicker.tsx | components/vitals/ |
FeverThermometerDisplay.tsx | components/vitals/ — band visual on temp card |
IntakeOutputTrendChart.tsx | components/vitals/ |
BreakthroughPainStrip.tsx | components/pain/cancer/ — cancer profile only |
BreakthroughPainMarker.tsx | components/pain/ — map overlay style |
NeuroWatchChecklist.tsx | components/pain/cancer/ — brain site gate |
OxygenTodayPanel.tsx | components/vitals/ — equipment gate |
Extend VitalsTracking.tsx — do not duplicate full IO on Pain page (Complete embeds vitals bar only; IO stays on /vitals for Family tier clarity).
8. Phased delivery
Section titled “8. Phased delivery”| Phase | Scope | Board change |
|---|---|---|
| 1a | DB + API + urine/beaker + colour + stool/Bristol on /vitals | Watch rows → links only |
| 1b | Fever thermometer band + temp trend zones | Fever chip uses live temp |
| 2a | pain_context + BreakthroughPainStrip + map markers + trend series | Breakthrough chip live |
| 2b | Neuro checklist (brain site) | Neuro chip live |
| 2c | Oxygen today panel | Oxygen chip live |
| 3 | buildAttentionItems() + remove legacy Watch Closely list | Compact attention strip |
9. Out of scope (Phase 1)
Section titled “9. Out of scope (Phase 1)”- Merging Observations module into Vitals UI
- Inline fever decision cards on board (keep overlay session)
- Care Orders / equipment catalogue full CRUD
- Visit prep auto-bullets from IO trends (Phase 3+)
10. Document history
Section titled “10. Document history”| Version | Date | Change |
|---|---|---|
| 1.0 | 2026-06-10 | Initial design from product direction: vitals IO widgets, fever bands, breakthrough pain context, neuro/oxygen placement |