This commit is contained in:
2026-02-16 10:50:14 +00:00
parent 24ffe03c0f
commit 5637d56e02
13 changed files with 66 additions and 2253 deletions
+331
View File
@@ -0,0 +1,331 @@
# Agent Output to Ralph Files Integration Plan
## Overview
This plan documents how to decode the agent output files from `AgentOutput/` and place the design recommendations into the relevant Ralph reference files in `Tasks/07-the-clinical-record/Ralph/refs/`.
---
## Agent to Ralph File Mapping
| Agent File | Component | Target Ralph File | Status |
|------------|-----------|-------------------|--------|
| `agent-a19ebc6.jsonl` | LoginScreen | `ref-transition-login.md` | ✅ Has existing design guidance |
| `agent-a1dd546.jsonl` | PatientBanner | `ref-banner-sidebar.md` | Needs design guidance appended |
| `agent-aa811d1.jsonl` | PatientBanner (detailed) | `ref-banner-sidebar.md` | Use for design decisions |
| `agent-aff857c.jsonl` | ClinicalSidebar | `ref-banner-sidebar.md` | Add to same file |
| `agent-a8a7a9b.jsonl` | PMRInterface + Breadcrumb | `ref-banner-sidebar.md` | Add layout guidance |
| `agent-a2bbd7e.jsonl` | InvestigationsView + DocumentsView | `ref-investigations-documents.md` | Needs design guidance |
| `agent-acompact-a5ee2e.jsonl` | Investigations + Documents (compact) | `ref-investigations-documents.md` | Alternative source |
| `agent-a32017e.jsonl` | SummaryView + Clinical Alert | `ref-summary-alert.md` | Needs alert interaction details |
| `agent-a403d5f.jsonl` | ReferralsView | `ref-referrals.md` | Needs form styling guidance |
| `agent-aab6185.jsonl` | MedicationsView | `ref-medications.md` | Needs table styling guidance |
| `agent-aeb60ce.jsonl` | ProblemsView | `ref-problems.md` | Needs traffic light guidance |
| `agent-afebbe0.jsonl` | ConsultationsView | `ref-consultations.md` | Needs H/E/P structure guidance |
---
## Design Guidance Structure to Add
Each Ralph file should have a "## Design Guidance (from /frontend-design)" section appended with:
1. **Aesthetic Direction** - The design philosophy/tone
2. **Key Design Decisions** - Specific implementation choices
3. **Implementation Patterns** - Code snippets and patterns
---
## File-by-File Plan
### 1. ref-transition-login.md
**Already contains design guidance** - verify it matches agent output:
From agent-a19ebc6:
- ✅ Aesthetic: Institutional Utilitarian
- ✅ Shadow: `0 1px 2px rgba(0,0,0,0.03)`
- ✅ Border: `1px solid #E5E7EB`
- ✅ Font: Geist Mono for credentials
- ✅ Accessibility: role="status", aria-label, prefers-reduced-motion
**Action**: Already complete - no changes needed.
---
### 2. ref-banner-sidebar.md
**Current content**: Patient Banner specs, Sidebar navigation, URL routing
**Needs to add from agents**:
From agent-aa811d1 (PatientBanner detailed):
- Animation refinements: Framer Motion AnimatePresence for condensed/full state swap
- Badge styling: True pill shape (rounded-full)
- NHS Number tooltip: Custom styled tooltip with Framer Motion
- Mobile overflow menu: AnimatePresence for enter/exit
- Action buttons: Loading state with spinner
- Layout measurements: Exact padding, margin values
From agent-aff857c (ClinicalSidebar):
- Keyboard navigation details: Alt+1-7, arrow keys, / for search
- Search input integration
- Tooltip positioning for tablet mode
- Focus management patterns
- Accessibility: aria-current for active item
From agent-a8a7a9b (PMRInterface + Breadcrumb):
- Layout timing: Patient banner (200ms), sidebar (250ms, 50ms delay), content (300ms, 100ms delay)
- View switching: INSTANT - no crossfade
- Breadcrumb deepening: When item expanded, show item name
- Breadcrumb styling: Inter 400, 13px, gray-400, chevron separators
**Action**: Append comprehensive design guidance section.
---
### 3. ref-investigations-documents.md
**Current content**: Table layouts, status badges, expanded views
**Needs to add from agent-a2bbd7e/acompact**:
Shared Pattern: ExpandableRow
- Component structure for row expansion
- Height animation only (200ms ease-out) - no opacity fade
- Chevron rotation (180 degrees)
- Only one expanded at a time
InvestigationsView specific:
- Status badges: Complete (green), Ongoing (amber), Live (pulsing green)
- Pulsing animation for Live status (CSS keyframes)
- Tree-indented structure with box-drawing characters
- View Results button pattern for external links
DocumentsView specific:
- Lucide icons mapping: FileText, Award, GraduationCap, FlaskConical
- Document type indicators
- Same tree-indented structure
**Action**: Append design guidance with expandable row patterns.
---
### 4. ref-summary-alert.md
**Current content**: Summary cards layout, Clinical Alert behavior
**Needs to add from agent-a32017e**:
Clinical Alert (signature interaction):
- Spring animation (not ease-out) for slide down
- Acknowledge button flow:
1. Warning icon cross-fades to green checkmark (200ms)
2. Holds 200ms
3. Alert height collapses (200ms ease-out)
- Session-only state (resets on refresh)
Summary Cards:
- Two-column key-value layout exact specs
- Card header styling: Inter 600, 14px, uppercase, #F9FAFB bg
- Traffic light dots: 8px circles with text labels (WCAG)
- "View Full List" link patterns
Second Alert (Consultations view):
- Trigger: First navigation to Consultations
- Same dismiss pattern as main alert
- Positioning beneath patient banner
**Action**: Append alert animation details and card styling specs.
---
### 5. ref-referrals.md
**Current content**: Form layout, priority toggle, direct contact
**Needs to add from agent-a403d5f**:
Referral Form:
- Priority radio button styling: Urgent (red), Routine (blue), Two-Week Wait (amber)
- Tooltip content: "All enquiries are welcome..." and "NHS cancer referral pathway..."
- Input focus state: NHS blue border + box-shadow `0 0 0 3px rgba(0,94,184,0.15)`
- Form validation patterns
Submit Button States:
- Default: NHS blue (#005EB8)
- Loading: Spinner icon
- Success: Checkmark + reference number generation (REF-YYYY-MMDD-NNN)
- Success message styling: 24-48 hours response time
**Action**: Append form interaction and state management patterns.
---
### 6. ref-medications.md
**Current content**: Table layout, medication categories, prescribing history
**Needs to add from agent-aab6185**:
Table Styling:
- Semantic HTML: table, thead, th (scope=col), tbody, tr, td
- Headers: Inter 600, 13px, uppercase, #F9FAFB bg
- Row height: 40px exactly
- Alternating backgrounds: #FFFFFF / #F9FAFB
- Hover: #EFF6FF (no transform, no lift)
- Status dots: 6px green circles + 'Active' text
Category Tabs:
- Active tab: White bg + NHS blue bottom border
- Inactive tab: Transparent bg
- Tab switching animation (instant)
Sortable Columns:
- Click header to sort
- Arrow indicator (up/down) in active column
- Default: category grouping
Prescribing History:
- Expand animation: Height only, 200ms ease-out
- Geist Mono 12px for history entries
- Year markers bold, descriptions regular
**Action**: Append table semantics and sorting patterns.
---
### 7. ref-problems.md
**Current content**: Active/resolved problems tables, traffic lights
**Needs to add from agent-aeb60ce**:
Traffic Light Status:
- 8px circles: Green (resolved), Amber (in-progress)
- MUST ALWAYS be paired with text labels (WCAG requirement)
- Never dots alone
- Code column: Geist Mono (e.g., [EFF001], [MGT001])
Expandable Rows:
- Full narrative: Problem, approach, tools, quantified outcome
- 'Linked consultations' buttons that navigate to Consultations view
- Row hover: #EFF6FF
Table Structure:
- Active Problems: Status | Code | Problem | Since
- Resolved Problems: Status | Code | Problem | Resolved | Outcome
**Action**: Append traffic light accessibility requirements.
---
### 8. ref-consultations.md
**Current content**: Journal layout, H/E/P structure, coded entries
**Needs to add from agent-afebbe0**:
Collapsed Entry:
- Date in Geist Mono 13px gray-500
- Organization in Inter 400 13px NHS blue
- Role in Inter 600 15px gray-900
- 'Key:' prefix in Inter 500 gray-500
- Status dot: Green (current), Gray (historical)
- 3px left border color-coded: NHS blue (#005EB8) or Tesco teal (#00897B)
Expanded Entry:
- Duration line
- HISTORY / EXAMINATION / PLAN section headers
- Headers: Inter 600, 12px, uppercase, letter-spacing 0.05em, gray-400
- Plan items as bullet lists
- CODED ENTRIES section at bottom: Geist Mono 12px, gray-500, bracket codes
Animation:
- Height-only expand animation, 200ms ease-out
- NO opacity fade on content
- Only one expanded at a time
- Chevron rotates 180 degrees when expanded
Second Alert:
- Appears on first navigation to Consultations view
- Same Acknowledge pattern as main alert
- Warning icon → Checkmark → Collapse
**Action**: Append H/E/P styling and animation details.
---
## Implementation Order
1. **Start with**: ref-banner-sidebar.md (most complex, multiple agents)
2. **Then**: ref-investigations-documents.md (shared patterns)
3. **Then**: ref-summary-alert.md (signature interaction)
4. **Then**: ref-consultations.md (core content view)
5. **Then**: ref-medications.md, ref-problems.md, ref-referrals.md (specialized views)
---
## Token-Efficient Approach
For each file:
1. Read the agent output file (focused read, only design guidance section)
2. Extract: Aesthetic direction, Key design decisions, Implementation patterns
3. Read the target Ralph file
4. Append the design guidance in the standard format
5. Write back
6. Clear context, move to next
This keeps context window usage minimal by processing one file at a time.
---
## Design Guidance Section Template
```markdown
---
## Design Guidance (from /frontend-design)
> Pre-baked design direction. Do NOT invoke `/frontend-design` at runtime — this section contains the output.
### Aesthetic Direction: [Name]
[Description of the design philosophy]
### Key Design Decisions
1. **[Decision name]**: [Description with specific values]
2. **[Decision name]**: [Description with specific values]
...
### Implementation Patterns
```tsx
// Key code patterns and snippets
```
```
---
## Completion Checklist
- [ ] ref-transition-login.md - Verify existing content (no changes needed)
- [ ] ref-banner-sidebar.md - Add PatientBanner, ClinicalSidebar, PMRInterface guidance
- [ ] ref-investigations-documents.md - Add InvestigationsView + DocumentsView guidance
- [ ] ref-summary-alert.md - Add SummaryView + Clinical Alert guidance
- [ ] ref-referrals.md - Add ReferralsView guidance
- [ ] ref-medications.md - Add MedicationsView guidance
- [ ] ref-problems.md - Add ProblemsView guidance
- [ ] ref-consultations.md - Add ConsultationsView guidance
---
## Notes
- All design guidance should be appending (not replacing) existing content
- Existing content in Ralph files has the "what" and "why"
- Design guidance adds the "how" with specific implementation details
- Keep code snippets minimal but complete enough to guide implementation
- Reference specific values: colors, fonts, sizes, timing functions
+982
View File
@@ -0,0 +1,982 @@
# Component Architecture Design: Adding Depth
> Design document — Feb 2026
> Follows requirements in `Ralph/depth-requirements.md`
> Based on audit of current codebase architecture
---
## 1. Architecture Overview
### Current Component Tree
```
App.tsx (Phase: boot → ecg → login → pmr)
└── AccessibilityProvider
├── BootSequence (locked)
├── ECGAnimation (locked)
├── LoginScreen
└── DashboardLayout
├── TopBar
├── Sidebar
├── Main Content Grid
│ ├── PatientSummaryTile
│ ├── LatestResultsTile + CoreSkillsTile
│ ├── LastConsultationTile
│ ├── CareerActivityTile
│ ├── EducationTile
│ └── ProjectsTile
└── CommandPalette
```
### Proposed Component Tree
```
App.tsx (Phase: boot → ecg → login → pmr)
└── AccessibilityProvider
├── BootSequence (locked)
├── ECGAnimation (locked)
├── LoginScreen ← MODIFIED (visual refresh, a.recruiter, connection status)
└── DetailPanelProvider ← NEW (context for panel state)
└── DashboardLayout ← MODIFIED (sub-nav, new tile order)
├── TopBar ← MODIFIED (session shows a.recruiter)
├── SubNav ← NEW (section jump bar)
├── Sidebar (unchanged)
├── Main Content Grid ← REORDERED
│ ├── PatientSummaryTile ← MODIFIED (CV_v4.md profile)
│ ├── LatestResultsTile ← MODIFIED (bigger numbers, panel trigger)
│ ├── ProjectsTile ← MOVED UP (card grid with thumbnails)
│ ├── CoreSkillsTile ← MOVED, FULL WIDTH (categorised groups)
│ ├── LastConsultationTile ← MODIFIED (panel trigger)
│ ├── CareerActivityTile ← MODIFIED (constellation embedded)
│ │ └── CareerConstellation ← NEW (D3.js force graph)
│ └── EducationTile ← MODIFIED (richer content, panel trigger)
├── DetailPanel ← NEW (slide-in from right)
└── CommandPalette ← UPDATED (new panel actions)
```
---
## 2. New Components
### 2.1 DetailPanel (`src/components/DetailPanel.tsx`)
The primary mechanism for depth. A slide-in panel from the right edge.
**Props Interface:**
```typescript
interface DetailPanelProps {
isOpen: boolean
onClose: () => void
width: 'narrow' | 'wide' // narrow: 400px, wide: 60vw
title: string // Header text
dotColor: CardHeaderProps['dotColor'] // Matches tile dot color
children: React.ReactNode // Content rendered inside
}
```
**Behaviour:**
- Renders a full-screen backdrop (`rgba(26,43,42,0.15)` + `backdrop-filter: blur(4px)`) and a panel div
- Panel slides in from `translateX(100%)``translateX(0)` over 250ms ease-out
- Backdrop fades in over 150ms
- Close: click backdrop, press Escape, or click X button
- Focus trap: first focusable element receives focus on open; Tab cycles within panel; focus returns to trigger element on close
- `aria-modal="true"`, `role="dialog"`, `aria-labelledby` pointing to title
- `prefers-reduced-motion`: skip slide animation, instant appear
**Layout:**
```
┌─────────────────────────────────────────────────┐
│ Blurred backdrop (click to close) │
│ ┌────────────────────────────┐│
│ │ ── X close button ──────── ││
│ │ ││
│ │ [dot] SECTION TITLE ││
│ │ ││
│ │ {children} ││
│ │ ││
│ │ (scrollable) ││
│ │ ││
│ └────────────────────────────┘│
└─────────────────────────────────────────────────┘
```
**CSS Custom Properties to add (index.css):**
```css
--panel-narrow: 400px;
--panel-wide: 60vw;
--backdrop-blur: 4px;
--backdrop-bg: rgba(26,43,42,0.15);
```
**Responsive:**
- On mobile (< 768px), both `narrow` and `wide` become full-width (100vw)
---
### 2.2 DetailPanelContext (`src/contexts/DetailPanelContext.tsx`)
Manages what content is displayed in the detail panel. Any tile can trigger it.
**Interface:**
```typescript
// Union type for all possible detail panel content
type DetailPanelContent =
| { type: 'kpi'; kpi: KPI }
| { type: 'skill'; skill: SkillMedication }
| { type: 'skills-all'; category?: SkillCategory }
| { type: 'consultation'; consultation: Consultation }
| { type: 'project'; investigation: Investigation }
| { type: 'education'; document: Document }
| { type: 'career-role'; consultation: Consultation } // from constellation click
interface DetailPanelContextValue {
content: DetailPanelContent | null
openPanel: (content: DetailPanelContent) => void
closePanel: () => void
isOpen: boolean
}
```
**Width mapping** (deterministic from content type):
```typescript
const widthMap: Record<DetailPanelContent['type'], 'narrow' | 'wide'> = {
'kpi': 'narrow',
'skill': 'narrow',
'skills-all': 'narrow',
'consultation': 'wide',
'project': 'wide',
'education': 'narrow',
'career-role': 'wide',
}
```
**Title mapping** (from content type + data):
```typescript
function getPanelTitle(content: DetailPanelContent): string {
switch (content.type) {
case 'kpi': return content.kpi.label
case 'skill': return content.skill.name
case 'skills-all': return 'All Medications'
case 'consultation': return content.consultation.role
case 'project': return content.investigation.name
case 'education': return content.document.title
case 'career-role': return content.consultation.role
}
}
```
**Integration:** Wraps `DashboardLayout` in `App.tsx`. The `DetailPanel` component reads from this context and renders the appropriate content.
---
### 2.3 SubNav (`src/components/SubNav.tsx`)
Section jump bar positioned between TopBar and content.
**Props Interface:**
```typescript
interface SubNavProps {
activeSection: string
onSectionClick: (sectionId: string) => void
}
interface NavSection {
id: string
label: string
tileId: string // data-tile-id to scroll to
}
```
**Sections:**
```typescript
const sections: NavSection[] = [
{ id: 'overview', label: 'Overview', tileId: 'patient-summary' },
{ id: 'skills', label: 'Skills', tileId: 'core-skills' },
{ id: 'experience', label: 'Experience', tileId: 'career-activity' },
{ id: 'projects', label: 'Projects', tileId: 'projects' },
{ id: 'education', label: 'Education', tileId: 'education' },
]
```
**Behaviour:**
- Fixed/sticky position below TopBar (top: 48px)
- Click → smooth-scroll to `[data-tile-id="${tileId}"]`
- Active section determined by `useActiveSection` hook (IntersectionObserver on tile elements)
- Active tab: teal underline (2px), text colour shifts to `var(--accent)`
- Inactive tabs: `var(--text-secondary)`
**Style:**
- Height: 36px
- Background: `var(--surface)` with bottom border `var(--border-light)`
- Tabs: 13px, font-weight 500, horizontal gap 24px, centred text
- Teal underline on active (2px, slides with 200ms transition)
- z-index: 99 (below TopBar at 100, above content)
**Existing hook to extend:** `src/hooks/useActiveSection.ts` — currently exists but may need updating to observe the correct tile IDs.
**CSS to add (index.css):**
```css
--subnav-height: 36px;
```
**Layout impact:** `marginTop` on the flex container below TopBar changes from `var(--topbar-height)` to `calc(var(--topbar-height) + var(--subnav-height))`.
---
### 2.4 CareerConstellation (`src/components/CareerConstellation.tsx`)
D3.js force-directed network graph embedded in the CareerActivityTile.
**Props Interface:**
```typescript
interface CareerConstellationProps {
onRoleClick: (consultationId: string) => void
onSkillClick: (skillId: string) => void
}
```
**Data Model:**
```typescript
interface ConstellationNode {
id: string
type: 'role' | 'skill'
label: string
// Role-specific:
organization?: string
startYear?: number
endYear?: number
orgColor?: string
// Skill-specific:
domain?: 'clinical' | 'technical' | 'leadership'
}
interface ConstellationLink {
source: string // node id
target: string // node id
strength: number // 0-1, how strongly connected
}
```
**Node Data (from consultations + skills + new mapping data):**
Role nodes (6, positioned chronologically):
1. Pre-Reg Pharmacist, Paydens (2015-2016)
2. Duty Pharmacy Manager, Tesco (2016-2017)
3. Pharmacy Manager, Tesco (2017-2022)
4. High-Cost Drugs Pharmacist, NHS (2022-2024)
5. Deputy Head, NHS (2024-present)
6. Interim Head, NHS (2025)
Skill nodes (drawn from skills.ts + new expanded skills data):
- Technical: Python, SQL, Power BI, JavaScript/TypeScript, Data Analysis, Algorithm Design, Excel
- Clinical: Medicines Optimisation, Clinical Pathways, Controlled Drugs, NICE TAs, Patient Safety
- Leadership: Budget Management, Team Development, Stakeholder Engagement, Change Management
Links connect skills to the roles where they were used/developed.
**D3 Integration Pattern:**
- Use a `useRef<SVGSVGElement>` to get the SVG container
- D3 operates on the SVG imperatively via `useEffect`
- React handles the wrapper container, D3 handles the graph rendering
- No React state for individual node positions (performance)
- Tooltip/hover state managed via D3 event handlers dispatching to React state for the detail panel
**Force Simulation Configuration:**
```typescript
d3.forceSimulation(nodes)
.force('charge', d3.forceManyBody().strength(-200))
.force('link', d3.forceLink(links).distance(80).strength(d => d.strength))
.force('x', d3.forceX(d => xScale(d.startYear)).strength(0.3)) // chronological
.force('y', d3.forceY(height / 2).strength(0.1))
.force('collision', d3.forceCollide(30))
```
The `forceX` with a time scale ensures roles flow left-to-right chronologically. Skill nodes cluster around their associated roles.
**Visual Design:**
- Role nodes: 24px radius circles, filled with `orgColor`, white text label
- Skill nodes: 10px radius, colour-coded by domain (clinical=`var(--success)`, technical=`var(--accent)`, leadership=`var(--amber)`)
- Links: thin lines (1px), `var(--border)` colour, opacity 0.3
- Hover role: connected skill nodes scale up, links brighten to `var(--accent)`, non-connected nodes fade to 0.15 opacity
- Hover skill: all connected role nodes highlight, link paths illuminate
- Click: dispatches to `onRoleClick` / `onSkillClick` → opens detail panel
**Container:**
- Full width of the CareerActivityTile
- Height: 400px (desktop), 300px (tablet), 250px (mobile)
- Background: subtle radial gradient from `var(--bg-dashboard)` centre to `var(--surface)` edge
- SVG fills the container with viewBox for responsiveness
**New dependency:** `d3` (specifically `d3-force`, `d3-selection`, `d3-scale`, `d3-transition`)
**New data file:** `src/data/constellation.ts` — defines the role-skill mapping:
```typescript
export interface RoleSkillMapping {
roleId: string // matches consultation.id
skillIds: string[] // matches skill IDs
}
export const roleSkillMappings: RoleSkillMapping[] = [
{
roleId: 'duty-pharmacist-2016',
skillIds: ['patient-care', 'medicines-optimisation', 'team-development'],
},
{
roleId: 'pharmacy-manager-2017',
skillIds: ['patient-care', 'medicines-optimisation', 'team-development', 'data-analysis', 'excel', 'change-management', 'budget-management'],
},
// ... etc for all roles
]
```
**Accessibility:**
- `role="img"` on SVG with `aria-label="Career constellation showing roles and skills across career timeline"`
- Screen-reader-only text description of the graph structure
- Keyboard navigation: Tab through role nodes, Enter to open detail panel
- `prefers-reduced-motion`: disable force simulation animation, render static layout
---
## 3. Modified Components
### 3.1 DashboardLayout — Modifications
**Changes:**
1. **Import and render SubNav** between TopBar and content flex container
2. **Reorder tiles:** PatientSummary → LatestResults + Projects → CoreSkills → LastConsultation → CareerActivity → Education
3. **Wrap in DetailPanelProvider** (or this wraps from App.tsx)
4. **Render DetailPanel** alongside CommandPalette
5. **Adjust marginTop** to account for SubNav height
**Updated grid in DashboardLayout:**
```tsx
<div className="dashboard-grid">
<PatientSummaryTile /> {/* full width */}
<LatestResultsTile /> {/* half width (left) */}
<ProjectsTile /> {/* half width (right) — MOVED UP */}
<CoreSkillsTile /> {/* full width — MOVED, was half */}
<LastConsultationTile /> {/* full width */}
<CareerActivityTile /> {/* full width — now includes constellation */}
<EducationTile /> {/* full width */}
</div>
```
**SubNav integration:**
```tsx
<motion.div initial="hidden" animate="visible" variants={topbarVariants}>
<TopBar onSearchClick={handleSearchClick} />
</motion.div>
<SubNav activeSection={activeSection} onSectionClick={handleSectionClick} />
{/* ... rest of layout with adjusted marginTop */}
```
**New CSS variable reference:**
- Content area `marginTop`: `calc(var(--topbar-height) + var(--subnav-height))`
- Content area `height`: `calc(100vh - var(--topbar-height) - var(--subnav-height))`
---
### 3.2 TopBar — Modifications
**Changes:**
1. Session user name: `Dr. A.CHARLWOOD``A.RECRUITER`
2. No structural changes otherwise
**Specific change:**
```tsx
// Line ~172: Change display name
<span ...>A.RECRUITER</span>
```
---
### 3.3 LoginScreen — Modifications
**Changes:**
1. **Username:** `A.CHARLWOOD``A.RECRUITER`
2. **Visual refresh:** Teal accents replacing NHS blue (`#005EB8``var(--accent)` / `#0D6E6E`)
3. **Connection status indicator:** New state machine below the login button
4. **Post-login loading state:** Brief "System loading..." before dashboard materialises
5. **Background colour:** `#1E293B` → consider matching `var(--bg-dashboard)` or a darker variant
**New state additions:**
```typescript
type ConnectionState = 'connecting' | 'connected'
const [connectionState, setConnectionState] = useState<ConnectionState>('connecting')
const [isLoading, setIsLoading] = useState(false) // post-click loading state
```
**Connection status flow:**
1. On mount + 400ms: start typing animation (existing)
2. After ~2000ms: `connectionState` transitions to `'connected'`
3. Login button is disabled until BOTH `typingComplete` AND `connectionState === 'connected'`
4. On login click: `isLoading = true`, show "System loading..." state for ~600ms, then `onComplete()`
**Connection indicator JSX (below login button, above footer):**
```tsx
<div style={{ display: 'flex', alignItems: 'center', gap: '6px', marginTop: '12px' }}>
<div style={{
width: '6px',
height: '6px',
borderRadius: '50%',
backgroundColor: connectionState === 'connected' ? 'var(--success)' : 'var(--alert)',
transition: 'background-color 300ms ease-out',
}} />
<span style={{ fontSize: '10px', fontFamily: 'var(--font-geist-mono)', color: 'var(--text-tertiary)' }}>
{connectionState === 'connected' ? 'Secure connection established' : 'Awaiting secure connection...'}
</span>
</div>
```
**Loading state (replaces card content after click):**
```tsx
{isLoading && (
<div className="flex flex-col items-center gap-3">
<div className="loading-spinner" /> {/* CSS animated spinner */}
<span style={{ fontSize: '12px', color: 'var(--text-secondary)' }}>
Loading clinical records...
</span>
</div>
)}
```
**Colour changes throughout LoginScreen:**
- `#005EB8``#0D6E6E` (accent colour for shield icon bg, active field border, cursor, button)
- `#004D9F``#0A8080` (button hover)
- `#004494``#085858` (button pressed)
- Background: `#1E293B` → keep as-is or lighten slightly to `#1A2B2A` (matches `--text-primary`)
---
### 3.4 CoreSkillsTile — Modifications (now full-width, categorised)
**Changes:**
1. **Full width** (add `full` prop to Card)
2. **Categorised display** with 3 groups: Technical, Healthcare Domain, Strategic & Leadership
3. **Show top 3-5 per category** on the dashboard
4. **"View all" button** triggers detail panel with full list
5. **Individual skill click** → detail panel for that skill
**New internal structure:**
```tsx
<Card full tileId="core-skills">
<CardHeader dotColor="amber" title="REPEAT MEDICATIONS" rightText="Active prescriptions" />
{/* Category tabs or grouped sections */}
{categories.map(category => (
<div key={category.id}>
<CategoryHeader label={category.label} count={category.skills.length} />
{category.skills.slice(0, 4).map(skill => (
<SkillItem
key={skill.id}
skill={skill}
onClick={() => openPanel({ type: 'skill', skill })}
/>
))}
{category.skills.length > 4 && (
<ViewMoreButton
count={category.skills.length - 4}
onClick={() => openPanel({ type: 'skills-all', category: category.id })}
/>
)}
</div>
))}
</Card>
```
**CategoryHeader sub-component (inline):**
- Thin divider line with category label
- Styled like sidebar section dividers: 10px, uppercase, tertiary, with extending line
---
### 3.5 LatestResultsTile — Modifications
**Changes:**
1. **Bigger headline numbers** — increase value font size from 22px to 28-32px
2. **Remove flip animation** — replace with click → detail panel
3. **Each KPI card is clickable**`openPanel({ type: 'kpi', kpi })`
4. **Visual enhancement:** stronger contrast, bolder presentation
**KPI card redesign (no more flip):**
```tsx
<button
onClick={() => openPanel({ type: 'kpi', kpi })}
className="text-left w-full"
style={{
padding: '16px',
background: 'var(--surface)',
border: '1px solid var(--border-light)',
borderRadius: 'var(--radius-sm)',
cursor: 'pointer',
transition: 'border-color 150ms, box-shadow 150ms',
}}
>
<div style={{ fontSize: '28px', fontWeight: 700, color: colorMap[kpi.colorVariant] }}>
{kpi.value}
</div>
<div style={{ fontSize: '12px', fontWeight: 500, color: 'var(--text-primary)', marginTop: '4px' }}>
{kpi.label}
</div>
<div style={{ fontSize: '10px', fontFamily: 'var(--font-geist-mono)', color: 'var(--text-tertiary)', marginTop: '2px' }}>
{kpi.sub}
</div>
</button>
```
**CSS cleanup:** Remove `.metric-card`, `.metric-card-inner`, `.metric-card-front`, `.metric-card-back` classes from `index.css` (no longer needed once flip is removed).
---
### 3.6 ProjectsTile — Modifications (now half-width, card grid)
**Changes:**
1. **Half width** (remove `full` prop) — positioned in right column alongside LatestResults
2. **Card grid layout** with thumbnails, title, status, tech tags
3. **Click → detail panel (wide)** for full project info
4. **Compact display** to fit in half-width tile
**New layout:**
```tsx
<Card tileId="projects">
<CardHeader dotColor="amber" title="ACTIVE PROJECTS" rightText="Investigations" />
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
{investigations.map(inv => (
<ProjectCard
key={inv.id}
investigation={inv}
onClick={() => openPanel({ type: 'project', investigation: inv })}
/>
))}
</div>
</Card>
```
**ProjectCard sub-component:**
- Compact row: status dot + name + year (right-aligned)
- Tech stack as small inline tags
- Hover: border colour shift, shadow deepens
- Click: opens wide detail panel
---
### 3.7 CareerActivityTile — Modifications
**Changes:**
1. **Embed CareerConstellation** component within the tile
2. **Timeline items click → detail panel** (instead of in-place accordion)
3. **Extended timeline** back to school (2009)
4. **Hover preview** on timeline items (slight expand with preview text)
**New structure:**
```tsx
<Card full tileId="career-activity">
<CardHeader dotColor="teal" title="CAREER ACTIVITY" rightText="Full timeline" />
{/* Career Constellation D3 graph */}
<CareerConstellation
onRoleClick={(id) => {
const consultation = consultations.find(c => c.id === id)
if (consultation) openPanel({ type: 'career-role', consultation })
}}
onSkillClick={(id) => {
const skill = allSkills.find(s => s.id === id)
if (skill) openPanel({ type: 'skill', skill })
}}
/>
{/* Existing timeline below */}
<div className="activity-grid" style={{ marginTop: '24px' }}>
{/* ... timeline items, now with click → panel instead of accordion */}
</div>
</Card>
```
---
### 3.8 EducationTile — Modifications
**Changes:**
1. **Richer inline content** — show research project score, OSCE score, A-level grades
2. **Click → detail panel (narrow)** for full education detail
3. Each education entry is a clickable row
---
### 3.9 LastConsultationTile — Modifications
**Changes:**
1. **Click → detail panel (wide)** for full role details
2. Add a "View full record" link/button at the bottom
---
### 3.10 PatientSummaryTile — Modifications
**Changes:**
1. **Content:** Replace current personalStatement with the exact profile text from CV_v4.md
2. **Structured presentation:** Consider pulling highlight stats into a visual strip
The profile.ts data is already the CV_v4.md text, so this may just be a presentation change.
---
## 4. Type System Extensions
### 4.1 New types (`src/types/pmr.ts` additions)
```typescript
// Skill categories for grouped display
export type SkillCategory = 'Technical' | 'Domain' | 'Leadership'
// Extended KPI with story content for detail panel
export interface KPIStory {
context: string // What this number covers
role: string // Your role / what you did
outcomes: string[] // Key decisions or results
period?: string // Time period
}
// Extended KPI type (augment existing)
export interface KPI {
id: string
value: string
label: string
sub: string
colorVariant: 'green' | 'amber' | 'teal'
explanation: string
story?: KPIStory // NEW: rich detail for panel
}
// Constellation-specific types
export interface ConstellationNode {
id: string
type: 'role' | 'skill'
label: string
shortLabel?: string // abbreviated for small nodes
organization?: string
startYear?: number
endYear?: number | null
orgColor?: string
domain?: 'clinical' | 'technical' | 'leadership'
}
export interface ConstellationLink {
source: string
target: string
strength: number
}
// Detail panel content union
export type DetailPanelContent =
| { type: 'kpi'; kpi: KPI }
| { type: 'skill'; skill: SkillMedication }
| { type: 'skills-all'; category?: SkillCategory }
| { type: 'consultation'; consultation: Consultation }
| { type: 'project'; investigation: Investigation }
| { type: 'education'; document: Document }
| { type: 'career-role'; consultation: Consultation }
// Education extras (for detail panel)
export interface EducationExtra {
documentId: string
extracurriculars?: string[]
researchDescription?: string
programmeDetail?: string
}
```
---
## 5. Data Extensions
### 5.1 Extended Skills (`src/data/skills.ts`)
Expand from 5 → ~20 skills across 3 categories. Source: CV_v4.md Core Competencies.
```typescript
// Technical (8 skills)
'data-analysis', 'python', 'sql', 'power-bi', 'javascript-typescript',
'excel', 'algorithm-design', 'data-pipelines'
// Healthcare Domain (6 skills)
'medicines-optimisation', 'population-health', 'nice-ta',
'health-economics', 'clinical-pathways', 'controlled-drugs'
// Strategic & Leadership (7 skills)
'budget-management', 'stakeholder-engagement', 'pharma-negotiation',
'team-development', 'change-management', 'financial-modelling', 'executive-comms'
```
Each retains the medication metaphor: frequency, startYear, yearsOfExperience, proficiency, status.
### 5.2 KPI Stories (`src/data/kpis.ts`)
Add `story` field to each existing KPI:
```typescript
{
id: 'budget',
value: '£220M',
// ... existing fields ...
story: {
context: 'Total prescribing budget for NHS Norfolk & Waveney ICB, covering primary care prescriptions for a population of 1.2 million across the integrated care system.',
role: 'Managed with sophisticated forecasting models, identifying cost pressures and enabling proactive financial planning. Full analytical accountability to ICB board.',
outcomes: [
'Sophisticated forecasting models identifying cost pressures',
'Proactive financial planning enabled across the system',
'Interactive dashboard tracking expenditure in real-time',
],
period: 'Jul 2024 — Present',
},
}
```
### 5.3 Constellation Mapping (`src/data/constellation.ts`)
New file mapping roles to skills for the D3 graph. Defines which skills connect to which roles.
### 5.4 Education Extras (`src/data/educationExtras.ts`)
New file with expanded detail for the education detail panel:
```typescript
export const educationExtras: EducationExtra[] = [
{
documentId: 'doc-mpharm',
extracurriculars: [
'President of UEA Pharmacy Society',
'Secretary & Vice-President of UEA Ultimate Frisbee',
'Publicity Officer for UEA Alzheimer\'s Society',
],
researchDescription: 'Final year research project investigating cocrystal formation for improved drug delivery properties.',
},
{
documentId: 'doc-mary-seacole',
programmeDetail: 'Formal NHS leadership qualification providing theoretical grounding in healthcare leadership approaches, change management, and system-level thinking.',
},
]
```
---
## 6. Detail Panel Content Renderers
The `DetailPanel` component delegates rendering to content-specific sub-components based on `content.type`:
### 6.1 KPIDetail (`src/components/detail/KPIDetail.tsx`)
- Headline number (large, coloured)
- Context paragraph
- "Your role" paragraph
- Outcome bullets
- Period badge
### 6.2 SkillDetail (`src/components/detail/SkillDetail.tsx`)
- Skill name + frequency + status badge
- Proficiency bar
- Years of experience
- Prescribing history timeline (reuse existing pattern from CoreSkillsTile)
- "Used in" section: list of roles that used this skill (from constellation mapping)
### 6.3 SkillsAllDetail (`src/components/detail/SkillsAllDetail.tsx`)
- Full categorised list of all skills
- Grouped by Technical / Healthcare Domain / Strategic & Leadership
- Each skill clickable to switch panel to individual skill detail
### 6.4 ConsultationDetail (`src/components/detail/ConsultationDetail.tsx`)
- Role title + organisation + dates
- History paragraph (from `consultation.history`)
- Achievement bullets (from `consultation.examination`)
- Plan/outcomes (from `consultation.plan`)
- Coded entries badges (from `consultation.codedEntries`)
- Technical environment list
### 6.5 ProjectDetail (`src/components/detail/ProjectDetail.tsx`)
- Project name + year + status
- Methodology description
- Tech stack tags
- Results bullets
- External link button (if available)
### 6.6 EducationDetail (`src/components/detail/EducationDetail.tsx`)
- Title + institution + dates + classification
- Research project description (if MPharm)
- Extracurricular activities
- Programme detail (if Mary Seacole)
- Notes
---
## 7. Hook Modifications
### 7.1 `useActiveSection` (existing, to update)
Currently may observe legacy view IDs. Update to observe the new tile `data-tile-id` attributes and map them to SubNav section IDs:
```typescript
const sectionTileMap: Record<string, string> = {
'patient-summary': 'overview',
'core-skills': 'skills',
'career-activity': 'experience',
'projects': 'projects',
'education': 'education',
}
```
### 7.2 `useFocusTrap` (new hook, `src/hooks/useFocusTrap.ts`)
For the DetailPanel. Traps Tab key focus within the panel when open.
```typescript
export function useFocusTrap(containerRef: RefObject<HTMLElement>, isActive: boolean): void
```
---
## 8. New Dependency
```bash
npm install d3 @types/d3
```
Only `d3-force`, `d3-selection`, `d3-scale`, `d3-transition` are needed. Can import selectively:
```typescript
import { forceSimulation, forceManyBody, forceLink, forceX, forceY, forceCollide } from 'd3-force'
import { select } from 'd3-selection'
import { scaleLinear } from 'd3-scale'
```
---
## 9. CSS Additions (`src/index.css`)
```css
/* Sub-nav bar */
--subnav-height: 36px;
/* Detail panel */
--panel-narrow: 400px;
--panel-wide: 60vw;
--backdrop-blur: 4px;
--backdrop-bg: rgba(26,43,42,0.15);
/* Detail panel slide animation */
@keyframes panel-slide-in {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
@keyframes panel-slide-out {
from { transform: translateX(0); }
to { transform: translateX(100%); }
}
@keyframes backdrop-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
@keyframes panel-slide-in { from { transform: none; } to { transform: none; } }
@keyframes panel-slide-out { from { transform: none; } to { transform: none; } }
@keyframes backdrop-fade-in { from { opacity: 1; } to { opacity: 1; } }
}
```
---
## 10. Implementation Phases
### Phase 1: Core Infrastructure
1. `DetailPanelContext` + `DetailPanel` component
2. `SubNav` component + `useActiveSection` update
3. `DashboardLayout` restructure (new tile order, SubNav, DetailPanel)
4. `useFocusTrap` hook
5. CSS additions (panel animations, sub-nav height)
### Phase 2: Tile Depth (iterative, per tile)
6. `LatestResultsTile` — remove flip, bigger numbers, panel trigger
7. `CoreSkillsTile` — full width, categorised, expanded data, "view all"
8. `ProjectsTile` — half width, card grid, panel trigger
9. `LastConsultationTile` — panel trigger
10. `CareerActivityTile` — timeline items → panel, hover preview
11. `EducationTile` — richer content, panel trigger
12. `PatientSummaryTile` — structured presentation
### Phase 3: Detail Panel Content
13. `KPIDetail` renderer + KPI stories data
14. `ConsultationDetail` renderer
15. `ProjectDetail` renderer
16. `SkillDetail` + `SkillsAllDetail` renderers
17. `EducationDetail` renderer + extras data
18. Update CommandPalette actions to use detail panel
### Phase 4: Career Constellation
19. Install d3, create `constellation.ts` data mapping
20. Build `CareerConstellation` component (D3 force graph)
21. Integrate into `CareerActivityTile`
22. Hover/click interactions → detail panel
23. Accessibility (keyboard nav, screen reader, reduced-motion)
### Phase 5: Login Refresh
24. Visual restyle (teal accents, fonts, shadows)
25. Username change to `a.recruiter`
26. Connection status indicator (red → green dot)
27. Post-login loading state
28. TopBar session name update
### Phase 6: Polish
29. Responsive testing (mobile: full-width panels, collapsed sub-nav)
30. `prefers-reduced-motion` audit across all new components
31. Command palette updates for new content/actions
32. Search index update for expanded skills data
---
## 11. File Inventory
### New Files (13)
```
src/contexts/DetailPanelContext.tsx
src/components/DetailPanel.tsx
src/components/SubNav.tsx
src/components/CareerConstellation.tsx
src/components/detail/KPIDetail.tsx
src/components/detail/SkillDetail.tsx
src/components/detail/SkillsAllDetail.tsx
src/components/detail/ConsultationDetail.tsx
src/components/detail/ProjectDetail.tsx
src/components/detail/EducationDetail.tsx
src/data/constellation.ts
src/data/educationExtras.ts
src/hooks/useFocusTrap.ts
```
### Modified Files (14)
```
src/App.tsx — wrap DashboardLayout with DetailPanelProvider
src/components/DashboardLayout.tsx — SubNav, tile reorder, DetailPanel render
src/components/TopBar.tsx — session name → A.RECRUITER
src/components/LoginScreen.tsx — visual refresh, connection status, username
src/components/Card.tsx — no changes needed (already supports full prop)
src/components/tiles/LatestResultsTile.tsx — remove flip, bigger numbers, panel
src/components/tiles/CoreSkillsTile.tsx — full width, categorised, view all
src/components/tiles/ProjectsTile.tsx — half width, card grid, panel
src/components/tiles/LastConsultationTile.tsx — add panel trigger
src/components/tiles/CareerActivityTile.tsx — constellation embed, panel triggers
src/components/tiles/EducationTile.tsx — richer content, panel trigger
src/components/tiles/PatientSummaryTile.tsx — structured presentation
src/data/skills.ts — expand to ~20 skills with categories
src/data/kpis.ts — add story fields
src/types/pmr.ts — new types
src/index.css — new CSS vars, animations
src/hooks/useActiveSection.ts — update for new tile IDs
src/lib/search.ts — update palette for new panel actions
package.json — add d3 dependency
```
### Unchanged (locked)
```
src/components/BootSequence.tsx
src/components/ECGAnimation.tsx
```
+300
View File
@@ -0,0 +1,300 @@
# Requirements Specification: Adding Depth to the GP Clinical Record
> Brainstorm session output — Feb 2026
> Source of truth for content: `References/CV_v4.md`
> ATS PDF is supplementary context only, not to be included wholesale.
---
## 1. Problem Statement
The current dashboard feels flat and light on information. Content is thin, sections feel like footnotes rather than showcases, and there's no mechanism to drill into detail. Projects are buried at the bottom. KPI numbers don't hit hard enough. Skills show only 5 items with no way to see more. The whole experience lacks depth, interactivity, and the sense that there's rich content behind every surface.
---
## 2. Core UX Patterns
### 2.1 Right-Side Detail Panel
A slide-in panel from the right edge of the screen — the primary mechanism for depth.
- **Trigger:** "View more" buttons, clickable career items, skills, KPIs, projects
- **Entrance:** Slides in from the right. Dashboard content blurs slightly behind via backdrop-filter.
- **Adaptive width:**
- **Narrow (~400px):** For simple items — individual skills, education entries, single KPI stories
- **Wide (~60% viewport):** For complex items — career roles with achievement lists, projects with screenshots/outcomes/tech stacks
- **Close:** Click outside the panel, press Escape, or click a close button
- **Animation:** 250ms ease-out slide, 150ms backdrop blur transition
- **Accessibility:** Focus trap when open, Escape to close, ARIA role="dialog"
### 2.2 Sub-Navigation Bar
A fixed navigation strip below the TopBar for section jumping.
- **Position:** Immediately below TopBar, above the card grid content area
- **Labels:** `Overview` | `Skills` | `Experience` | `Projects` | `Education`
- **Behaviour:**
- Click → smooth-scroll to that section
- Active tab highlights based on scroll position (IntersectionObserver)
- Sticky — stays visible as user scrolls
- **Style:** Clean, understated. Matches GP system tab row aesthetic. Teal underline for active tab.
### 2.3 Hover + Click Interaction Model
Everything should feel alive and reactive:
- **Hover:** Items lift slightly — shadow deepens, subtle border colour shift. Cursor changes to pointer.
- **Click:** Opens the detail panel with full content for that item.
- **Career activity items:** Expand a small amount inline on hover (preview), then full detail via click → panel.
---
## 3. Revised Dashboard Layout
Tile order changes to prioritise what matters. Projects move up to be prominent. Skills get full width above career history.
```
┌───────────────────────────────────────────────────────┐
│ TopBar (fixed, 48px) │
│ Brand | Search (Ctrl+K) | Session: a.recruiter │
├───────────────────────────────────────────────────────┤
│ Sub-Nav Bar (fixed/sticky) │
│ Overview | Skills | Experience | Projects | Education│
├───────────┬───────────────────────────────────────────┤
│ │ │
│ Sidebar │ 1. Patient Summary (full width) │
│ (272px) │ CV_v4.md profile text │
│ │ │
│ Person │ 2. Latest Results | Projects │
│ Header │ (KPIs, left) | (card grid, right) │
│ │ │
│ Tags │ 3. Repeat Medications (full width) │
│ │ Categorised skill groups │
│ Alerts │ │
│ │ 4. Last Consultation (full width) │
│ │ │
│ │ 5. Career Activity (full width) │
│ │ Timeline + Career Constellation │
│ │ │
│ │ 6. Education (full width) │
│ │ │
└───────────┴───────────────────────────────────────────┘
```
### Changes from current:
- **Projects move from bottom → half-width right column** (row 2, alongside KPIs)
- **Skills move from half-width right → full-width** (row 3, above career history)
- **Sub-nav bar added** between TopBar and content
- **TopBar session info** shows `a.recruiter` post-login
---
## 4. Section Requirements
### 4.1 Patient Summary (Profile)
**Content source:** The `## Profile` section from `CV_v4.md`:
> "Healthcare leader combining clinical pharmacy expertise with proficiency in Python, SQL, and data analytics, self-taught over the past decade through a drive to find root causes in data and build the most efficient solutions to complex problems. Currently leading population health analytics for NHS Norfolk & Waveney ICB, serving a population of 1.2 million..."
**Presentation:**
- Use the full profile paragraph from CV_v4.md
- Structured — consider pulling out key highlights (years of experience, population served, budget managed) as a visual strip alongside the narrative
- Not a wall of text — break it up with hierarchy
---
### 4.2 Latest Results (KPIs) — Left Column
**Problem:** Current flip cards feel like footnotes. £220M should be a headline.
**Dashboard display:**
- 4 KPI cards with **bold, large headline numbers** — visually dominant
- Stronger contrast, larger type than current implementation
- Each card is clearly clickable
**Click → Detail Panel (narrow):**
- Opens with the **story behind the number**
- Structure per KPI:
- Headline number + label
- Context: what it covers, scope, significance
- Your role: what you did with this number
- Key decisions or outcomes
- Optional: supporting visual (mini chart, comparison, timeline)
**KPIs from CV_v4.md:**
1. **£220M** — Prescribing budget managed with sophisticated forecasting models
2. **£14.6M** — Efficiency programme identified through data analysis; over-target by Oct 2025
3. **9+ Years** — Professional experience (Aug 2016present)
4. **1.2M** — Population served (Norfolk & Waveney ICS)
---
### 4.3 Projects (Investigations) — Right Column (NEW POSITION)
**Problem:** Currently buried at the bottom as small expandable items.
**Dashboard display:**
- Card grid with **thumbnails/screenshots**, title, status badge, tech tags
- Prominent placement alongside KPIs draws immediate attention
- Each card is clickable
**Click → Detail Panel (wide):**
- Full project description
- Outcome metrics and results
- Tech stack with tags
- Live link / GitHub link where available
- Screenshot or demo visual
**Projects from current data:**
1. PharMetrics Interactive Platform (2024, Live) — with external link
2. Patient Switching Algorithm (2025, Complete)
3. Blueteq Generator (2023, Complete)
4. CD Monitoring System (2024, Complete)
5. Sankey Chart Analysis Tool (2023, Complete)
---
### 4.4 Skills / Repeat Medications — Full Width (NEW POSITION)
**Problem:** Only 5 skills, no categorisation, no view more.
**Dashboard display:**
- **Categorised groups** (like BNF chapters in a real formulary):
- **Technical:** Python, SQL, Power BI, JavaScript/TypeScript, Real-world data analysis, Dashboard/tool development, Algorithm design, Data pipeline development
- **Healthcare Domain:** Medicines optimisation, Population health analytics, NICE TA implementation, Health economics & outcomes, Clinical pathway development, Controlled drug assurance
- **Strategic & Leadership:** Budget management (£220M), Stakeholder engagement, Pharmaceutical negotiation, Team development & training, Change management, Financial scenario modelling, Executive communication
- **Display:** Top 3-5 per category visible on the dashboard tile, with medication-style frequency/dosing metaphor
- **"View all" button** per category or for the whole section
**Click → Detail Panel (narrow):**
- Full categorised list of all skills
- Each skill with: proficiency level, years of experience, frequency metaphor (daily, twice daily, when required, etc.)
- Skills are interactive — clicking a skill could show which roles/projects used it
---
### 4.5 Last Consultation — Full Width
**Dashboard display:**
- Most recent role with headline info (title, organisation, dates, type)
- Brief preview of key achievements (2-3 bullets)
**Click → Detail Panel (wide):**
- Full role description from CV_v4.md
- All achievement bullets
- Technical environment
- Coded entries (if applicable)
---
### 4.6 Career Activity + Career Constellation — Full Width
#### Timeline (existing, enhanced)
- Colour-coded timeline: teal (roles), amber (projects), green (certifications), purple (education)
- **Extended back to school (2009)** — Highworth Grammar through university through career
- Role entries expand slightly on hover with preview text
- Click → detail panel for full role information
#### Career Constellation (NEW — D3.js)
- **Embedded within the Career Activity section** as a large visual (not a separate view)
- **Force-directed network graph** built with D3.js:
- **Role nodes:** Large, positioned chronologically left-to-right
- Pre-Registration Pharmacist, Paydens (2015-2016)
- Duty Pharmacy Manager, Tesco (2016-2017)
- Pharmacy Manager, Tesco (2017-2022)
- High-Cost Drugs & Interface Pharmacist, NHS (2022-2024)
- Deputy Head, Population Health & Data Analysis, NHS (2024-present)
- Interim Head, Population Health & Data Analysis, NHS (2025)
- **Skill nodes:** Smaller, orbit around the roles they belong to
- Colour-coded by domain: clinical (green), technical (teal), leadership (amber)
- **Bridge connections:** Skills spanning multiple roles create visible links between eras
- e.g., Python connects Tesco-era self-teaching → NHS data work
- e.g., Clinical pathway knowledge bridges community pharmacy → NHS HCD role
- **Interactions:**
- Hover role → its skill cluster highlights and radiates outward
- Hover skill → all roles that used it illuminate, showing the through-line
- Click role/skill → detail panel
- **Purpose:** Demonstrates D3.js/data-vis capability as portfolio content itself
---
### 4.7 Education — Full Width
**Dashboard display:**
- Education entries with more detail than current:
1. MPharm (Hons) 2:1 — University of East Anglia, 2011-2015
- Research project: Drug delivery & cocrystals, 75.1% (Distinction)
- 4th year OSCE: 80%
2. Mary Seacole Programme — NHS Leadership Academy, 2018, 78%
3. A-Levels — Highworth Grammar School, 2009-2011
- Mathematics (A*), Chemistry (B), Politics (C)
**Click → Detail Panel (narrow):**
- Full education detail including extracurriculars (Pharmacy Society President, Ultimate Frisbee VP, Alzheimer's Society)
- Research project description
- Mary Seacole programme detail (change management, healthcare leadership, system-level thinking)
---
## 5. Login Page Refresh
### 5.1 Visual Overhaul
- Restyle the login card to match the GP dashboard aesthetic:
- Teal accents (not the current colour scheme)
- Elvaro Grotesque font
- Refined shadows matching the three-tier system
- Warm palette cohesive with the dashboard it leads into
- Background should feel like the system's pre-authenticated state
### 5.2 Username Change
- **Username typed:** `a.recruiter` (the recruiter is logging into your clinical records)
- **TopBar post-login:** Session shows `a.recruiter` as the logged-in user
- Password typing remains as dots
### 5.3 "Awaiting Secure Connection" Polish
- Below the login button: a status indicator area
- **Initial state:** Red dot + "Awaiting secure connection..."
- **After ~2 seconds:** Dot transitions to green + "Secure connection established"
- **Login button** becomes clearly interactive only after the green state (was previously greyed/inactive)
- Optional: subtle smart card or security authentication visual cue (e.g., a small chip card icon or lock icon animating)
### 5.4 Post-Login Transition
- On button click: brief "System loading..." state with a clinical-style progress indicator
- Slight delay (500-800ms) to feel purposeful
- Then dashboard materialises with the existing staggered entrance animation (TopBar → Sidebar → Content)
---
## 6. Technical Decisions
| Decision | Choice | Rationale |
|----------|--------|-----------|
| Career Constellation | D3.js | Industry standard. Most impressive as portfolio piece. Demonstrates serious data-vis skill. |
| Detail Panel | Custom React component | Slide-in panel with backdrop blur. Adaptive width based on content type. |
| Sub-Nav | IntersectionObserver + scroll | Scroll-spy for active state, smooth scroll on click. |
| Content source | CV_v4.md | Primary source of truth for all factual content. |
---
## 7. Content Source Hierarchy
1. **`References/CV_v4.md`** — Primary source of truth for all roles, dates, achievements, numbers
2. **`References/Andy_Charlwood_CV_ATS_Optimised.pdf`** — Supplementary context only. Do NOT include wholesale. Use only when CV_v4.md lacks specific detail.
3. **`cv-website` data** — Reference for interactivity patterns and content structure, not content itself
---
## 8. What This Specification Does NOT Cover
Per `/sc:brainstorm` boundaries, this document covers requirements only:
- **No architecture decisions** — use `/sc:design` for component architecture
- **No implementation code** — use `/sc:implement` for building
- **No database schemas or API contracts** — N/A (static SPA)
- **No technical specifications beyond requirements** — implementation details deferred
### Recommended Next Steps
1. `/sc:design` — Design component architecture for detail panel, sub-nav, constellation
2. `/sc:workflow` — Generate implementation task breakdown
3. Implementation — Build in phases (core UX patterns → section depth → constellation → login refresh)
+381
View File
@@ -0,0 +1,381 @@
{
"project": "Portfolio — LLM CV Knowledge Accuracy",
"branchName": "ralph/llm-cv-knowledge",
"description": "Migrate from Gemini to OpenRouter (z-ai/glm-5), enrich LLM context with full CV detail, and benchmark accuracy against 10 verifiable questions until 90%+ pass rate.",
"userStories": [
{
"id": "US-001",
"title": "Install @xenova/transformers and add generate-embeddings script skeleton",
"description": "As a developer, I need the Transformers.js dependency installed and a runnable script scaffold so subsequent stories can generate and use embeddings.",
"acceptanceCriteria": [
"npm install @xenova/transformers",
"Create scripts/generate-embeddings.ts with a main() function that imports the pipeline from @xenova/transformers",
"Script loads the all-MiniLM-L6-v2 model and embeds a single test string, logging the vector length to confirm it works",
"Add npm script: \"generate-embeddings\": \"npx tsx scripts/generate-embeddings.ts\"",
"Running npm run generate-embeddings prints the vector length (384) and exits cleanly",
"Typecheck passes"
],
"priority": 1,
"passes": true,
"notes": "Use @xenova/transformers (not @huggingface/transformers — the Xenova fork has better Node.js ONNX support). The model ID is 'Xenova/all-MiniLM-L6-v2'. Pipeline type is 'feature-extraction'. tsx is already available via npx for running TypeScript scripts."
},
{
"id": "US-002",
"title": "Build rich text representations for each palette item",
"description": "As a developer, I want each palette item to have a natural-language paragraph for embedding that captures deep context, not just the title.",
"acceptanceCriteria": [
"New function buildEmbeddingTexts() in src/lib/search.ts that returns Array<{ id: string, text: string }> for all palette items",
"Consultation items include: role, org, duration, history narrative, examination bullets, coded entry descriptions",
"Skill items include: name, category, frequency, proficiency percentage, years of experience",
"KPI items include: value, label, explanation, story context and outcomes",
"Investigation items include: name, methodology, tech stack list, results",
"Education items include: title, institution, type, research detail",
"Quick Action items include: title and subtitle (short text is fine)",
"Achievement items include: title, subtitle, and linked KPI story context if available",
"Each text is a readable natural-language paragraph, not a keyword dump",
"Typecheck passes"
],
"priority": 2,
"passes": true,
"notes": "This function will be used by both the build script (to generate embeddings) and potentially by the chat widget (for context). Import the raw data files (consultations, skills, kpis, investigations, documents) to access the full data beyond what buildPaletteData() surfaces. The id must match the PaletteItem id so embeddings can be correlated."
},
{
"id": "US-003",
"title": "Generate and commit embeddings.json",
"description": "As a developer, I want the generate-embeddings script to produce a complete embeddings.json file using the rich text representations.",
"acceptanceCriteria": [
"scripts/generate-embeddings.ts imports buildEmbeddingTexts() from src/lib/search.ts",
"Script embeds each item's text using the all-MiniLM-L6-v2 model via @xenova/transformers pipeline",
"Outputs src/data/embeddings.json as an array of { id: string, embedding: number[] }",
"Each embedding is a 384-dimensional float array",
"Running npm run generate-embeddings regenerates the file successfully",
"The JSON file is valid and parseable",
"Typecheck passes"
],
"priority": 3,
"passes": true,
"notes": "The pipeline returns a Tensor — use .tolist() or .data to extract the raw float array. Mean-pool across the token dimension (dim 1) to get a single 384-d vector per input. Process items sequentially to avoid OOM in Node. The output file will be ~200KB for ~40 items with 384 floats each."
},
{
"id": "US-004",
"title": "Preload ONNX model during boot sequence",
"description": "As a visitor, I want the semantic search model to download in the background during the boot/ECG/login phases so it's ready when I reach the dashboard.",
"acceptanceCriteria": [
"New src/lib/embedding-model.ts module that exports: initModel(), embedQuery(text: string), and isModelReady()",
"initModel() loads the all-MiniLM-L6-v2 pipeline from @xenova/transformers and stores it in a module-level variable",
"embedQuery() returns a Promise<number[]> (384-d vector) for a given text string",
"isModelReady() returns boolean indicating if the model has finished loading",
"initModel() is called in App.tsx useEffect on mount (during boot phase) — fire and forget, no await",
"If initModel() fails (network error, etc.), isModelReady() remains false — no error thrown or shown",
"Model is cached by @xenova/transformers in IndexedDB — subsequent page loads are near-instant",
"Boot/ECG/login animations are not affected by model loading",
"Typecheck passes"
],
"priority": 4,
"passes": true,
"notes": "Use pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2') which auto-downloads and caches the ONNX model. The module-level pattern (let pipelineInstance = null) avoids React re-render issues. embedQuery should mean-pool the tensor output the same way as the build script. Wrap initModel() in a try/catch that silently swallows errors."
},
{
"id": "US-005",
"title": "Implement cosine similarity search module",
"description": "As a developer, I need a semantic search function that compares a query embedding against pre-computed item embeddings and returns ranked results.",
"acceptanceCriteria": [
"New src/lib/semantic-search.ts module",
"Exports semanticSearch(queryEmbedding: number[], embeddings: Array<{ id: string, embedding: number[] }>, threshold?: number): Array<{ id: string, score: number }>",
"Uses cosine similarity: dot(a,b) / (magnitude(a) * magnitude(b))",
"Results sorted by score descending",
"Optional threshold parameter filters out low-relevance results (default 0.3)",
"Exports loadEmbeddings() that imports embeddings.json and returns the parsed array",
"Typecheck passes"
],
"priority": 5,
"passes": true,
"notes": "Keep the cosine similarity implementation simple — no libraries needed for 384-d vectors over ~40 items. The loadEmbeddings function can use a dynamic import or direct import of the JSON file (Vite handles JSON imports natively)."
},
{
"id": "US-006",
"title": "Integrate semantic search into command palette",
"description": "As a visitor, I want the command palette to use semantic search when available, falling back to Fuse.js otherwise.",
"acceptanceCriteria": [
"CommandPalette.tsx checks isModelReady() from embedding-model.ts",
"When model is ready and query is non-empty: call embedQuery(query), then semanticSearch() against loaded embeddings, then map result IDs back to PaletteItem objects",
"When model is NOT ready: use existing Fuse.js search (current behavior preserved exactly)",
"Search is debounced by ~200ms to avoid calling embedQuery on every keystroke",
"Results maintain existing groupBySection() grouping and section ordering",
"Existing keyboard navigation, action routing, and UI unchanged",
"Typecheck passes",
"Verify in browser: search 'data analysis' surfaces analytics-related roles/skills not just items with 'data' in title"
],
"priority": 6,
"passes": true,
"notes": "The debounce is important — embedQuery takes ~20-50ms per call. Use a useRef + setTimeout pattern or a simple debounce hook. The mapping from semantic search results (id + score) back to PaletteItems should use a Map for O(1) lookup. Keep the Fuse.js imports and buildSearchIndex — they're the fallback path."
},
{
"id": "US-007",
"title": "Chat widget — floating button component",
"description": "As a visitor, I see a floating chat button at the bottom-right of the dashboard that I can click to open a chat panel.",
"acceptanceCriteria": [
"New src/components/ChatWidget.tsx component",
"Renders a 48px circular button, fixed position, bottom: 24px, right: 24px",
"Uses teal accent background (var(--accent)), white MessageCircle icon from lucide-react",
"Shadow: var(--shadow-md). Hover: var(--shadow-lg) + scale(1.05) transition",
"Button has a subtle entrance animation: fade + translateY(8px) → translateY(0), delayed ~1s after mount",
"Respects prefers-reduced-motion (no animation, just visible)",
"z-index above dashboard content but below command palette overlay (z-index 90)",
"onClick toggles an isOpen state (panel rendering comes in next story)",
"Mounted in DashboardLayout.tsx",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 7,
"passes": true,
"notes": "Use framer-motion for the entrance animation to match the rest of the app's motion patterns. The button should use font-ui for any text. On mobile (<640px), button is 40px and positioned bottom: 16px, right: 16px. The VITE_GEMINI_API_KEY env var check can wait until the Gemini integration story — for now just render the button unconditionally."
},
{
"id": "US-008",
"title": "Chat widget — panel UI with message display",
"description": "As a visitor, I want a chat panel that opens above the floating button where I can type questions and see responses.",
"acceptanceCriteria": [
"Chat panel renders when isOpen is true, positioned above the floating button (bottom: 88px, right: 24px)",
"Panel dimensions: 380px wide, max-height 480px, with overflow-y auto for messages",
"Header: title text ('Ask about Andy'), close button (X icon)",
"Message area: user messages right-aligned in teal-tinted bubbles, assistant messages left-aligned in light gray bubbles",
"Input area at bottom: text field with placeholder 'Ask me anything...', send button (Send icon)",
"Enter key submits message, Shift+Enter for newline",
"Panel entrance animation: scale(0.95) + opacity(0) → scale(1) + opacity(1), 200ms ease-out",
"Panel exit animation: reverse of entrance",
"Respects prefers-reduced-motion",
"Responsive: on mobile (<640px), panel is full-width (left: 0, right: 0, bottom: 0) with rounded top corners only",
"Messages are stored in component state as Array<{ role: 'user' | 'assistant', content: string }>",
"Submitting a message adds it to state and shows it in the UI (no API call yet — assistant response is a placeholder)",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 8,
"passes": true,
"notes": "Use the design system tokens: var(--surface) for panel bg, var(--border-light) for borders, var(--text-primary) for text, var(--accent) for user bubble bg at 10% opacity, font-ui for body text, font-geist for timestamps. The placeholder assistant response can be a static string like 'AI chat coming soon — this is a preview of the chat interface.' This lets us verify the full UI before wiring up Gemini."
},
{
"id": "US-009",
"title": "Chat widget — Gemini Flash integration",
"description": "As a visitor, I can ask natural language questions and get intelligent, streamed answers about Andy's experience.",
"acceptanceCriteria": [
"New src/lib/gemini.ts module that exports sendChatMessage(messages: ChatMessage[], cvContext: string): AsyncGenerator<string>",
"Calls Google Gemini Flash API (gemini-2.0-flash) using the REST API with fetch (no SDK needed)",
"API key sourced from import.meta.env.VITE_GEMINI_API_KEY",
"System prompt includes structured CV context built from buildEmbeddingTexts() output",
"System prompt instructs the model to answer questions about Andy's professional experience accurately and concisely",
"System prompt instructs the model to include relevant palette item IDs in its response as a JSON array at the end",
"Responses are streamed using the Gemini streaming endpoint",
"ChatWidget.tsx wires up real messages: on submit, calls sendChatMessage and streams tokens into the assistant message bubble",
"Loading state shown (typing indicator) while waiting for first token",
"If VITE_GEMINI_API_KEY is not set, chat button is still visible but panel shows 'Chat is currently unavailable' message",
"If API call fails, show error message in chat: 'Sorry, I couldn't process that. Please try again.'",
"Conversation history (last 10 messages) passed to API for multi-turn context",
"Typecheck passes"
],
"priority": 9,
"passes": true,
"notes": "Gemini REST streaming endpoint: POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent?alt=sse&key=API_KEY. The response is SSE (server-sent events) — parse each 'data:' line as JSON and extract candidates[0].content.parts[0].text. The system prompt with CV context will be ~2-3K tokens — well within Gemini Flash limits. For the palette item IDs, instruct the model to end its response with a line like [ITEMS: id1, id2, id3] which can be parsed client-side."
},
{
"id": "US-010",
"title": "Chat widget — clickable portfolio item cards in responses",
"description": "As a visitor, I want AI chat responses to include clickable portfolio items so I can drill into relevant sections.",
"acceptanceCriteria": [
"After parsing the assistant response, extract referenced palette item IDs from the [ITEMS: ...] suffix",
"Render matched items as compact clickable cards below the answer text in the assistant bubble",
"Cards reuse icon/color mapping from CommandPalette (iconByType, iconColorStyles)",
"Cards show item title and subtitle in a compact horizontal layout",
"Clicking a card triggers the same action routing as command palette via handlePaletteAction in DashboardLayout",
"If no items are referenced or IDs don't match, no cards are shown (just the text answer)",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 10,
"passes": true,
"notes": "The action routing needs to flow from ChatWidget up to DashboardLayout. Add an onAction prop to ChatWidget (same pattern as CommandPalette). DashboardLayout passes handlePaletteAction to ChatWidget. Export iconByType and iconColorStyles from CommandPalette (or extract to a shared module) so ChatWidget can reuse them."
},
{
"id": "US-011",
"title": "Mobile full-screen chat panel",
"description": "As a mobile visitor, I want the chat panel to be a full-screen overlay so it's easy to use on small screens.",
"acceptanceCriteria": [
"Below md breakpoint (768px), chat panel renders as full-screen overlay using position: fixed; inset: 0 with 100dvh height",
"Full-screen mode has the existing header with close button (no visual change needed, just full-width)",
"Floating chat button is hidden (display: none or opacity: 0) while panel is open on mobile (<768px)",
"Above 768px, existing panel behavior is unchanged (380px wide, anchored bottom-right, max-height 480px)",
"Panel open/close animation still respects prefers-reduced-motion",
"Safe area insets applied via env(safe-area-inset-*) for notched devices",
"Input area stays pinned to bottom of screen on mobile",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 11,
"passes": true,
"notes": "The current ChatWidget already has some mobile handling (bottom-sheet style at <640px). This story changes the breakpoint to 768px (md) and makes it truly full-screen instead of 85vh. Use 100dvh (dynamic viewport height) to account for mobile browser chrome. The floating button visibility can be controlled by combining isOpen state with a CSS media query or a useMediaQuery hook. The <style> block with data-chat-panel attribute is the place to update responsive rules."
},
{
"id": "US-012",
"title": "Welcome message with suggested question chips",
"description": "As a visitor opening the chat, I see a friendly welcome message and clickable suggested questions so I know what to ask.",
"acceptanceCriteria": [
"When chat panel is open and conversation is empty, display welcome text: 'Hey! I'm here to help you learn more about Andy. What would you like to know?'",
"Welcome text is styled as an AI message bubble (left-aligned, light background, same styling as assistant messages)",
"Below the welcome bubble, show 2-3 clickable pill/chip buttons with suggested questions",
"Suggested questions: 'What's his NHS experience?', 'Tell me about his data skills', 'What projects has he built?'",
"Chips styled with: teal accent border, rounded-full, font-ui 12-13px, hover state (teal background tint)",
"Clicking a chip sends that question as a user message (same codepath as typing + Enter)",
"Welcome message and chips always visible when conversation is empty (persist across panel open/close)",
"Once any message is sent, the welcome/chips area is replaced by the conversation messages",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 12,
"passes": true,
"notes": "Replace the current empty-state text ('Ask me anything about Andy's experience, skills, or projects.') with the new welcome bubble + chips. The chips should call handleSubmit (or equivalent) with the chip text pre-filled — simplest approach is setInputValue(chipText) then immediately trigger submit. Check that the welcome state reappears if the user hasn't sent a message (messages.length === 0). The suggested questions could live in a const array at the top of ChatWidget for easy future editing."
},
{
"id": "US-013",
"title": "Self-host ONNX embedding model",
"description": "As a developer, I want the ONNX model files served from the same host as the site to eliminate dependency on Hugging Face CDN.",
"acceptanceCriteria": [
"Model files for Xenova/all-MiniLM-L6-v2 downloaded and placed in public/models/all-MiniLM-L6-v2/onnx/ (matching HF repo structure)",
"Required files present: model_quantized.onnx, tokenizer.json, tokenizer_config.json, config.json, and any other files the pipeline expects",
"src/lib/embedding-model.ts updated: configure @xenova/transformers env to use local model path (e.g., env.localModelPath or custom model URL pointing to /models/)",
"scripts/generate-embeddings.ts also updated to use the same local model path for consistency",
"Model files are NOT in .gitignore — they are committed as static assets",
"No network requests to huggingface.co in the browser network tab when semantic search is used",
"Semantic search still works correctly in the command palette after the change",
"Typecheck passes"
],
"priority": 13,
"passes": true,
"notes": "Transformers.js uses env.localModelPath or env.remoteHost to control where models are fetched from. Setting env.localModelPath = '/models/' should make it look for files at /models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx etc. The Vite public/ directory serves files at the root — so public/models/ becomes /models/ at runtime. For the build script (Node.js), use a file:// path or the local filesystem path instead. Download model files from https://huggingface.co/Xenova/all-MiniLM-L6-v2/tree/main — the quantized ONNX model is ~23MB. Check what files the pipeline actually requests by watching network tab before making this change."
},
{
"id": "US-014",
"title": "Migrate production chat from Gemini to OpenRouter",
"description": "As a developer, I need to replace the Gemini API integration with OpenRouter so the chat uses z-ai/glm-5.",
"acceptanceCriteria": [
"Rename src/lib/gemini.ts to src/lib/llm.ts",
"Update all imports across the codebase (ChatWidget.tsx, search.ts, any other files importing from gemini.ts)",
"Replace Gemini API calls with OpenRouter's OpenAI-compatible API (POST https://openrouter.ai/api/v1/chat/completions)",
"Model set to z-ai/glm-5 in request body",
"API key read from import.meta.env.VITE_OPEN_ROUTER_API_KEY via Authorization: Bearer header",
"Include HTTP-Referer and X-Title headers as recommended by OpenRouter docs",
"SSE streaming works using OpenRouter's stream: true option (parse choices[0].delta.content from each SSE data line)",
"System prompt sent as first message with role: 'system' (OpenAI chat completions format)",
"Message history uses role: 'user' | 'assistant' (no 'model' mapping needed — already correct)",
"Export updated constant: LLM_DISPLAY_NAME = 'GLM-5' and update ChatWidget model indicator text",
"Rename isGeminiAvailable() to isLLMAvailable() and update all call sites",
"Typecheck passes",
"Verify in browser: chat opens, sends a message, streams a response correctly"
],
"priority": 14,
<<<<<<< Updated upstream
"passes": true,
"notes": "The current API base is 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash'. Change the model segment to 'gemini-3-flash-preview'. The API path structure (v1beta/models/{model}:streamGenerateContent) should be the same. Verify that gemini-3-flash-preview is the correct model ID — check Google AI Studio or the API docs. For the display name, use a human-friendly string like 'Gemini 3 Flash' (not the full model ID). The constant should be defined at the top of gemini.ts and exported for use in ChatWidget."
=======
"passes": false,
"notes": "OpenRouter uses the OpenAI-compatible format. Key differences from Gemini: (1) Auth via Bearer token header, not URL param. (2) System prompt is a message with role:'system', not a separate system_instruction field. (3) Streaming SSE data lines contain {choices:[{delta:{content:'...'}}]}, not candidates[0].content.parts[0].text. (4) The [DONE] sentinel is the same. (5) Add headers: 'HTTP-Referer': window.location.origin, 'X-Title': 'Andy Charlwood Portfolio'. The buildSystemPrompt() function and its content stay the same — only the API transport changes. The buildRequestBody() function needs the most changes."
},
{
"id": "US-015",
"title": "Migrate benchmark script to OpenRouter",
"description": "As a developer, I need the benchmark harness to use OpenRouter so it tests the same model and prompt path as production.",
"acceptanceCriteria": [
"scripts/benchmark.ts uses OpenRouter API (POST https://openrouter.ai/api/v1/chat/completions) instead of Gemini",
"API key read from process.env.VITE_OPEN_ROUTER_API_KEY (loaded from .env file)",
"Request body uses OpenAI chat completions format: messages array with system/user roles",
"Model set to z-ai/glm-5 in request body",
"Auth via Authorization: Bearer header (not URL param)",
"Rate limit retry logic updated for OpenRouter error responses (429 status)",
"Response parsing updated: extract choices[0].message.content (non-streaming endpoint)",
"Scoring calls also use OpenRouter with same model",
"Model name in results output updated to z-ai/glm-5",
"npm run benchmark runs end-to-end without errors",
"Typecheck passes"
],
"priority": 15,
"passes": false,
"notes": "The benchmark uses the non-streaming endpoint (no stream:true needed). OpenRouter non-streaming response format: { choices: [{ message: { content: '...' } }] }. The buildSystemPrompt() function should be imported from the renamed llm.ts (or duplicated if the import path alias doesn't work in tsx scripts — check if @/ alias resolves). Keep the same retry logic structure but update status code handling for OpenRouter. The scoring prompt and question flow are unchanged — only the API transport layer changes."
},
{
"id": "US-016",
"title": "Enrich system prompt with full CV context",
"description": "As a portfolio visitor, I want the AI to have comprehensive knowledge of Andy's background so it can answer detailed questions accurately.",
"acceptanceCriteria": [
"buildSystemPrompt() in llm.ts includes full professional profile narrative from CV_v4.md",
"Each role includes full achievement bullets, not just the summary text from buildEmbeddingTexts()",
"Clear section headers in the prompt: Professional Profile, Career History (per role with dates/employer), Education, Skills, Projects",
"NHS employment (May 2022+) explicitly distinguished from private sector (Tesco PLC)",
"Clinical specialties listed under the relevant role (rheumatology, ophthalmology, dermatology, etc.)",
"Methodology details included (e.g., how the switching algorithm worked, what dm+d integration involved)",
"Education includes specific grades, subjects, research topics, classifications",
"Leadership training (Mary Seacole Programme) included with year and result",
"No invented or extrapolated content — everything sourced from CV_v4.md and data files",
"System prompt remains under 8KB total",
"Typecheck passes"
],
"priority": 16,
"passes": false,
"notes": "The current system prompt uses buildEmbeddingTexts() which gives one paragraph per palette item — good for embeddings but too compressed for detailed Q&A. The enriched prompt should read more like a structured CV with full bullet points. Source content from References/CV_v4.md — read the file to extract all detail. Consider structuring as: ## Profile (personal statement), ## Career History (each role as ### with bullets), ## Education (each qualification), ## Projects (each project with tech and outcomes). Keep it well-structured with markdown headers — LLMs parse this better than flat text."
},
{
"id": "US-017",
"title": "Improve system prompt instructions and LLM parameters",
"description": "As a portfolio visitor, I want the AI to cite specifics, distinguish between employers, and aggregate across roles when asked.",
"acceptanceCriteria": [
"Prompt instructs LLM to distinguish NHS employment (ICB, May 2022+) from private sector (Tesco PLC, community pharmacy)",
"Prompt instructs LLM to aggregate across roles when asked broad questions (e.g., 'what tools has Andy built?' should list tools from ALL roles)",
"Prompt instructs LLM to cite specific metrics, dates, and outcomes when available rather than being vague",
"Prompt instructs LLM to answer from the provided context only and say so when information isn't available",
"Temperature lowered from 0.7 to 0.3-0.5 for more consistent factual responses",
"maxOutputTokens increased from 512 to at least 768 to avoid truncating detailed answers",
"The [ITEMS: ...] suffix instruction is preserved and clear",
"Typecheck passes"
],
"priority": 17,
"passes": false,
"notes": "These are behavioral instructions that go in the Rules section of the system prompt. Keep them concise — LLMs follow shorter, clearer rules better than long paragraphs. Consider: '1. Distinguish NHS employment (May 2022present, ICB) from private sector (Tesco PLC). 2. When asked about tools/skills across career, aggregate from ALL roles. 3. Cite specific numbers, dates, and outcomes — never say approximate when exact figures are available. 4. If the answer isn't in the context, say so clearly.' Temperature and maxTokens are set in the API request config, not the prompt."
},
{
"id": "US-018",
"title": "Enrich embedding texts and regenerate embeddings",
"description": "As a portfolio visitor, I want semantic search to surface relevant results even for nuanced queries by having richer embedding texts.",
"acceptanceCriteria": [
"buildEmbeddingTexts() in search.ts generates richer text per item with full achievement narratives, methodology detail, and clinical specialties",
"Role history narratives are included (currently only examination bullets and codedEntries may be used)",
"Cross-references included where items relate (e.g., CD monitoring project links to controlled drugs skill)",
"Embedding texts remain well-formed natural language (not keyword soup)",
"Embeddings regenerated by running npm run generate-embeddings",
"Output written to src/data/embeddings.json",
"Number of embeddings matches number of palette items (currently 42)",
"Typecheck passes"
],
"priority": 18,
"passes": false,
"notes": "This combines the PRD's US-005 (enrich texts) and US-006 (regenerate embeddings) since they must happen together. Review what buildEmbeddingTexts() currently produces and identify gaps — the benchmark questions highlight what's missing (e.g., clinical specialties, methodology detail, dm+d context, employer classification). After modifying the texts, run npm run generate-embeddings to regenerate. Verify the embedding count matches before and after."
},
{
"id": "US-019",
"title": "Run benchmark and validate accuracy",
"description": "As a developer, I want to run the benchmark against the enriched prompt and verify the pass threshold is met.",
"acceptanceCriteria": [
"Run npm run benchmark successfully against OpenRouter with enriched system prompt",
"Score 18/20 or higher (90%+ accuracy) on the 10 benchmark questions",
"No question scores 0 (no factual errors)",
"Results saved to scripts/benchmark-results/ as a timestamped iteration file",
"Additionally test 5 general questions manually or via script: 'Tell me about Andy', 'What does Andy do?', 'How can I contact Andy?', 'What is this website?', 'What are Andy's strongest skills?'",
"General questions produce sensible, accurate responses without degradation",
"If benchmark fails threshold, identify failing questions and make structural improvements to the prompt (not question-specific hacks), then re-run",
"Final passing results saved as evidence"
],
"priority": 19,
"passes": false,
"notes": "This is the iterative loop. In a single Ralph iteration, run the benchmark, review results, and if needed make targeted improvements to the system prompt in llm.ts. Focus on structural fixes: if Q7 (clinical specialties) fails, ensure the system prompt lists specialties under the relevant role — this helps ALL specialty questions, not just Q7. If the benchmark takes too many iterations, focus on getting the most impactful improvements in and document remaining gaps. The anti-benchmaxing rules apply: no hardcoded answers, no question-specific prompt clauses."
>>>>>>> Stashed changes
}
]
}
+392
View File
@@ -0,0 +1,392 @@
<#
.SYNOPSIS
Ralph Wiggum Loop - Visualization Improvements variant.
.DESCRIPTION
Outer loop for iterative chart improvement (bug fixes, polish, new analytics).
Each iteration spawns a fresh `claude --print` invocation.
Memory persists via filesystem only: git commits, progress.txt, IMPLEMENTATION_PLAN.md, guardrails.md.
Runs until completion (<promise>COMPLETE</promise>) or circuit breaker trips.
No arbitrary iteration limit — the loop continues until done.
Circuit breakers prevent runaway costs:
- No git changes for N consecutive iterations (stalled)
- Same error repeated N consecutive iterations (stuck)
.PARAMETER Model
Initial Claude model to use. Default: "sonnet". The agent can dynamically switch
models between iterations via <next-model>opus|sonnet</next-model> signals.
.PARAMETER BranchName
Optional git branch name. If provided, creates/checks out the branch before starting.
.PARAMETER MaxNoProgress
Number of consecutive iterations with no git changes before circuit breaker trips. Default: 3.
.PARAMETER MaxSameError
Number of consecutive iterations with the same error before circuit breaker trips. Default: 3.
.EXAMPLE
.\ralph.ps1 -Model "opus" -BranchName "feature/dash-migration"
.EXAMPLE
.\ralph.ps1 -Model "sonnet" -MaxNoProgress 2
#>
param(
[string]$Model = "opus",
[string]$BranchName,
[int]$MaxNoProgress = 3,
[int]$MaxSameError = 3
)
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$promptFile = Join-Path $scriptDir "RALPH_PROMPT.md"
$planFile = Join-Path $scriptDir "IMPLEMENTATION_PLAN.md"
$guardrailsFile = Join-Path $scriptDir "guardrails.md"
$progressFile = Join-Path $scriptDir "progress.txt"
$logDir = Join-Path $scriptDir "logs"
# --- Validation ---
if (-not (Test-Path $promptFile)) {
Write-Error "RALPH_PROMPT.md not found at $promptFile"
exit 1
}
if (-not (Test-Path $planFile)) {
Write-Error "IMPLEMENTATION_PLAN.md not found at $planFile"
exit 1
}
if (-not (Test-Path $guardrailsFile)) {
Write-Warning "guardrails.md not found at $guardrailsFile - loop may miss known failure patterns"
}
# Ensure progress.txt exists
if (-not (Test-Path $progressFile)) {
@"
# Progress Log
## Design Context
<!-- Design decisions and context go here -->
## Reflex Patterns
<!-- Reusable Reflex patterns discovered during development -->
## Iteration Log
<!-- Each iteration appends a structured entry below. See RALPH_PROMPT.md for format. -->
"@ | Set-Content -Path $progressFile -Encoding UTF8
Write-Host "Created progress.txt"
}
# Ensure logs directory exists
if (-not (Test-Path $logDir)) {
New-Item -ItemType Directory -Path $logDir | Out-Null
Write-Host "Created logs directory"
}
# --- Git Setup ---
$gitInitialised = $false
try {
$result = git rev-parse --is-inside-work-tree 2>&1
if ($LASTEXITCODE -eq 0 -and $result -eq "true") {
$gitInitialised = $true
}
} catch {
# Not a git repo — expected on first run
}
if (-not $gitInitialised) {
Write-Host "Initialising git repository..."
git init
git add -A
git commit -m "Initial commit before Ralph loop"
}
if ($BranchName) {
$currentBranch = git branch --show-current
if ($currentBranch -ne $BranchName) {
$branchExists = git branch --list $BranchName
if ($branchExists) {
Write-Host "Switching to existing branch: $BranchName"
git checkout $BranchName
} else {
Write-Host "Creating branch: $BranchName"
git checkout -b $BranchName
}
}
}
# --- Circuit Breaker State ---
$noProgressCount = 0
$lastErrorSignature = ""
$sameErrorCount = 0
# Capture the HEAD commit hash before the loop starts
$preLoopHead = git rev-parse HEAD 2>$null
# --- Main Loop ---
$promptContent = Get-Content -Path $promptFile -Raw
# Count existing iterations from progress.txt to track total across runs
$existingIterations = 0
if (Test-Path $progressFile) {
$existingIterations = (Select-String -Path $progressFile -Pattern "## Iteration" -AllMatches | Measure-Object).Count
}
Write-Host ""
Write-Host "===== Ralph Wiggum Loop (Visualization Improvements) =====" -ForegroundColor Cyan
Write-Host "Model: $Model (dynamic switching enabled) | Visual review: Playwright MCP | Runs until COMPLETE" -ForegroundColor Cyan
Write-Host "Circuit breakers: no-progress=$MaxNoProgress, same-error=$MaxSameError" -ForegroundColor Cyan
if ($BranchName) { Write-Host "Branch: $BranchName" -ForegroundColor Cyan }
if ($existingIterations -gt 0) { Write-Host "Previous iterations: $existingIterations" -ForegroundColor Cyan }
Write-Host "===========================================" -ForegroundColor Cyan
Write-Host ""
# --- Dev Server (for visual review via Playwright MCP) ---
$devServerPort = 5173
$devServerPid = $null
try {
$null = Invoke-WebRequest -Uri "http://localhost:$devServerPort" -TimeoutSec 2 -ErrorAction Stop
Write-Host "Dev server detected on port $devServerPort" -ForegroundColor Green
} catch {
Write-Host "Starting dev server (port $devServerPort)..." -ForegroundColor Cyan
$devProc = Start-Process -FilePath "npm.cmd" -ArgumentList "run", "dev" -PassThru -WindowStyle Minimized
$devServerPid = $devProc.Id
for ($w = 1; $w -le 20; $w++) {
Start-Sleep -Seconds 1
try {
$null = Invoke-WebRequest -Uri "http://localhost:$devServerPort" -TimeoutSec 2 -ErrorAction Stop
Write-Host "Dev server ready on port $devServerPort" -ForegroundColor Green
break
} catch {
if ($w -eq 20) {
Write-Warning "Dev server may not be ready - visual review steps may fail"
}
}
}
}
Write-Host ""
$i = 0
while ($true) {
$i++
$totalIteration = $existingIterations + $i
Write-Host ""
Write-Host "--- Iteration $i (Total: $totalIteration) ---" -ForegroundColor Yellow
# Record HEAD before this iteration
$headBefore = git rev-parse HEAD 2>$null
# Show start time and status
$iterStart = Get-Date
Write-Host " Started: $($iterStart.ToString('HH:mm:ss'))" -ForegroundColor DarkGray
Write-Host " Spawning Claude ($Model)..." -ForegroundColor DarkGray
Write-Host ""
# Spawn fresh Claude instance with stream-json for tool call visibility
$logFile = Join-Path $logDir "iteration_$totalIteration.log"
$rawLogFile = Join-Path $logDir "iteration_$totalIteration.raw.jsonl"
$maxRetries = 10
$retryCount = 0
$outputString = ""
$apiOverloaded = $false
do {
$apiOverloaded = $false
$textBuilder = [System.Text.StringBuilder]::new()
$toolCount = 0
# Clear raw log file for this attempt
if (Test-Path $rawLogFile) { Remove-Item $rawLogFile -Force }
if ($retryCount -gt 0) {
$backoffSeconds = [Math]::Pow(2, $retryCount - 1)
Write-Host " [Retry $retryCount/$maxRetries] API overloaded, waiting $backoffSeconds seconds..." -ForegroundColor DarkYellow
Start-Sleep -Seconds $backoffSeconds
Write-Host " Retrying Claude invocation..." -ForegroundColor DarkGray
}
$promptContent | claude --print --verbose --dangerously-skip-permissions --model $Model --output-format stream-json 2>&1 | ForEach-Object {
$line = $_.ToString().Trim()
if (-not $line) { return }
# Save raw event for debugging (with error handling for stream closure)
try {
Add-Content -Path $rawLogFile -Value $line -Encoding UTF8 -ErrorAction SilentlyContinue
} catch {
# Stream closed or file locked - ignore and continue
}
try {
$evt = $line | ConvertFrom-Json -ErrorAction Stop
# --- Tool use start (show tool name) ---
if ($evt.type -eq 'content_block_start' -and $evt.content_block.type -eq 'tool_use') {
$toolCount++
$toolName = $evt.content_block.name
Write-Host " [$toolName]" -ForegroundColor DarkCyan
}
# --- Assistant text content (streaming deltas) ---
elseif ($evt.type -eq 'content_block_delta' -and $evt.delta.type -eq 'text_delta' -and $evt.delta.text) {
Write-Host -NoNewline $evt.delta.text
[void]$textBuilder.Append($evt.delta.text)
}
# --- Result event (error display + text capture for circuit breakers) ---
elseif ($evt.type -eq 'result') {
if ($evt.subtype -eq 'error_result' -and $evt.error) {
Write-Host " [ERROR] $($evt.error)" -ForegroundColor Red
[void]$textBuilder.AppendLine("ERROR: $($evt.error)")
}
elseif ($evt.result) {
# Capture for circuit breaker detection; don't print
# (text already displayed via streaming deltas above)
[void]$textBuilder.AppendLine($evt.result)
}
}
# --- Message-level content (final message summary) ---
elseif ($evt.message -and $evt.message.content) {
foreach ($block in $evt.message.content) {
if ($block.type -eq 'text' -and $block.text) {
Write-Host $block.text
[void]$textBuilder.AppendLine($block.text)
}
elseif ($block.type -eq 'tool_use') {
$toolCount++
Write-Host " [$($block.name)]" -ForegroundColor DarkCyan
}
# Silently ignore tool_result and other block types
}
}
# All other JSON events (input_json_delta, content_block_stop,
# message_start, message_stop, ping, etc.) are silently ignored
} catch {
# Not valid JSON — only print if it looks like meaningful stderr
# (filter out JSON fragments from multi-line events)
if ($line -and $line -notmatch '^\s*[\{\[\}\]"]') {
Write-Host $line -ForegroundColor DarkYellow
[void]$textBuilder.AppendLine($line)
}
}
}
$outputString = $textBuilder.ToString()
# Check for 529 overloaded error
if ($outputString -match "529.*overloaded|overloaded_error") {
$apiOverloaded = $true
$retryCount++
if ($retryCount -ge $maxRetries) {
Write-Host " [ERROR] API overloaded after $maxRetries retries, giving up." -ForegroundColor Red
}
}
# Check for usage limit with cooldown (e.g. "Usage limit reached. Reset at 3 pm")
elseif ($outputString -match "(?i)usage limit reached.*reset at (\d{1,2})(?::(\d{2}))?\s*(am|pm)") {
$resetHour = [int]$Matches[1]
$resetMinute = if ($Matches[2]) { [int]$Matches[2] } else { 0 }
$resetAmPm = $Matches[3]
if ($resetAmPm -ieq "pm" -and $resetHour -ne 12) { $resetHour += 12 }
elseif ($resetAmPm -ieq "am" -and $resetHour -eq 12) { $resetHour = 0 }
$now = Get-Date
$resetTime = Get-Date -Hour $resetHour -Minute $resetMinute -Second 0
if ($resetTime -le $now) { $resetTime = $resetTime.AddDays(1) }
$resetTime = $resetTime.AddMinutes(2)
$waitSeconds = [Math]::Ceiling(($resetTime - $now).TotalSeconds)
$waitMinutes = [Math]::Ceiling($waitSeconds / 60)
Write-Host ""
Write-Host " [USAGE LIMIT] Reset at $($Matches[1]) $resetAmPm. Cooling down ~$waitMinutes minutes (until $($resetTime.ToString('HH:mm')))..." -ForegroundColor Yellow
Start-Sleep -Seconds $waitSeconds
Write-Host " [USAGE LIMIT] Cooldown complete. Retrying iteration..." -ForegroundColor Green
$apiOverloaded = $true
# Don't increment retryCount — deterministic wait, not a flaky error
}
} while ($apiOverloaded -and $retryCount -lt $maxRetries)
$outputString | Set-Content -Path $logFile -Encoding UTF8
# Show elapsed time and tool count
$elapsed = (Get-Date) - $iterStart
Write-Host ""
Write-Host " Finished: $(Get-Date -Format 'HH:mm:ss') (elapsed: $($elapsed.ToString('mm\:ss')), tools: $toolCount)" -ForegroundColor DarkGray
# --- Circuit Breaker: No Progress ---
$headAfter = git rev-parse HEAD 2>$null
if ($headAfter -eq $headBefore) {
$noProgressCount++
Write-Host " [Circuit Breaker] No git commits this iteration ($noProgressCount/$MaxNoProgress)" -ForegroundColor DarkYellow
if ($noProgressCount -ge $MaxNoProgress) {
Write-Host ""
Write-Host "===== CIRCUIT BREAKER: NO PROGRESS =====" -ForegroundColor Red
Write-Host "No git commits for $MaxNoProgress consecutive iterations. The loop is stalled." -ForegroundColor Red
Write-Host "Check progress.txt and logs/ for details on what went wrong." -ForegroundColor Red
if ($devServerPid) { taskkill /T /F /PID $devServerPid 2>$null | Out-Null }
exit 1
}
} else {
$noProgressCount = 0
}
# --- Circuit Breaker: Repeated Error ---
$errorLines = $outputString | Select-String -Pattern "(?i)(error|exception|failed|fatal)[:.].*" -AllMatches
if ($errorLines) {
$filteredErrors = $errorLines.Matches | Where-Object { $_.Value -notmatch "529|overloaded" } | Select-Object -First 3
$currentErrorSignature = ($filteredErrors | ForEach-Object { $_.Value }) -join "|"
if ($currentErrorSignature -and $currentErrorSignature -eq $lastErrorSignature) {
$sameErrorCount++
Write-Host " [Circuit Breaker] Same error pattern repeated ($sameErrorCount/$MaxSameError)" -ForegroundColor DarkYellow
if ($sameErrorCount -ge $MaxSameError) {
Write-Host ""
Write-Host "===== CIRCUIT BREAKER: REPEATED ERROR =====" -ForegroundColor Red
Write-Host "Same error pattern for $MaxSameError consecutive iterations:" -ForegroundColor Red
Write-Host " $currentErrorSignature" -ForegroundColor Red
Write-Host "Check progress.txt and logs/ for details." -ForegroundColor Red
if ($devServerPid) { taskkill /T /F /PID $devServerPid 2>$null | Out-Null }
exit 1
}
} elseif ($currentErrorSignature) {
$sameErrorCount = 0
}
$lastErrorSignature = $currentErrorSignature
} else {
$sameErrorCount = 0
$lastErrorSignature = ""
}
# --- Dynamic Model Selection ---
if ($outputString -match "<next-model>(opus|sonnet)</next-model>") {
$nextModel = $Matches[1]
if ($nextModel -ne $Model) {
Write-Host " [Model Switch] $Model -> $nextModel (agent recommendation)" -ForegroundColor Magenta
$Model = $nextModel
} else {
Write-Host " [Model] Staying on $Model" -ForegroundColor DarkGray
}
}
# --- Check for Completion ---
if ($outputString -match "<promise>COMPLETE</promise>") {
Write-Host ""
Write-Host "===== COMPLETE =====" -ForegroundColor Green
Write-Host "Visualization improvements finished after $i iteration(s) this run ($totalIteration total)." -ForegroundColor Green
if ($devServerPid) { taskkill /T /F /PID $devServerPid 2>$null | Out-Null }
exit 0
}
# Brief pause between iterations
Start-Sleep -Seconds 2
}
+773
View File
@@ -0,0 +1,773 @@
# Implementation Workflow: Adding Depth to the GP Clinical Record
> Generated: Feb 2026
> Source: `Ralph/depth-requirements.md` + `Ralph/depth-design.md`
> Prerequisite: Task 21 (cleanup) from current plan should be completed first
---
## Dependency Graph
```
Phase 1: Core Infrastructure
T1 ─── Types & CSS foundations
T2 ─── DetailPanelContext + DetailPanel component ──── depends on T1
T3 ─── useFocusTrap hook ─────────────────────────── depends on T1
T4 ─── SubNav + useActiveSection update ──────────── depends on T1
T5 ─── DashboardLayout restructure ──────────────── depends on T2, T3, T4
Phase 2: Data Expansion
T6 ─── Expand skills.ts (5 → ~20, categorised) ──── depends on T1
T7 ─── Add KPI stories to kpis.ts ────────────────── depends on T1
T8 ─── Create constellation.ts data ──────────────── depends on T6
T9 ─── Create educationExtras.ts ─────────────────── depends on T1
Phase 3: Tile Modifications (parallel where possible)
T10 ─── LatestResultsTile (bigger numbers, panel) ─── depends on T2, T7
T11 ─── CoreSkillsTile (full width, categorised) ──── depends on T2, T6
T12 ─── ProjectsTile (half width, card grid) ──────── depends on T2
T13 ─── LastConsultationTile (panel trigger) ──────── depends on T2
T14 ─── CareerActivityTile (panel triggers, hover) ── depends on T2
T15 ─── EducationTile (richer content, panel) ─────── depends on T2, T9
T16 ─── PatientSummaryTile (structured presentation)─ depends on T5
Phase 4: Detail Panel Renderers
T17 ─── KPIDetail renderer ────────────────────────── depends on T10
T18 ─── ConsultationDetail renderer ───────────────── depends on T13, T14
T19 ─── ProjectDetail renderer ────────────────────── depends on T12
T20 ─── SkillDetail + SkillsAllDetail renderers ───── depends on T11
T21 ─── EducationDetail renderer ──────────────────── depends on T15
Phase 5: Career Constellation (D3.js)
T22 ─── Install d3, scaffold CareerConstellation ──── depends on T8
T23 ─── D3 force graph rendering ──────────────────── depends on T22
T24 ─── Hover/click interactions → detail panel ───── depends on T23, T18, T20
T25 ─── Constellation accessibility ───────────────── depends on T23
Phase 6: Login Refresh
T26 ─── LoginScreen visual restyle ────────────────── independent
T27 ─── Username → a.recruiter + connection status ── depends on T26
T28 ─── Post-login loading state ──────────────────── depends on T27
T29 ─── TopBar session name update ────────────────── depends on T28
Phase 7: Polish & Integration
T30 ─── CommandPalette updates for new content ────── depends on T17-T21
T31 ─── Responsive testing (panels, sub-nav) ──────── depends on T5, T2
T32 ─── prefers-reduced-motion audit ──────────────── depends on all
T33 ─── Final visual review + cleanup ─────────────── depends on all
```
---
## Pre-Flight: Complete Task 21 (Cleanup)
Before starting depth work, the current plan's final task must be done:
- [ ] Remove unused old components (PatientBanner, ClinicalSidebar, Breadcrumb, MobileBottomNav, PMRInterface)
- [ ] Remove old view files (`src/components/views/*.tsx`)
- [ ] Remove old portfolio components (Contact, Education, Experience, FloatingNav, Footer, Hero, Projects, Skills)
- [ ] Remove unused hooks (useScrollCondensation if unused)
- [ ] Verify no dead imports
- [ ] `npm run build` clean
**Checkpoint:** Clean build with zero unused components.
---
## Phase 1: Core Infrastructure
### Task 1: Types & CSS Foundations
**Files:** `src/types/pmr.ts`, `src/index.css`
**Effort:** Small
Add all new TypeScript types and CSS custom properties needed by subsequent tasks.
**Types to add (`src/types/pmr.ts`):**
- `SkillCategory``'Technical' | 'Domain' | 'Leadership'`
- `KPIStory` — context, role, outcomes[], period
- Augment `KPI` with optional `story?: KPIStory`
- `ConstellationNode` — id, type, label, domain, org data
- `ConstellationLink` — source, target, strength
- `DetailPanelContent` — discriminated union (kpi | skill | skills-all | consultation | project | education | career-role)
- `EducationExtra` — documentId, extracurriculars, researchDescription, programmeDetail
- Add `category?: SkillCategory` field to `SkillMedication`
**CSS to add (`src/index.css`):**
```css
--subnav-height: 36px;
--panel-narrow: 400px;
--panel-wide: 60vw;
--backdrop-blur: 4px;
--backdrop-bg: rgba(26,43,42,0.15);
```
Plus panel animation keyframes (`panel-slide-in`, `panel-slide-out`, `backdrop-fade-in`) with `prefers-reduced-motion` overrides.
**Validation:** `npm run typecheck` passes.
---
### Task 2: DetailPanelContext + DetailPanel Component
**New files:** `src/contexts/DetailPanelContext.tsx`, `src/components/DetailPanel.tsx`
**Depends on:** T1
**Effort:** Medium
**DetailPanelContext (`src/contexts/DetailPanelContext.tsx`):**
- `DetailPanelContextValue`: `{ content, openPanel, closePanel, isOpen }`
- `DetailPanelProvider` wraps children, manages state
- Width mapping: deterministic from `content.type` (narrow for kpi/skill/education, wide for consultation/project/career-role)
- Title mapping: derived from content data
**DetailPanel (`src/components/DetailPanel.tsx`):**
- Full-screen backdrop (`backdrop-filter: blur(4px)`, click to close)
- Panel slides from right (`translateX(100%)``translateX(0)`, 250ms ease-out)
- Adaptive width: `var(--panel-narrow)` or `var(--panel-wide)` based on content type
- Header: close button (X, lucide `X` icon) + dot + section title
- Scrollable content area renders `{children}` (or delegates to content renderers)
- Close triggers: backdrop click, Escape key, X button
- `aria-modal="true"`, `role="dialog"`, `aria-labelledby`
- Mobile: both widths become 100vw
- `prefers-reduced-motion`: instant appear, no slide
**Integration:** Initially renders placeholder content ("Detail panel for {type}"). Real content renderers come in Phase 4.
**Validation:** Panel opens/closes correctly with keyboard and mouse. `npm run typecheck` + `npm run build`.
---
### Task 3: useFocusTrap Hook
**New file:** `src/hooks/useFocusTrap.ts`
**Depends on:** T1
**Effort:** Small
- `useFocusTrap(containerRef: RefObject<HTMLElement>, isActive: boolean): void`
- When active: Tab/Shift+Tab cycle within container, first focusable element receives focus
- When deactivated: focus returns to the element that was focused before trap activated
- Used by DetailPanel (and already used by CommandPalette — consider if CommandPalette can share this hook)
**Validation:** Tab cycling confirmed in DetailPanel. Focus returns correctly on close.
---
### Task 4: SubNav + useActiveSection Update
**New file:** `src/components/SubNav.tsx`
**Modified file:** `src/hooks/useActiveSection.ts`
**Depends on:** T1
**Effort:** Medium
**SubNav component:**
- Fixed/sticky below TopBar (`top: 48px`, `z-index: 99`)
- 5 sections: Overview | Skills | Experience | Projects | Education
- Click → smooth-scroll to `[data-tile-id="${tileId}"]`
- Active tab: teal underline (2px), text colour `var(--accent)`
- Inactive: `var(--text-secondary)`
- Height: 36px, background `var(--surface)`, bottom border
- Tabs: 13px, font-weight 500, gap 24px
- Teal underline slides with 200ms transition
**useActiveSection update:**
- Observe `data-tile-id` attributes on tile elements
- Map tile IDs to section IDs (patient-summary→overview, core-skills→skills, etc.)
- Use IntersectionObserver with appropriate thresholds
**Tile `data-tile-id` attributes:** Ensure each tile's Card has this attribute. May need to add `tileId` prop to Card if not already present.
**Validation:** Scroll triggers correct active tab. Click scrolls to correct section. `npm run build`.
---
### Task 5: DashboardLayout Restructure
**Modified file:** `src/components/DashboardLayout.tsx`
**Depends on:** T2, T3, T4
**Effort:** Medium
**Changes:**
1. Wrap with `DetailPanelProvider` (in App.tsx or DashboardLayout)
2. Add `SubNav` between TopBar and content
3. Reorder tiles:
- PatientSummaryTile (full width)
- LatestResultsTile (half) + ProjectsTile (half) — side by side
- CoreSkillsTile (full width) — was half, now full
- LastConsultationTile (full width)
- CareerActivityTile (full width)
- EducationTile (full width)
4. Render `DetailPanel` alongside CommandPalette
5. Adjust margin-top: `calc(var(--topbar-height) + var(--subnav-height))`
6. Add `data-tile-id` attributes to tile wrappers
**Validation:** Layout renders correctly with new tile order. SubNav visible. Detail panel renders. No visual regressions. `npm run build`.
**Checkpoint:** Core infrastructure complete. Detail panel opens (with placeholder content), sub-nav works, new tile order in place.
---
## Phase 2: Data Expansion
### Task 6: Expand Skills Data
**Modified file:** `src/data/skills.ts`
**Depends on:** T1
**Effort:** Medium
Expand from 5 → ~20 skills across 3 categories. Each skill retains the medication metaphor.
**Categories:**
- **Technical (8):** Data Analysis, Python, SQL, Power BI, JavaScript/TypeScript, Excel, Algorithm Design, Data Pipelines
- **Healthcare Domain (6):** Medicines Optimisation, Population Health, NICE TA Implementation, Health Economics, Clinical Pathways, Controlled Drugs
- **Strategic & Leadership (7):** Budget Management, Stakeholder Engagement, Pharmaceutical Negotiation, Team Development, Change Management, Financial Modelling, Executive Communication
Each skill: `id`, `name`, `genericName`, `frequency`, `startYear`, `yearsOfExperience`, `status`, `proficiency`, `category`
**Source:** CV_v4.md Core Competencies section.
**Validation:** Types check. Existing CoreSkillsTile still renders (it will show all skills or first 5 depending on current implementation).
---
### Task 7: Add KPI Stories
**Modified file:** `src/data/kpis.ts`
**Depends on:** T1
**Effort:** Small
Add `story` field to each of the 4 KPIs:
1. **£220M** — prescribing budget, forecasting models, ICB board accountability
2. **£14.6M** — efficiency programme, data analysis identification, over-target by Oct 2025
3. **9+ Years** — career span Aug 2016present, progression narrative
4. **1.2M** — population served, Norfolk & Waveney ICS scope
**Source:** CV_v4.md role descriptions.
**Validation:** Types check. Existing tile unaffected (story field is optional).
---
### Task 8: Create Constellation Data
**New file:** `src/data/constellation.ts`
**Depends on:** T6 (needs skill IDs)
**Effort:** Medium
Define role-skill mapping for the D3 graph:
- 6 role nodes (Paydens → Tesco Duty → Tesco Manager → NHS HCD → NHS Deputy → NHS Interim)
- Skill nodes (from expanded skills data)
- Links connecting skills to roles with strength values
- Colour assignments: role nodes get org colours, skill nodes get domain colours
**Validation:** Types check. Data importable.
---
### Task 9: Create Education Extras
**New file:** `src/data/educationExtras.ts`
**Depends on:** T1
**Effort:** Small
Expanded detail for education entries:
- MPharm: extracurriculars (Pharmacy Society President, Ultimate Frisbee VP, Alzheimer's Society), research project description
- Mary Seacole: programme detail (change management, healthcare leadership, system-level thinking)
- A-Levels: no extras needed
**Source:** CV_v4.md Education section.
**Validation:** Types check. Data importable.
**Checkpoint:** All data expanded and ready for consumption by tiles and detail renderers.
---
## Phase 3: Tile Modifications
Tasks in this phase can be done in parallel where dependencies allow.
### Task 10: LatestResultsTile — Remove Flip, Add Panel
**Modified file:** `src/components/tiles/LatestResultsTile.tsx`
**Modified file:** `src/index.css` (remove flip CSS if dedicated)
**Depends on:** T2, T7
**Effort:** Medium
**Changes:**
1. Remove CSS perspective flip animation entirely
2. Remove `.metric-card`, `.metric-card-inner`, `.metric-card-front`, `.metric-card-back` CSS classes
3. Replace with clickable KPI cards:
- Headline number at 28-32px, bold (700), coloured by variant
- Label at 12px, weight 500
- Sub-text at 10px, Geist Mono, tertiary
4. Click → `openPanel({ type: 'kpi', kpi })`
5. Hover: border colour shift + shadow deepens
6. Keyboard: Enter/Space triggers panel
**Validation:** KPIs display with bigger numbers. Click opens detail panel (placeholder). No flip remnants. `npm run build`.
---
### Task 11: CoreSkillsTile — Full Width, Categorised
**Modified file:** `src/components/tiles/CoreSkillsTile.tsx`
**Depends on:** T2, T6
**Effort:** Large
**Changes:**
1. Change from half-width to full-width (`full` prop on Card)
2. Display skills grouped by category (Technical, Healthcare Domain, Strategic & Leadership)
3. Category headers: thin divider line + label (styled like sidebar section dividers)
4. Show top 3-4 skills per category on the dashboard
5. "View all" button per category → `openPanel({ type: 'skills-all', category })`
6. Individual skill click → `openPanel({ type: 'skill', skill })`
7. Retain medication metaphor (frequency, status badge)
8. Remove single-expand accordion for skills (replaced by panel interaction)
**Validation:** Skills display in 3 categories. View all opens panel. Individual click opens panel. `npm run build`.
---
### Task 12: ProjectsTile — Half Width, Card Grid
**Modified file:** `src/components/tiles/ProjectsTile.tsx`
**Depends on:** T2
**Effort:** Medium
**Changes:**
1. Change from full-width to half-width (remove `full` prop)
2. Position alongside LatestResultsTile in the grid (handled by T5 layout reorder)
3. Compact card layout: status dot + name + year (right-aligned)
4. Tech stack as small inline tags
5. Click → `openPanel({ type: 'project', investigation })`
6. Remove in-place expansion (replaced by panel)
7. Hover: border shift, shadow deepens
**Validation:** Projects render in half-width alongside KPIs. Click opens panel. `npm run build`.
---
### Task 13: LastConsultationTile — Panel Trigger
**Modified file:** `src/components/tiles/LastConsultationTile.tsx`
**Depends on:** T2
**Effort:** Small
**Changes:**
1. Add "View full record" button/link at the bottom
2. Click → `openPanel({ type: 'consultation', consultation })`
3. Make the tile header area clickable too
4. Keep existing inline content (header info row, achievements preview)
**Validation:** Click opens panel. Existing content unchanged. `npm run build`.
---
### Task 14: CareerActivityTile — Panel Triggers, Hover
**Modified file:** `src/components/tiles/CareerActivityTile.tsx`
**Depends on:** T2
**Effort:** Medium
**Changes:**
1. Timeline items: click → `openPanel({ type: 'career-role', consultation })` (for role entries)
2. Remove in-place accordion expansion (replaced by panel)
3. Hover preview: items lift slightly on hover, show 1-2 lines of preview text
4. Keep colour-coded dots and entry type styling
5. Reserve space for CareerConstellation embed (Phase 5)
**Note:** Extended timeline back to school (2009) — add education entries (Highworth Grammar, UEA) to the timeline data if not already present.
**Validation:** Click opens panel for role items. Hover shows preview. No accordion. `npm run build`.
---
### Task 15: EducationTile — Richer Content, Panel
**Modified file:** `src/components/tiles/EducationTile.tsx`
**Depends on:** T2, T9
**Effort:** Small
**Changes:**
1. Show richer inline content: research project score (75.1%), OSCE score (80%), A-level grades
2. Each education entry clickable → `openPanel({ type: 'education', document })`
3. Hover: border shift
**Validation:** Richer content visible. Click opens panel. `npm run build`.
---
### Task 16: PatientSummaryTile — Structured Presentation
**Modified file:** `src/components/tiles/PatientSummaryTile.tsx`
**Depends on:** T5
**Effort:** Small
**Changes:**
1. Use full profile paragraph from CV_v4.md (verify `profile.ts` has complete text)
2. Pull out key highlights as a visual strip (years of experience, population served, budget)
3. Break up wall of text with hierarchy (bold key phrases, structured paragraphs)
**Validation:** Profile reads well, not a wall of text. Highlight strip visible. `npm run build`.
**Checkpoint:** All tiles modified. Dashboard shows new layout with panel triggers on all interactive elements. Detail panel opens with placeholder content for each type.
---
## Phase 4: Detail Panel Renderers
### Task 17: KPIDetail Renderer
**New file:** `src/components/detail/KPIDetail.tsx`
**Depends on:** T10
**Effort:** Medium
**Content:**
- Headline number (large, coloured by variant)
- Context paragraph (from `kpi.story.context`)
- "Your role" paragraph (from `kpi.story.role`)
- Outcome bullets (from `kpi.story.outcomes`)
- Period badge (from `kpi.story.period`)
**Wire into DetailPanel:** When `content.type === 'kpi'`, render `<KPIDetail kpi={content.kpi} />`.
**Validation:** Panel renders full KPI story. Content matches CV_v4.md. `npm run build`.
---
### Task 18: ConsultationDetail Renderer
**New file:** `src/components/detail/ConsultationDetail.tsx`
**Depends on:** T13, T14
**Effort:** Medium
**Content:**
- Role title + organisation + dates
- History paragraph (from `consultation.history`)
- Achievement bullets (from `consultation.examination`)
- Plan/outcomes (from `consultation.plan`)
- Coded entries badges (from `consultation.codedEntries`)
**Validation:** Panel renders full role detail. `npm run build`.
---
### Task 19: ProjectDetail Renderer
**New file:** `src/components/detail/ProjectDetail.tsx`
**Depends on:** T12
**Effort:** Medium
**Content:**
- Project name + year + status badge
- Methodology description
- Tech stack tags
- Results bullets
- External link button (if `investigation.link` exists)
**Validation:** Panel renders full project detail. External link works. `npm run build`.
---
### Task 20: SkillDetail + SkillsAllDetail Renderers
**New files:** `src/components/detail/SkillDetail.tsx`, `src/components/detail/SkillsAllDetail.tsx`
**Depends on:** T11
**Effort:** Medium
**SkillDetail:**
- Skill name + frequency + status badge
- Proficiency bar (visual)
- Years of experience
- "Used in" section: roles that used this skill (from constellation mapping, or hardcoded until T8 data available)
**SkillsAllDetail:**
- Full categorised list grouped by Technical / Domain / Leadership
- Each skill row clickable → switches panel to individual SkillDetail
- Category headers matching tile styling
**Validation:** Both renderers work. Skill click within SkillsAll switches to SkillDetail. `npm run build`.
---
### Task 21: EducationDetail Renderer
**New file:** `src/components/detail/EducationDetail.tsx`
**Depends on:** T15
**Effort:** Small
**Content:**
- Title + institution + dates + classification
- Research project description (if MPharm, from `educationExtras`)
- Extracurricular activities (from `educationExtras`)
- Programme detail (if Mary Seacole, from `educationExtras`)
- Notes from document data
**Validation:** Panel renders education detail with extras. `npm run build`.
**Checkpoint:** All detail panel content renderers complete. Every interactive element in the dashboard opens its corresponding rich detail view.
---
## Phase 5: Career Constellation (D3.js)
### Task 22: Install D3, Scaffold CareerConstellation
**Modified file:** `package.json` (add `d3`, `@types/d3`)
**New file:** `src/components/CareerConstellation.tsx` (scaffold)
**Depends on:** T8
**Effort:** Small
- `npm install d3 @types/d3`
- Create component with `useRef<SVGSVGElement>` for the SVG container
- Render an empty SVG with viewBox, correct container sizing
- Import constellation data
**Validation:** Component renders empty SVG. d3 imports resolve. `npm run build`.
---
### Task 23: D3 Force Graph Rendering
**Modified file:** `src/components/CareerConstellation.tsx`
**Depends on:** T22
**Effort:** Large
**Implement the force-directed graph:**
- `d3.forceSimulation` with charge, link, x (chronological), y (centred), collision forces
- Role nodes: 24px radius, org colour fill, white text
- Skill nodes: 10px radius, domain colour-coded (clinical=green, technical=teal, leadership=amber)
- Links: thin lines (1px), `var(--border)`, opacity 0.3
- Container: full width of CareerActivityTile, 400px desktop / 300px tablet / 250px mobile
- SVG with responsive viewBox
- Subtle radial gradient background
**D3 integration pattern:**
- D3 operates imperatively via `useEffect` on the SVG ref
- React handles wrapper, D3 handles graph
- No React state for node positions (performance)
**Validation:** Graph renders with nodes and links. Nodes positioned chronologically. `npm run build`.
---
### Task 24: Constellation Interactions → Detail Panel
**Modified file:** `src/components/CareerConstellation.tsx`
**Depends on:** T23, T18, T20
**Effort:** Medium
**Hover interactions:**
- Hover role → connected skill nodes scale up, links brighten to `var(--accent)`, non-connected nodes fade to 0.15 opacity
- Hover skill → all connected role nodes highlight, link paths illuminate
- Tooltip with node name on hover
**Click interactions:**
- Click role → `onRoleClick(id)` → opens ConsultationDetail panel
- Click skill → `onSkillClick(id)` → opens SkillDetail panel
**Validation:** Hover highlighting works correctly. Click opens correct detail panels.
---
### Task 25: Constellation Accessibility
**Modified file:** `src/components/CareerConstellation.tsx`
**Depends on:** T23
**Effort:** Medium
- `role="img"` on SVG with `aria-label`
- Screen-reader-only text description of graph structure
- Keyboard navigation: Tab through role nodes, Enter to open detail
- `prefers-reduced-motion`: disable force simulation animation, render static final layout
- Focus indicators on nodes when keyboard-navigating
**Validation:** Screen reader describes graph. Keyboard nav works. Reduced motion shows static layout. `npm run build`.
**Checkpoint:** Career Constellation complete and integrated into CareerActivityTile. Interactive, accessible, visually impressive.
---
## Phase 6: Login Refresh
### Task 26: LoginScreen Visual Restyle
**Modified file:** `src/components/LoginScreen.tsx`
**Depends on:** None (independent)
**Effort:** Medium
**Colour changes:**
- `#005EB8``#0D6E6E` (shield icon bg, active field border, cursor, button)
- `#004D9F``#0A8080` (button hover)
- `#004494``#085858` (button pressed)
- Background: `#1E293B` → keep or lighten to `#1A2B2A`
**Typography:**
- Ensure Elvaro Grotesque is used (not DM Sans or system defaults)
- Shadows should match three-tier system
**Validation:** Login looks cohesive with dashboard. Teal accents throughout. `npm run build`.
---
### Task 27: Username → a.recruiter + Connection Status
**Modified file:** `src/components/LoginScreen.tsx`
**Depends on:** T26
**Effort:** Medium
**Username change:**
- Typed username: `a.recruiter` (not `A.CHARLWOOD`)
- Password typing remains as dots
**Connection status indicator (below login button):**
- New state: `ConnectionState = 'connecting' | 'connected'`
- Initial: red dot + "Awaiting secure connection..."
- After ~2000ms: green dot + "Secure connection established"
- Dot: 6px circle, colour transitions with 300ms ease-out
- Text: 10px, Geist Mono, tertiary colour
- Login button disabled until BOTH `typingComplete` AND `connectionState === 'connected'`
**Validation:** Username types as `a.recruiter`. Connection dot transitions red→green. Button enables correctly.
---
### Task 28: Post-Login Loading State
**Modified file:** `src/components/LoginScreen.tsx`
**Depends on:** T27
**Effort:** Small
- On login click: `isLoading = true`
- Card content replaces with: spinner + "Loading clinical records..."
- Duration: ~600ms
- Then calls `onComplete()` → dashboard materialises
**Validation:** Brief loading state visible between login click and dashboard. Feels purposeful, not slow.
---
### Task 29: TopBar Session Name Update
**Modified file:** `src/components/TopBar.tsx`
**Depends on:** T28
**Effort:** Tiny
- Change session display: `Dr. A.CHARLWOOD``A.RECRUITER`
- Geist Mono font (should already be the case)
**Validation:** TopBar shows `A.RECRUITER`. `npm run build`.
**Checkpoint:** Login flow refreshed with teal aesthetic, recruiter narrative, connection status, and loading state.
---
## Phase 7: Polish & Integration
### Task 30: CommandPalette Updates
**Modified file:** `src/components/CommandPalette.tsx`, `src/lib/search.ts`
**Depends on:** T17-T21
**Effort:** Medium
- Update search index to include expanded skills (20 skills vs 5)
- Add "View [X] detail" actions that open the detail panel directly
- Ensure palette results link to panel opens, not just scroll-to-section
- Update grouping if new content types warrant it
**Validation:** Search finds all 20 skills. Selecting a result opens the detail panel. `npm run build`.
---
### Task 31: Responsive Testing
**Modified file:** Various
**Depends on:** T5, T2
**Effort:** Medium
- DetailPanel: both `narrow` and `wide` become 100vw on mobile (<768px)
- SubNav: test on tablet/mobile (may need horizontal scroll or hamburger)
- Constellation: test at 300px/250px heights on smaller screens
- Projects + KPIs: stack vertically on mobile (grid fallback)
- Touch targets: all interactive elements ≥48px
**Validation:** Test at 375px, 768px, 1024px, 1440px breakpoints. No overflow, no hidden content.
---
### Task 32: prefers-reduced-motion Audit
**Modified file:** Various
**Depends on:** All phases
**Effort:** Small
Verify every new animation respects `prefers-reduced-motion: reduce`:
- DetailPanel slide → instant appear
- Backdrop fade → instant
- SubNav underline transition → instant
- Constellation force simulation → static layout
- Connection status dot transition → instant
- Post-login spinner → static indicator
- Hover shadows/borders → can keep (non-motion)
**Validation:** Enable `prefers-reduced-motion` in browser. No animations visible except hover state changes.
---
### Task 33: Final Visual Review + Cleanup
**Depends on:** All phases
**Effort:** Medium
- Visual review against `References/GPSystemconcept.html` (where applicable)
- Content verification against `References/CV_v4.md`
- Dead import cleanup
- Unused CSS removal (old flip card styles)
- Console warning check
- `npm run typecheck` — zero errors
- `npm run lint` — pass (pre-existing warning OK)
- `npm run build` — clean
**Final checkpoint:** Complete depth enhancement. All features working, accessible, responsive, and polished.
---
## Summary
| Phase | Tasks | New Files | Modified Files | Effort |
|-------|-------|-----------|----------------|--------|
| 1. Core Infrastructure | T1-T5 | 3 | 3 | Medium-Large |
| 2. Data Expansion | T6-T9 | 2 | 2 | Medium |
| 3. Tile Modifications | T10-T16 | 0 | 7 | Large |
| 4. Detail Renderers | T17-T21 | 6 | 1 | Medium |
| 5. Career Constellation | T22-T25 | 1 | 1 | Large |
| 6. Login Refresh | T26-T29 | 0 | 2 | Medium |
| 7. Polish | T30-T33 | 0 | Several | Medium |
| **Total** | **33 tasks** | **12 new files** | **~16 modified** | |
### Parallelisation Opportunities
- **T2, T3, T4** can be built in parallel (all depend only on T1)
- **T6, T7, T9** can be built in parallel (all depend only on T1)
- **T10-T15** can be built in parallel (all depend on T2 + their data task)
- **T17-T21** can be built in parallel (each depends on its tile task)
- **T26-T29** (login refresh) is independent of Phases 2-5, can run in parallel
### Critical Path
T1 → T2 → T5 → T10 → T17 (shortest path to first visible depth feature)
T1 → T6 → T8 → T22 → T23 → T24 (path to constellation)
### New Dependency
```bash
npm install d3 @types/d3
```
---
## Next Step
Use `/sc:implement` or begin manual implementation following this workflow phase by phase.