feat: complete drug-aware indication matching and cleanup app_v2
- Remove app_v2.py (consolidated into pathways_app.py), fix __init__ import - Add DimSearchTerm.csv, drug_indication_clusters.csv, drug_snomed_mapping_enriched.csv as reference data for SNOMED-based indication matching - Add snomed_indication_mapping_query.sql (source for embedded cluster mapping) - Update DESIGN_SYSTEM.md, RALPH_PROMPT.md, ralph.ps1, uv.lock
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
"Bash(wc:*)",
|
||||
"WebFetch(domain:flet.dev)",
|
||||
"WebFetch(domain:github.com)",
|
||||
"WebFetch(domain:docs.flet.dev)"
|
||||
"WebFetch(domain:docs.flet.dev)",
|
||||
"Bash(python -c:*)",
|
||||
"Bash(Remove-Item -Path \"C:\\\\Users\\\\charlwoodand\\\\Ralph local\\\\Tasks\\\\UI Redesign\\\\logs\\\\*\" -Force)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+151
-146
@@ -1,189 +1,194 @@
|
||||
# Design System - HCD Analysis v2
|
||||
# Design System - HCD Analysis v2.1 (SaaS Redesign)
|
||||
|
||||
This document defines the visual design language for the UI redesign. All components should reference these tokens for consistency.
|
||||
This document defines the visual design language for the UI redesign. The goal is a **modern SaaS aesthetic** - think Stripe, Linear, Vercel - while staying thematically aligned with the blue color palette.
|
||||
|
||||
**Design Philosophy**:
|
||||
- The chart is the hero; everything else supports it
|
||||
- Minimal chrome, maximum data visibility
|
||||
- Clean, confident, spacious - not clinical or governmental
|
||||
- Every pixel of vertical space matters
|
||||
|
||||
## Color Palette
|
||||
|
||||
### Primary Blues (NHS-inspired, modernized)
|
||||
### Primary Blues (kept from original, used sparingly)
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| Heritage Blue | `#003087` | Deep headers, authoritative accents |
|
||||
| Primary Blue | `#0066CC` | Main actions, links, focus states |
|
||||
| Vibrant Blue | `#1E88E5` | Highlights, hover states, chart primary |
|
||||
| Sky Blue | `#4FC3F7` | Accents, progress bars, secondary elements |
|
||||
| Pale Blue | `#E3F2FD` | Subtle backgrounds, card tints |
|
||||
| Heritage Blue | `#003087` | Top bar background, strong accents |
|
||||
| Primary Blue | `#0066CC` | Interactive elements, links, focus |
|
||||
| Vibrant Blue | `#1E88E5` | Hover states, active elements |
|
||||
| Sky Blue | `#4FC3F7` | Subtle accents, progress indicators |
|
||||
| Pale Blue | `#E3F2FD` | Selected states, subtle backgrounds |
|
||||
|
||||
### Neutrals (warm-tinted for clinical warmth)
|
||||
### Neutrals (refined for modern feel)
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| Slate 900 | `#1E293B` | Primary text |
|
||||
| Slate 900 | `#0F172A` | Primary text (slightly darker) |
|
||||
| Slate 700 | `#334155` | Secondary text |
|
||||
| Slate 500 | `#64748B` | Muted text, placeholders |
|
||||
| Slate 300 | `#CBD5E1` | Borders, dividers |
|
||||
| Slate 100 | `#F1F5F9` | Card backgrounds, hover states |
|
||||
| White | `#FFFFFF` | Page background |
|
||||
| Slate 100 | `#F8FAFC` | Backgrounds (slightly lighter) |
|
||||
| White | `#FFFFFF` | Card/modal backgrounds |
|
||||
|
||||
### Semantic Colors
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| Success | `#059669` | Positive states, confirmations |
|
||||
| Warning | `#D97706` | Caution states, alerts |
|
||||
| Error | `#DC2626` | Error states, destructive actions |
|
||||
| Info | `#0284C7` | Informational (matches primary family) |
|
||||
|
||||
### Chart Palette
|
||||
```
|
||||
Primary series: #003087, #0066CC, #1E88E5, #4FC3F7, #90CAF9
|
||||
Categorical: #0066CC, #059669, #D97706, #8B5CF6, #EC4899
|
||||
```
|
||||
| Success | `#10B981` | Positive (modern green) |
|
||||
| Warning | `#F59E0B` | Caution |
|
||||
| Error | `#EF4444` | Errors |
|
||||
| Info | `#3B82F6` | Informational |
|
||||
|
||||
## Typography
|
||||
|
||||
**Font Family:** Inter (primary), system-ui (fallback)
|
||||
|
||||
| Style | Size | Weight | Tracking | Line Height | Usage |
|
||||
|-------|------|--------|----------|-------------|-------|
|
||||
| Display | 32px | 700 | -0.02em | 1.2 | Page titles |
|
||||
| Heading 1 | 24px | 600 | -0.01em | 1.3 | Section headers |
|
||||
| Heading 2 | 20px | 600 | normal | 1.4 | Card titles |
|
||||
| Heading 3 | 16px | 600 | normal | 1.4 | Subsections |
|
||||
| Body | 14px | 400 | normal | 1.5 | Default text |
|
||||
| Body Small | 13px | 400 | normal | 1.5 | Secondary info |
|
||||
| Caption | 12px | 500 | normal | 1.4 | Labels, metadata |
|
||||
| Mono | 13px | 400 | normal | 1.5 | Data values, codes (JetBrains Mono) |
|
||||
| Style | Size | Weight | Usage |
|
||||
|-------|------|--------|-------|
|
||||
| Display | 28px | 600 | Page titles (reduced from 32px) |
|
||||
| Heading 1 | 18px | 600 | Section headers (reduced from 24px) |
|
||||
| Heading 2 | 16px | 600 | Card titles (reduced from 20px) |
|
||||
| Heading 3 | 14px | 600 | Subsections |
|
||||
| Body | 14px | 400 | Default text |
|
||||
| Body Small | 13px | 400 | Secondary info |
|
||||
| Caption | 11px | 500 | Labels, metadata (reduced from 12px) |
|
||||
| Mono | 13px | 500 | Data values (JetBrains Mono) |
|
||||
|
||||
## Spacing Scale
|
||||
## Spacing Scale (Tighter)
|
||||
|
||||
| Token | Value | Usage |
|
||||
|-------|-------|-------|
|
||||
| xs | 4px | Tight internal padding |
|
||||
| sm | 8px | Between related elements |
|
||||
| md | 12px | Standard gaps |
|
||||
| lg | 16px | Section padding |
|
||||
| xl | 24px | Card padding |
|
||||
| 2xl | 32px | Major section gaps |
|
||||
| 3xl | 48px | Page margins |
|
||||
| xs | 4px | Tight gaps |
|
||||
| sm | 6px | Between related elements (was 8px) |
|
||||
| md | 8px | Standard gaps (was 12px) |
|
||||
| lg | 12px | Section padding (was 16px) |
|
||||
| xl | 16px | Card padding (was 24px) |
|
||||
| 2xl | 24px | Major gaps (was 32px) |
|
||||
| 3xl | 32px | Page margins (was 48px) |
|
||||
|
||||
## Border Radius
|
||||
## Layout Specifications
|
||||
|
||||
| Token | Value | Usage |
|
||||
|-------|-------|-------|
|
||||
| sm | 4px | Small elements, inputs |
|
||||
| md | 8px | Buttons, small cards |
|
||||
| lg | 12px | Cards, modals |
|
||||
| xl | 16px | Large containers |
|
||||
| full | 9999px | Pills, avatars |
|
||||
### Page Structure (Target)
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ Logo │ Tabs │ Freshness │ 48px
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ [Initiated▾] [LastSeen▾] │ [Drugs▾] [Ind▾] [Dir▾] │ KPI badges │ 48px
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ I C I C L E C H A R T │ flex
|
||||
│ (full viewport width) │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Top Bar
|
||||
- **Height**: 48px (reduced from 64px)
|
||||
- **Background**: Heritage Blue
|
||||
- **Logo**: 28px height (reduced from 36px)
|
||||
- **Tabs**: Small pills, 28px height
|
||||
|
||||
### Filter Strip
|
||||
- **Height**: 48px (single row)
|
||||
- **Layout**: Horizontal flex, all filters inline
|
||||
- **Dropdown triggers**: 32px height, 8px padding
|
||||
- **No section header** - labels are in dropdown triggers
|
||||
- **Background**: Slate 100 or transparent
|
||||
|
||||
### KPI Section (Options)
|
||||
|
||||
**Option A: Inline badges** (preferred - zero extra height)
|
||||
```
|
||||
Filters row: [Initiated▾] [LastSeen▾] | [Drugs▾] ... | 12,345 patients • £45.2M • 89 drugs
|
||||
```
|
||||
|
||||
**Option B: Compact strip** (48px max)
|
||||
```
|
||||
┌─────┬─────┬─────┬─────┐
|
||||
│12.3K│£45M │ 89 │ 7 │ 28px value
|
||||
│pts │cost │drugs│trust│ 14px label
|
||||
└─────┴─────┴─────┴─────┘
|
||||
```
|
||||
|
||||
### Chart Container
|
||||
- **Width**: Full viewport minus 32px (16px padding each side)
|
||||
- **Height**: Fill remaining space (min 500px)
|
||||
- **No max-width constraint**
|
||||
- **Margins**: Minimal (t:40, l:8, r:8, b:24)
|
||||
|
||||
## Component Specifications
|
||||
|
||||
### Compact Dropdown Trigger
|
||||
- Height: 32px
|
||||
- Padding: 8px 12px
|
||||
- Border: 1px Slate 300
|
||||
- Border radius: 6px
|
||||
- Font: 13px
|
||||
- Chevron: 14px icon
|
||||
|
||||
### Compact KPI Badge
|
||||
- Padding: 4px 12px
|
||||
- Border radius: 16px (pill)
|
||||
- Background: Slate 100
|
||||
- Value: 14px mono, weight 600
|
||||
- Label: 11px, Slate 500
|
||||
|
||||
### Searchable Dropdown Panel
|
||||
- Max height: 200px (items area)
|
||||
- Item padding: 6px 8px
|
||||
- Search input height: 28px
|
||||
- Width: 240px min
|
||||
|
||||
## Shadows
|
||||
|
||||
| Token | Value | Usage |
|
||||
|-------|-------|-------|
|
||||
| sm | `0 1px 2px rgba(0,0,0,0.05)` | Subtle elevation |
|
||||
| md | `0 1px 3px rgba(0,0,0,0.08)` | Cards at rest |
|
||||
| lg | `0 4px 6px rgba(0,0,0,0.1)` | Cards on hover, dropdowns |
|
||||
| xl | `0 10px 15px rgba(0,0,0,0.1)` | Modals, popovers |
|
||||
| sm | `0 1px 2px rgba(0,0,0,0.04)` | Subtle (lighter) |
|
||||
| md | `0 1px 3px rgba(0,0,0,0.06)` | Cards at rest |
|
||||
| lg | `0 4px 8px rgba(0,0,0,0.08)` | Dropdowns, hover |
|
||||
|
||||
## Component Specifications
|
||||
## Border Radius
|
||||
|
||||
### Cards
|
||||
- Background: White
|
||||
- Border: 1px Slate 300 (optional, or use shadow only)
|
||||
- Border radius: lg (12px)
|
||||
- Padding: xl (24px)
|
||||
- Shadow: md at rest, lg on hover
|
||||
- Hover: translateY(-2px) transition
|
||||
|
||||
### Buttons
|
||||
**Primary:**
|
||||
- Background: Primary Blue
|
||||
- Text: White
|
||||
- Border radius: md (8px)
|
||||
- Padding: 10px 20px
|
||||
- Hover: Vibrant Blue background, slight scale (1.02)
|
||||
|
||||
**Secondary:**
|
||||
- Background: White
|
||||
- Border: 1px Primary Blue
|
||||
- Text: Primary Blue
|
||||
- Hover: Pale Blue background
|
||||
|
||||
**Ghost:**
|
||||
- Background: transparent
|
||||
- Text: Primary Blue
|
||||
- Hover: Pale Blue background
|
||||
|
||||
### Form Controls
|
||||
- Height: 40px (inputs, selects)
|
||||
- Border: 1px Slate 300
|
||||
- Border radius: md (8px)
|
||||
- Focus: 2px Primary Blue ring
|
||||
- Placeholder: Slate 500
|
||||
|
||||
### Data Cards (KPIs)
|
||||
- Large mono number: 32-48px, Slate 900
|
||||
- Label: Caption size, Slate 500
|
||||
- Background: White or Pale Blue tint
|
||||
- Optional trend indicator or sparkline
|
||||
|
||||
## Layout
|
||||
|
||||
### Page Structure
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ Logo + App Name [Chart Tabs] Data Freshness │ ← Top Bar (64px height)
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─ Filters ─────────────────────────────────────────────────┐ │ ← Filter Section
|
||||
│ │ Date ranges, dropdowns, filter controls │ │
|
||||
│ └───────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌─ KPIs ────────────────────────────────────────────────────┐ │ ← KPI Row
|
||||
│ │ [ Metric 1 ] [ Metric 2 ] [ Metric 3 ] [ Metric 4 ] │ │
|
||||
│ └───────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌─ Chart ───────────────────────────────────────────────────┐ │ ← Main Chart (fills remaining)
|
||||
│ │ │ │
|
||||
│ │ [ Interactive Visualization ] │ │
|
||||
│ │ │ │
|
||||
│ └───────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Responsive Breakpoints
|
||||
- Mobile: < 640px
|
||||
- Tablet: 640px - 1024px
|
||||
- Desktop: > 1024px
|
||||
| Token | Value | Usage |
|
||||
|-------|-------|-------|
|
||||
| sm | 4px | Small elements |
|
||||
| md | 6px | Inputs, buttons |
|
||||
| lg | 8px | Cards |
|
||||
| full | 9999px | Pills, badges |
|
||||
|
||||
## Transitions
|
||||
|
||||
| Property | Duration | Easing |
|
||||
|----------|----------|--------|
|
||||
| Color, background | 150ms | ease-out |
|
||||
| Transform | 200ms | ease-out |
|
||||
| Shadow | 200ms | ease-out |
|
||||
| Opacity | 200ms | ease-in-out |
|
||||
All transitions: 150ms ease-out (faster than before)
|
||||
|
||||
## Reflex Implementation Notes
|
||||
## Implementation Notes
|
||||
|
||||
### Using Design Tokens
|
||||
Create a `styles.py` module with these values as Python constants. Import throughout the app:
|
||||
### Key Changes from v2.0
|
||||
1. **Vertical space reduction**: ~210px saved (364px → ~156px overhead)
|
||||
2. **Full-width chart**: Remove PAGE_MAX_WIDTH for chart
|
||||
3. **Inline KPIs**: Either badges in filter row or minimal strip
|
||||
4. **Smaller fonts**: Headlines and captions reduced
|
||||
5. **Tighter spacing**: All spacing tokens reduced by ~25%
|
||||
|
||||
```python
|
||||
# Example structure
|
||||
class Colors:
|
||||
PRIMARY = "#0066CC"
|
||||
PRIMARY_DARK = "#003087"
|
||||
# etc.
|
||||
### CSS Patterns
|
||||
```css
|
||||
/* Full-height chart container */
|
||||
.chart-container {
|
||||
height: calc(100vh - 96px); /* viewport minus top bar + filter strip */
|
||||
min-height: 500px;
|
||||
width: calc(100vw - 32px);
|
||||
margin: 0 16px;
|
||||
}
|
||||
|
||||
class Spacing:
|
||||
XS = "4px"
|
||||
SM = "8px"
|
||||
# etc.
|
||||
/* Filter strip */
|
||||
.filter-strip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
gap: 12px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
```
|
||||
|
||||
### rx.theme Configuration
|
||||
Configure Reflex's theme provider with the color palette for consistent component styling.
|
||||
|
||||
### Custom CSS
|
||||
For styles not achievable via Reflex props, use `rx.style` or a custom CSS file.
|
||||
### Reflex Implementation
|
||||
- Use `height="calc(100vh - 96px)"` for chart container
|
||||
- Use `width="100%"` with `padding_x="16px"` for full-width
|
||||
- Use `flex="1"` to let chart grow
|
||||
- Keep `min_height="500px"` as fallback
|
||||
|
||||
+115
-44
@@ -1,6 +1,8 @@
|
||||
# Ralph Wiggum Loop - Reflex UI Redesign
|
||||
# Ralph Wiggum Loop - Drug-Aware Indication Matching
|
||||
|
||||
You are operating inside an automated loop building a Reflex frontend application. Each iteration you receive fresh context — you have NO memory of previous iterations. Your only memory is the filesystem.
|
||||
You are operating inside an automated loop extending a pathway analysis application with drug-aware indication matching. Each iteration you receive fresh context — you have NO memory of previous iterations. Your only memory is the filesystem.
|
||||
|
||||
**Current Focus**: Update indication charts so that patient indications are matched **per drug**, not just per patient. Each drug must be validated against the patient's GP diagnoses AND the drug-to-indication mapping from DimSearchTerm.csv.
|
||||
|
||||
## First Actions Every Iteration
|
||||
|
||||
@@ -9,7 +11,7 @@ Read these files in this order before doing anything else:
|
||||
1. `progress.txt` — What previous iterations accomplished, what's blocked, and what to do next. The most recent entry is most important.
|
||||
2. `IMPLEMENTATION_PLAN.md` — Task list with status markers, project overview, and completion criteria.
|
||||
3. `guardrails.md` — Known failure patterns to avoid. You MUST read and follow these.
|
||||
4. `DESIGN_SYSTEM.md` — Color palette, typography, spacing, and component specifications.
|
||||
4. `CLAUDE.md` — Project architecture and code patterns.
|
||||
|
||||
Then run `git log --oneline -5` to see recent commits.
|
||||
|
||||
@@ -18,48 +20,109 @@ Then run `git log --oneline -5` to see recent commits.
|
||||
Narrate your work as you go. Your output is the only visibility the operator has into what's happening. For every significant action, explain what you're doing and why:
|
||||
|
||||
- **Reading files**: "Reading progress.txt to check what the last iteration accomplished..."
|
||||
- **Creating components**: "Creating the top_bar() component with logo, title, and chart tabs..."
|
||||
- **Debugging**: "Reflex compilation failed with TypeError. Checking the error — looks like rx.foreach issue..."
|
||||
- **Testing**: "Running reflex compile to verify the component renders..."
|
||||
- **Making decisions**: "The design system specifies Primary Blue #0066CC for buttons. Using that."
|
||||
- **Committing**: "Committing styles.py — design token module complete."
|
||||
- **Creating code**: "Adding assign_drug_indications() function to diagnosis_lookup.py..."
|
||||
- **Debugging**: "Drug matching returned 0 results for ADALIMUMAB. Checking DimSearchTerm lookup..."
|
||||
- **Testing**: "Running import check to verify the new function is accessible..."
|
||||
- **Making decisions**: "The guardrails say to use substring matching for drug fragments."
|
||||
- **Committing**: "Committing drug-indication matching logic."
|
||||
|
||||
Do NOT just output a summary at the end. Narrate throughout. Think of this as a live log of your reasoning.
|
||||
|
||||
## Task Selection
|
||||
|
||||
Pick the highest-priority task that is READY to work on:
|
||||
You have flexibility to choose which task to work on. Use your judgement, but document your reasoning.
|
||||
|
||||
1. Read ALL tasks in IMPLEMENTATION_PLAN.md — understand the full picture
|
||||
2. Skip any marked `[x]` (complete) or `[B]` (blocked)
|
||||
3. Check progress.txt for guidance — if the previous iteration recommended a specific next task, prefer that unless it's blocked
|
||||
4. If no guidance exists, pick the first `[ ]` (ready) task in the first incomplete phase
|
||||
5. Mark your chosen task `[~]` (in progress) in IMPLEMENTATION_PLAN.md
|
||||
3. Check progress.txt for guidance — the previous iteration may have recommendations
|
||||
4. **Choose a task** based on:
|
||||
- Dependencies (some tasks require others to be done first)
|
||||
- Logical flow (query changes before matching logic, matching before pipeline integration)
|
||||
- Your assessment of what would be most valuable to tackle next
|
||||
- Previous iteration's recommendations (consider but don't blindly follow)
|
||||
5. **Document your reasoning**: Before starting work, briefly explain WHY you chose this task over others
|
||||
6. Mark your chosen task `[~]` (in progress) in IMPLEMENTATION_PLAN.md
|
||||
|
||||
If your chosen task turns out to be blocked during work:
|
||||
- Mark it `[B]` with a reason in IMPLEMENTATION_PLAN.md
|
||||
- Document the blocker in progress.txt
|
||||
- Move to the next ready task within this same iteration
|
||||
- Move to a different ready task within this same iteration
|
||||
|
||||
## Development
|
||||
|
||||
Work on ONE task per iteration. Build incrementally and verify as you go.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
**Drug-Indication Matching Flow:**
|
||||
1. Get patient's GP-matched Search_Terms from Snowflake (ALL matches, not just most recent, with code_frequency)
|
||||
- Only count GP codes from MIN(Intervention Date) onwards (the HCD data window)
|
||||
2. Load DimSearchTerm.csv to get which drugs belong to which Search_Terms
|
||||
3. For each patient-drug pair: intersection of (Search_Terms listing this drug) AND (patient's GP matches)
|
||||
- If multiple matches: pick highest code_frequency (most GP coding = most likely indication)
|
||||
4. Modify UPID to include matched indication: `{UPID}|{search_term}`
|
||||
5. Drugs sharing the same indication for the same patient → same modified UPID → same pathway
|
||||
6. Drugs under different indications → different modified UPIDs → separate pathways
|
||||
|
||||
**DimSearchTerm.csv:**
|
||||
- `Search_Term`: Clinical condition (e.g., "rheumatoid arthritis")
|
||||
- `CleanedDrugName`: Pipe-separated drug fragments (e.g., "ADALIMUMAB|GOLIMUMAB|...")
|
||||
- `PrimaryDirectorate`: The directorate for this condition
|
||||
- Drug matching: check if any fragment is a substring of the HCD drug name (case-insensitive)
|
||||
|
||||
**Modified UPID Format:**
|
||||
- Original: `RMV12345` (Provider Code[:3] + PersonKey)
|
||||
- Modified: `RMV12345|rheumatoid arthritis`
|
||||
- Fallback: `RMV12345|RHEUMATOLOGY (no GP dx)`
|
||||
- The existing pathway analyzer treats UPID as an opaque identifier — this works transparently
|
||||
|
||||
### Code Patterns
|
||||
|
||||
- **Use design tokens**: Import from `pathways_app/styles.py` — never hardcode colors/spacing
|
||||
- **Reflex Vars in rx.foreach**: Use `.to(int)` for comparisons, `.to_string()` for text interpolation
|
||||
- **Component functions**: Each component should be a function returning `rx.Component`
|
||||
- **State class**: All reactive state goes in the `AppState` class
|
||||
- **Computed properties**: Use `@rx.var` decorator for derived values
|
||||
- **Snowflake queries**: Use parameterized queries, embed the cluster CTE from CLUSTER_MAPPING_SQL
|
||||
- **GP record matching**: Return ALL matches per patient (not just most recent)
|
||||
- **Drug mapping**: Load from `data/DimSearchTerm.csv`, match drug name fragments
|
||||
- **Pathway pipeline**: Use existing functions — modified UPIDs flow through naturally
|
||||
- **Reflex state**: No changes expected — indication charts already work, just with better matching
|
||||
|
||||
### Key Data Structures
|
||||
|
||||
**GP Matches (from Snowflake) — updated to return ALL matches with frequency:**
|
||||
```python
|
||||
# Multiple rows per patient (one per matched Search_Term)
|
||||
# code_frequency = COUNT of matching SNOMED codes (used as tiebreaker)
|
||||
# Only counts codes from MIN(Intervention Date) onwards
|
||||
DataFrame with: PatientPseudonym, Search_Term, code_frequency
|
||||
```
|
||||
|
||||
**Drug-to-Indication Mapping (from DimSearchTerm.csv):**
|
||||
```python
|
||||
# search_term → list of drug fragments
|
||||
{"rheumatoid arthritis": ["ABATACEPT", "ADALIMUMAB", "ANAKINRA", ...]}
|
||||
```
|
||||
|
||||
**Modified HCD Data:**
|
||||
```python
|
||||
# Original UPID replaced with indication-aware UPID
|
||||
df["UPID"] = "RMV12345|rheumatoid arthritis" # for matched drugs
|
||||
df["UPID"] = "RMV12345|RHEUMATOLOGY (no GP dx)" # for unmatched drugs
|
||||
```
|
||||
|
||||
**Indication DataFrame:**
|
||||
```python
|
||||
# Maps modified UPID → Search_Term (for pathway hierarchy level 2)
|
||||
indication_df = pd.DataFrame({
|
||||
'Directory': ['rheumatoid arthritis', 'asthma', 'CARDIOLOGY (no GP dx)']
|
||||
}, index=['RMV12345|rheumatoid arthritis', 'RMV12345|asthma', 'RMV67890|CARDIOLOGY (no GP dx)'])
|
||||
```
|
||||
|
||||
### Verification Steps
|
||||
|
||||
After writing code, ALWAYS verify:
|
||||
|
||||
1. **Syntax check**: `python -m py_compile pathways_app/app_v2.py`
|
||||
2. **Import check**: `python -c "from pathways_app.app_v2 import app"`
|
||||
3. **Reflex compile**: Run `reflex run` briefly to check for compilation errors
|
||||
1. **Syntax check**: `python -m py_compile <file.py>`
|
||||
2. **Import check**: `python -c "from module import function"`
|
||||
3. **For database changes**: Test with query against pathways.db
|
||||
4. **For Reflex changes**: `python -m reflex compile`
|
||||
|
||||
If any step fails, fix the issue before proceeding.
|
||||
|
||||
@@ -69,18 +132,19 @@ Every task MUST pass validation before being marked complete:
|
||||
|
||||
### Tier 1: Code Validation (MANDATORY)
|
||||
- Code compiles without Python syntax errors
|
||||
- Reflex compiles the app without errors
|
||||
- Imports work without errors
|
||||
- No TypeErrors, ImportErrors, or AttributeErrors
|
||||
|
||||
### Tier 2: Visual Validation (MANDATORY for UI tasks)
|
||||
- Component renders in the browser
|
||||
- Styling matches DESIGN_SYSTEM.md specifications
|
||||
- Responsive behavior works (if applicable)
|
||||
### Tier 2: Data Validation (for data/pipeline tasks)
|
||||
- Queries return expected row counts
|
||||
- Data structures have correct columns/types
|
||||
- Drug-indication matching produces valid results
|
||||
- Modified UPIDs have correct format
|
||||
|
||||
### Tier 3: Functional Validation (MANDATORY for state/logic tasks)
|
||||
- State changes trigger expected UI updates
|
||||
- Computed properties return correct values
|
||||
- Filters produce expected data transformations
|
||||
### Tier 3: Functional Validation (for UI/integration tasks)
|
||||
- Reflex compiles the app without errors
|
||||
- State changes trigger expected behavior
|
||||
- Both chart types render correctly
|
||||
|
||||
### Validation Failure
|
||||
|
||||
@@ -97,8 +161,7 @@ Before marking ANY task `[x]`, ALL of these must be true:
|
||||
1. Code is saved to the appropriate file(s)
|
||||
2. Tier 1 code validation passed
|
||||
3. Tier 2/3 validation passed (as applicable)
|
||||
4. Design tokens used — no hardcoded colors, fonts, or spacing
|
||||
5. All changes committed to git with a descriptive message
|
||||
4. All changes committed to git with a descriptive message
|
||||
|
||||
These are non-negotiable. A task that "feels done" but hasn't passed all gates is NOT done.
|
||||
|
||||
@@ -109,18 +172,21 @@ After completing your work (whether the task succeeded, failed, or was blocked),
|
||||
```
|
||||
## Iteration [N] — [YYYY-MM-DD]
|
||||
### Task: [which task you worked on]
|
||||
### Why this task:
|
||||
- [Brief explanation of why you chose this task over others]
|
||||
- [What dependencies or logical flow led to this choice]
|
||||
### Status: COMPLETE | BLOCKED | IN PROGRESS
|
||||
### What was done:
|
||||
- [Specific actions taken]
|
||||
### Validation results:
|
||||
- Tier 1 (Code): [syntax check, import check, reflex compile]
|
||||
- Tier 2 (Visual): [what was checked visually, or N/A]
|
||||
- Tier 3 (Functional): [what logic was tested, or N/A]
|
||||
- Tier 1 (Code): [syntax check, import check]
|
||||
- Tier 2 (Data): [query results, row counts]
|
||||
- Tier 3 (Functional): [reflex compile, UI check]
|
||||
### Files changed:
|
||||
- [list of files created/modified]
|
||||
### Committed: [git hash] "[commit message]"
|
||||
### Patterns discovered:
|
||||
- [Any reusable learnings — Reflex quirks, component patterns]
|
||||
- [Any reusable learnings — query patterns, matching logic quirks]
|
||||
### Next iteration should:
|
||||
- [Explicit guidance for what the next fresh instance should do first]
|
||||
- [Note any context that would be lost without writing it here]
|
||||
@@ -132,8 +198,8 @@ If you discover a failure pattern that future iterations should avoid, add it to
|
||||
|
||||
## Commit Changes
|
||||
|
||||
1. Stage changed files (styles.py, app_v2.py, etc.)
|
||||
2. Use a descriptive commit message referencing the task (e.g., "feat: create design tokens module")
|
||||
1. Stage changed files
|
||||
2. Use a descriptive commit message referencing the task (e.g., "feat: add drug-indication matching function (Task 2.1)")
|
||||
3. Commit after your task is validated and complete — one commit per logical unit of work
|
||||
4. If you updated progress.txt with a blocked status, commit that too
|
||||
|
||||
@@ -141,7 +207,7 @@ If you discover a failure pattern that future iterations should avoid, add it to
|
||||
|
||||
If ALL tasks in IMPLEMENTATION_PLAN.md are marked `[x]`:
|
||||
|
||||
1. Run `reflex run` and verify the app works end-to-end
|
||||
1. Run `reflex compile` to verify app compiles
|
||||
2. Verify all completion criteria at the bottom of IMPLEMENTATION_PLAN.md are satisfied
|
||||
3. Only then output the completion signal on its own line:
|
||||
|
||||
@@ -156,10 +222,15 @@ DO NOT paraphrase, vary, or conditionally output this string.
|
||||
## Rules
|
||||
|
||||
- Complete ONE task per iteration, then update progress and stop
|
||||
- ALWAYS read progress.txt, guardrails.md, and DESIGN_SYSTEM.md before starting work
|
||||
- **Use design tokens** — never hardcode hex colors, pixel values, or font names
|
||||
- **Reflex Var safety** — use `.to()` methods when working with Vars from rx.foreach or computed properties
|
||||
- ALWAYS read progress.txt, guardrails.md before starting work
|
||||
- **Match drugs to indications** — not just patients to indications
|
||||
- **Use DimSearchTerm.csv** for drug-to-Search_Term mapping
|
||||
- **Return ALL GP matches** — not just most recent (remove QUALIFY ROW_NUMBER = 1)
|
||||
- **Modified UPID format**: `{UPID}|{search_term}` — pipe delimiter is safe
|
||||
- **Use PseudoNHSNoLinked** — NOT PersonKey for GP record matching
|
||||
- **Substring matching** for drug fragments from DimSearchTerm.csv
|
||||
- Keep commits atomic and well-described
|
||||
- If stuck on the same issue for more than 2 attempts within one iteration, document it in progress.txt and move to the next ready task
|
||||
- When in doubt, check the existing `pathways_app.py` for patterns that work
|
||||
- The goal is a working, beautiful app — correctness and visual quality matter equally
|
||||
- When in doubt, check existing code for patterns that work
|
||||
- **Pipeline before UI** — processing logic before Reflex changes
|
||||
- **Don't change directory charts** — only indication chart matching changes
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
Search_Term,CleanedDrugName,PrimaryDirectorate
|
||||
acute coronary syndrome,ABCIXIMAB|CLOPIDOGREL|PRASUGREL|RIVAROXABAN|TICAGRELOR,CARDIOLOGY
|
||||
acute lymphoblastic leukaemia,BLINATUMOMAB|DASATINIB|INOTUZUMAB|PEGASPARGASE|PONATINIB|TISAGENLECLEUCEL,CLINICAL HAEMATOLOGY
|
||||
acute myeloid leukaemia,AZACITIDINE|DECITABINE|GEMTUZUMAB|GILTERITINIB|GLASDEGIB|LIPOSOMAL|MIDOSTAURIN|ORAL|VENETOCLAX,CLINICAL HAEMATOLOGY
|
||||
acute promyelocytic leukaemia,ARSENIC|GEMTUZUMAB,CLINICAL HAEMATOLOGY
|
||||
allergic asthma,OMALIZUMAB,THORACIC MEDICINE
|
||||
allergic rhinitis,SQ,ENT
|
||||
alzheimer's disease,DONEPEZIL,NEUROLOGY
|
||||
amyloidosis,VUTRISIRAN,CLINICAL HAEMATOLOGY
|
||||
anaemia,ERYTHROPOIESIS-STIMULATING|ERYTHROPOIETIN,CLINICAL HAEMATOLOGY
|
||||
anaplastic large cell lymphoma,BRENTUXIMAB,CLINICAL HAEMATOLOGY
|
||||
ankylosing spondylitis,ADALIMUMAB|GOLIMUMAB|SECUKINUMAB|UPADACITINIB,RHEUMATOLOGY
|
||||
apixaban,ANDEXANET,CARDIOLOGY
|
||||
aplastic anaemia,ELTROMBOPAG,CLINICAL HAEMATOLOGY
|
||||
arthritis,ETANERCEPT,RHEUMATOLOGY
|
||||
asthma,BENRALIZUMAB|DUPILUMAB|INHALED|MEPOLIZUMAB|OMALIZUMAB|RESLIZUMAB,THORACIC MEDICINE
|
||||
atopic dermatitis,ABROCITINIB|ALCLOMETASONE|BARICITINIB|CRISABOROLE|DUPILUMAB|PIMECROLIMUS,DERMATOLOGY
|
||||
atrial fibrillation,APIXABAN|DABIGATRAN|DRONEDARONE|EDOXABAN|RIVAROXABAN|VERNAKALANT,CARDIOLOGY
|
||||
attention deficit hyperactivity disorder,ATOMOXETINE,MENTAL HEALTH
|
||||
attention-deficit hyperactivity disorder,METHYLPHENIDATE,MENTAL HEALTH
|
||||
axial spondyloarthritis,ADALIMUMAB|GOLIMUMAB|IXEKIZUMAB|SECUKINUMAB|UPADACITINIB,RHEUMATOLOGY
|
||||
basal cell carcinoma,VISMODEGIB,DERMATOLOGY
|
||||
bipolar disorder,LOXAPINE|OLANZAPINE,MENTAL HEALTH
|
||||
bladder,MIRABEGRON,MEDICAL ONCOLOGY
|
||||
brca,OLAPARIB,MEDICAL ONCOLOGY
|
||||
breast cancer,ABEMACICLIB|ALPELISIB|ANASTROZOLE|ATEZOLIZUMAB|BEVACIZUMAB|CAPECITABINE|DENOSUMAB|DOCETAXEL|ERIBULIN|EVEROLIMUS|FULVESTRANT|GEMCITABINE|INTRABEAM|LAPATINIB|NERATINIB|OLAPARIB|PACLITAXEL|PALBOCICLI|PALBOCICLIB|PEMBROLIZUMAB|PERTUZUMAB|RIBOCICLIB|SACITUZUMAB|TRASTUZUMAB|TUCATINIB|VINORELBINE,MEDICAL ONCOLOGY
|
||||
cardiomyopathy,TAFAMIDIS,CARDIOLOGY
|
||||
cardiovascular disease,ATORVASTATIN,CARDIOLOGY
|
||||
cervical cancer,TOPOTECAN,MEDICAL ONCOLOGY
|
||||
cholangiocarcinoma,PEMIGATINIB,MEDICAL ONCOLOGY
|
||||
choroidal neovascularisation,AFLIBERCEPT|RANIBIZUMAB,OPHTHALMOLOGY
|
||||
chronic kidney disease,DAPAGLIFLOZIN|IMLIFIDASE|ROXADUSTAT,NEPHROLOGY
|
||||
chronic liver disease,AVATROMBOPAG|LUSUTROMBOPAG,GASTROENTEROLOGY
|
||||
chronic lymphocytic leukaemia,ACALABRUTINIB|BENDAMUSTINE|DUVELISIB|IBRUTINIB|IDELALISIB|OBINUTUZUMAB|OFATUMUMAB|RITUXIMAB|VENETOCLAX,CLINICAL HAEMATOLOGY
|
||||
chronic myeloid leukaemia,ASCIMINIB|BOSUTINIB|STANDARD-DOSE|DASATINIB|DASITINIB|NILOTINIB|PONATINIB,CLINICAL HAEMATOLOGY
|
||||
chronic obstructive pulmonary disease,ROFLUMILAST,THORACIC MEDICINE
|
||||
colon cancer,CAPECITABINE,MEDICAL ONCOLOGY
|
||||
colorectal cancer,BEVACIZUMAB|CAPECITABINE|IRINOTECAN,MEDICAL ONCOLOGY
|
||||
constipation,LUBIPROSTONE|METHYLNALTREXONE|NALDEMEDINE|NALOXEGOL|PRUCALOPRIDE,GASTROENTEROLOGY
|
||||
covid-19,NIRMATRELVIR,INFECTIOUS DISEASES
|
||||
crohn's disease,INFLIXIMAB|VEDOLIZUMAB,GASTROENTEROLOGY
|
||||
cutaneous t-cell lymphoma,BRENTUXIMAB|CHLORMETHINE,CLINICAL HAEMATOLOGY
|
||||
cystic fibrosis,COLISTIMETHATE|LUMACAFTOR|MANNITOL,THORACIC MEDICINE
|
||||
cytomegalovirus,LETERMOVIR|MARIBAVIR,INFECTIOUS DISEASES
|
||||
deep vein thrombosis,APIXABAN|DABIGATRAN|EDOXABAN|RIVAROXABAN,VASCULAR SURGERY
|
||||
depression,ESKETAMINE,MENTAL HEALTH
|
||||
diabetes,ERTUGLIFLOZIN|INHALED|AFLIBERCEPT|BROLUCIZUMAB|DEXAMETHASONE|FARICIMAB|FLUOCINOLONE|RANIBIZUMAB,DIABETIC MEDICINE
|
||||
diabetes,ERTUGLIFLOZIN|INHALED|AFLIBERCEPT|BROLUCIZUMAB|DEXAMETHASONE|FARICIMAB|FLUOCINOLONE|RANIBIZUMAB,OPHTHALMOLOGY
|
||||
diabetic retinopathy,RANIBUZIMAB,OPHTHALMOLOGY
|
||||
diffuse large b-cell lymphoma,AXICABTAGENE|POLATUZUMAB|TISAGENLECLEUCEL,CLINICAL HAEMATOLOGY
|
||||
dravet syndrome,CANNABIDIOL|FENFLURAMINE,NEUROLOGY
|
||||
drug misuse,BUPRENORPHINE|NALTREXONE,MENTAL HEALTH
|
||||
dry eye,CICLOSPORIN,OPHTHALMOLOGY
|
||||
dyspepsia,LANSOPRAZOLE,GASTROENTEROLOGY
|
||||
endometrial cancer,DOSTARLIMAB,MEDICAL ONCOLOGY
|
||||
epilepsy,CENOBAMATE|GABAPENTIN|RETIGABINE,NEUROLOGY
|
||||
fallopian tube,BEVACIZUMAB|NIRAPARIB|OLAPARIB|RUCAPARIB,MEDICAL ONCOLOGY
|
||||
follicular lymphoma,DUVELISIB|IDELALISIB|LENALIDOMIDE|OBINUTUZUMAB|RITUXIMAB|TISAGENLECLEUCEL,CLINICAL HAEMATOLOGY
|
||||
gastric cancer,CAPECITABINE|RAMUCIRUMAB|TRASTUZUMAB|TRIFLURIDINE,MEDICAL ONCOLOGY
|
||||
gastro-oesophageal junction,NIVOLUMAB|PEMBROLIZUMAB,MEDICAL ONCOLOGY
|
||||
giant cell arteritis,TOCILIZUMAB,RHEUMATOLOGY
|
||||
glioma,CARMUSTINE,MEDICAL ONCOLOGY
|
||||
gout,CANAKINUMAB|FEBUXOSTAT|LESINURAD,RHEUMATOLOGY
|
||||
graft versus host disease,RUXOLITINIB,CLINICAL HAEMATOLOGY
|
||||
granulomatosis with polyangiitis,AVACOPAN|MEPOLIZUMAB,RHEUMATOLOGY
|
||||
growth hormone deficiency,SOMATROPIN,ENDOCRINOLOGY
|
||||
hand eczema,ALITRETINOIN,DERMATOLOGY
|
||||
heart failure,DAPAGLIFLOZIN|EMPAGLIFLOZIN|IVABRADINE|SACUBITRIL|VERICIGUAT,CARDIOLOGY
|
||||
hepatitis b,ADEFOVIR,GASTROENTEROLOGY
|
||||
hepatitis c,BOCEPREVIR|DACLATASVIR|ELBASVIR|GLECAPREVIR|INTERFERON|LEDIPASVIR|OMBITASVIR|PEGINTERFERON|PEGYLATED|SIMEPREVIR|SOFOSBUVIR|TELAPREVIR,GASTROENTEROLOGY
|
||||
hepatocellular carcinoma,ATEZOLIZUMAB|CABOZANTINIB|LENVATINIB|RAMUCIRUMAB|REGORAFENIB|SELECTIVE|SORAFENIB,MEDICAL ONCOLOGY
|
||||
hiv,CABOTEGRAVIR,INFECTIOUS DISEASES
|
||||
hodgkin lymphoma,BRENTUXIMAB|NIVOLUMAB|PEMBROLIZUMAB,CLINICAL HAEMATOLOGY
|
||||
hormone receptor,ABEMACICLIB,MEDICAL ONCOLOGY
|
||||
hypercholesterolaemia,EZETIMIBE,CARDIOLOGY
|
||||
hyperparathyroidism,CINACALCET|ETELCALCETIDE,ENDOCRINOLOGY
|
||||
immune thrombocytopenia,AVATROMBOPAG|FOSTAMATINIB,CLINICAL HAEMATOLOGY
|
||||
influenza,AMANTADINE|ZANAMIVIR|BALOXAVIR,INFECTIOUS DISEASES
|
||||
insomnia,ZALEPLON,NEUROLOGY
|
||||
irritable bowel syndrome,ELUXADOLINE,GASTROENTEROLOGY
|
||||
ischaemic stroke,ALTEPLASE,STROKE MEDICINE
|
||||
juvenile idiopathic arthritis,ABATECEPT|CANAKINUMAB|TOCILIZUMAB|TOFACITINIB,RHEUMATOLOGY
|
||||
kidney transplant,BASILIXIMAB,NEPHROLOGY
|
||||
leukaemia,FLUDARABINE|IMATINIB,CLINICAL HAEMATOLOGY
|
||||
lung cancer,ATEZOLIZUMAB|DURVALUMAB|GEFITINIB|ORAL|NINTEDANIB,MEDICAL ONCOLOGY
|
||||
lymphoma,BENDAMUSTINE|CRIZOTINIB|PIXANTRONE|RITUXIMAB,CLINICAL HAEMATOLOGY
|
||||
macular degeneration,AFLIBERCEPT|BROLUCIZUMAB|FARICIMAB|RANIBIZUMAB,OPHTHALMOLOGY
|
||||
macular oedema,AFLIBERCEPT|RANIBIZUMAB,OPHTHALMOLOGY
|
||||
major depressive episodes,AGOMELATINE|VORTIOXETINE,MENTAL HEALTH
|
||||
malignant melanoma,VEMURAFENIB,MEDICAL ONCOLOGY
|
||||
malignant pleural mesothelioma,NIVOLUMAB|PEMETREXED,MEDICAL ONCOLOGY
|
||||
manic episode,ARIPIPRAZOLE,MENTAL HEALTH
|
||||
mantle cell lymphoma,AUTOLOGOUS|BORTEZOMIB|IBRUTINIB|LENALIDOMIDE|TEMSIROLIMUS,CLINICAL HAEMATOLOGY
|
||||
melanoma,COBIMETINIB|DABRAFENIB|ENCORAFENIB|IPILIMUMAB|NIVOLUMAB|PEMBROLIZUMAB|TALIMOGENE|TRAMETINIB,MEDICAL ONCOLOGY
|
||||
merkel cell carcinoma,AVELUMAB,MEDICAL ONCOLOGY
|
||||
migraine,BOTULINUM|EPTINEZUMAB|ERENUMAB|FREMANEZUMAB|GALCANEZUMAB,NEUROLOGY
|
||||
motor neurone disease,RILUZOLE,NEUROLOGY
|
||||
multiple myeloma,BORTEZOMIB|THALIDOMIDE|CARFILZOMIB|DARATUMUMAB|DENOSUMAB|ELOTUZUMAB|ISATUXIMAB|IXAZOMIB|LENALIDOMIDE|PANOBINOSTAT|POMALIDOMIDE|SELINEXOR|TECLISTAMAB,CLINICAL HAEMATOLOGY
|
||||
multiple sclerosis,ALEMTUZUMAB|BETA|CLADRIBINE|DACLIZUMAB|DIMETHYL|DIROXIMEL|FINGOLIMOD|INTERFERON|NATALIZUMAB|OCRELIZUMAB|OZANIMOD|PEGINTERFERON|PONESIMOD|SIPONIMOD|TERIFLUNOMIDE,NEUROLOGY
|
||||
myelodysplastic,LENALIDOMIDE|LUSPATERCEPT,CLINICAL HAEMATOLOGY
|
||||
myelofibrosis,FEDRATINIB|RUXOLITINIB,CLINICAL HAEMATOLOGY
|
||||
myocardial infarction,ALTEPLASE|BIVALIRUDIN|TICAGRELOR,CARDIOLOGY
|
||||
myotonia,MEXILETINE,NEUROLOGY
|
||||
narcolepsy,SOLRIAMFETOL,NEUROLOGY
|
||||
neuroendocrine tumour,EVEROLIMUS|LUTETIUM,MEDICAL ONCOLOGY
|
||||
non-small cell lung cancer,ATEZOLIZMAB|DOCETAXEL|ERLOTINIB|PEMETREXED,MEDICAL ONCOLOGY
|
||||
non-small-cell lung cancer,AFATINIB|ALECTINIB|AMIVANTAMAB|ATEZOLIZUMAB|BEVACIZUMAB|BRIGATINIB|CEMIPLIMAB|CERITINIB|CRIZOTINIB|DABRAFENIB|DACOMITINIB|DURVALUMAB|ENTRECTINIB|ERLOTINIB|GEFITINIB|LORLATINIB|MOBOCERTINIB|NECITUMUMAB|NIVOLUMAB|OSIMERTINIB|PACLITAXEL|PEMBROLIZUMAB|PEMETREXED|PRALSETINIB|RAMUCIRUMAB|SELPERCATINIB|SOTORASIB|TEPOTINIB,MEDICAL ONCOLOGY
|
||||
obesity,LIRAGLUTIDE|NALTREXONE|ORLISTAT|SEMAGLUTIDE|SIBUTRAMINE,ENDOCRINOLOGY
|
||||
oesophageal cancer,NIVOLUMAB,MEDICAL ONCOLOGY
|
||||
osteoarthritis,CELECOXIB,RHEUMATOLOGY
|
||||
osteoporosis,ALENDRONATE|DENOSUMAB|ORAL|ROMOSOZUMAB,RHEUMATOLOGY
|
||||
osteosarcoma,MIFAMURTIDE,MEDICAL ONCOLOGY
|
||||
ovarian cancer,BEVACIZUMAB|PACLITAXEL|PEGYLATED|TOPOTECAN|TRABECTEDIN,MEDICAL ONCOLOGY
|
||||
overweight,RIMONABANT,ENDOCRINOLOGY
|
||||
pancreatic cancer,GEMCITABINE|OLAPARIB|PACLITAXEL|PEGYLATED,MEDICAL ONCOLOGY
|
||||
paroxysmal nocturnal haemoglobinuria,PEGCETACOPLAN|RAVULIZUMAB,CLINICAL HAEMATOLOGY
|
||||
peripheral arterial disease,NAFTIDROFYRYL,VASCULAR SURGERY
|
||||
plaque psoriasis,ADALIMUMAB|APREMILAST|BIMEKIZUMAB|BRODALUMAB|CERTOLIZUMAB|GUSELKUMAB|INFLIXIMAB|IXEKIZUMAB|RISANKIZUMAB|SECUKINUMAB|TILDRAKIZUAMB|USTEKINUMAB,DERMATOLOGY
|
||||
polycystic kidney disease,TOLVAPTAN,NEPHROLOGY
|
||||
polycythaemia vera,RUXOLITINIB,CLINICAL HAEMATOLOGY
|
||||
pregnancy,ROUTINE,OBSTETRICS
|
||||
primary biliary cholangitis,OBETICHOLIC,GASTROENTEROLOGY
|
||||
primary hypercholesterolaemia,ALIROCUMAB|EVOLOCUMAB,CARDIOLOGY
|
||||
prostate cancer,ABIRATERONE|APALUTAMIDE|CABAZITAXEL|DAROLUTAMIDE|DEGARELIX|DENOSUMAB|DOCETAXEL|ENZALUTAMIDE|OLAPARIB|PADELIPORFIN|RADIUM-|RADIUM|SIPULEUCEL-T,MEDICAL ONCOLOGY
|
||||
psoriasis,EFALUZIMAB,DERMATOLOGY
|
||||
psoriatic arthritis,ABATACEPT|ADALIMUMAB|APREMILAST|CERTOLIZUMAB|ETANERCEPT|GOLIMUMAB|GUSELKUMAB|IXEKIZUMAB|RISANKIZUMAB|TOFACITINIB|UPADACITINIB|USTEKINUMAB,RHEUMATOLOGY
|
||||
pulmonary embolism,APIXABAN|DABIGATRAN|EDOXABAN|RIVAROXABAN,THORACIC MEDICINE
|
||||
pulmonary fibrosis,NINTEDANIB|PIRFENIDONE,THORACIC MEDICINE
|
||||
relapsing multiple sclerosis,OFATUMUMAB,NEUROLOGY
|
||||
renal cell carcinoma,AVELUMAB|AXITINIB|BEVACIZUMAB|CABOZANTINIB|EVEROLIMUS|LENVATINIB|NIVOLUMAB|PAZOPANIB|PEMBROLIZUMAB|SUNITINIB|TIVOZANIB,MEDICAL ONCOLOGY
|
||||
renal transplantation,BASILIXIMAB|INDUCTION,NEPHROLOGY
|
||||
retinal vein occlusion,AFLIBERCEPT|DEXAMETHASONE|RANIBIZUMAB,OPHTHALMOLOGY
|
||||
rheumatoid arthritis,ABATACEPT|ADALIMUMAB|ANAKINRA|BARICITINIB|CELECOXIB|CERTOLIZUMAB|ETANERCEPT|FILGOTINIB|GOLIMUMAB|RITUXIMAB|SARILUMAB|TOCILIZUMAB|TOFACITINIB|UPADACITINIB,RHEUMATOLOGY
|
||||
rivaroxaban,ANDEXANET,CARDIOLOGY
|
||||
schizophrenia,AMISULPRIDE|ARIPIPRAZOLE|LOXAPINE,MENTAL HEALTH
|
||||
seizures,CANNABIDIOL,NEUROLOGY
|
||||
sepsis,DROTRECOGIN,INFECTIOUS DISEASES
|
||||
severe persistent allergic asthma,OMALIZUMAB,THORACIC MEDICINE
|
||||
short bowel syndrome,TEDUGLUTIDE,GASTROENTEROLOGY
|
||||
sickle cell disease,CRIZANLIZUMAB,CLINICAL HAEMATOLOGY
|
||||
sleep apnoea,PITOLISANT|SOLRIAMFETOL,THORACIC MEDICINE
|
||||
smoking cessation,NICOTINE|VARENICLINE,THORACIC MEDICINE
|
||||
soft tissue sarcoma,INTRAVENOUS|NBTXR-|OLARATUMAB,MEDICAL ONCOLOGY
|
||||
spinal muscular atrophy,NUSINERSEN|RISDIPLAM,NEUROLOGY
|
||||
squamous cell,CETUXIMAB,MEDICAL ONCOLOGY
|
||||
squamous cell carcinoma,CEMIPLIMAB|NIVOLUMAB|PEMBROLIZUMAB,MEDICAL ONCOLOGY
|
||||
stem cell transplant,MELPHALAN|TREOSULFAN,CLINICAL HAEMATOLOGY
|
||||
stroke,APIXABAN|DABIGATRAN|EDOXABAN|RIVAROXABAN,STROKE MEDICINE
|
||||
systemic lupus erythematosus,ANIFROLUMAB|ETANERCEPT,RHEUMATOLOGY
|
||||
systemic mastocytosis,MIDOSTAURIN,CLINICAL HAEMATOLOGY
|
||||
thrombocytopenic purpura,ELTROMBOPAG|ROMIPLOSTIM,CLINICAL HAEMATOLOGY
|
||||
thrombotic thrombocytopenic purpura,CAPLACIZUMAB,CLINICAL HAEMATOLOGY
|
||||
thyroid cancer,CABOZANTINIB|LENVATINIB|SELPERCATINIB|VANDETANIB,MEDICAL ONCOLOGY
|
||||
tophaceous gout,PEGLOTICASE,RHEUMATOLOGY
|
||||
transitional cell carcinoma,VINFLUNINE,MEDICAL ONCOLOGY
|
||||
tuberous sclerosis,CANNABIDIOL,NEUROLOGY
|
||||
type 1 diabetes,CONTINUOUS|DAPAGLIFLOZIN|INSULIN|SOTAGLIFLOZIN,DIABETIC MEDICINE
|
||||
type 2 diabetes,CANAGLIFLOZIN|CONTINUOUS|DAPAGLIFLOZIN|EMPAGLIFLOZIN|ERTUGLIFLOZIN|EXENATIDE|FINERENONE|INSULIN|LIRAGLUTIDE|PIOGLITAZONE|ROSIGLITAZONE,DIABETIC MEDICINE
|
||||
ulcerative colitis,ADALIMUMAB|INFLIXIMAB|FILGOTINIB|OZANIMOD|TOFACITINIB|UPADACITINIB|USTEKINUMAB|VEDOLIZUMAB,GASTROENTEROLOGY
|
||||
urothelial carcinoma,ATEZOLIZUMAB|PEMBROLIZUMAB,MEDICAL ONCOLOGY
|
||||
urticaria,OMALIZUMAB,DERMATOLOGY
|
||||
uterine fibroids,RELUGOLIX,GYNAECOLOGY
|
||||
uveitis,ADALIMUMAB|FLUOCINOLONE,OPHTHALMOLOGY
|
||||
vascular disease,MODIFIED-RELEASE|CLOPIDOGREL,VASCULAR SURGERY
|
||||
vasculitis,RITUXIMAB,RHEUMATOLOGY
|
||||
venous thromboembolism,APIXABAN|DABIGATRAN|RIVAROXABAN,CLINICAL HAEMATOLOGY
|
||||
|
@@ -0,0 +1,145 @@
|
||||
Drug,Indication,Cluster_ID,Cluster_Description,NICE_TA_Reference
|
||||
ABATACEPT,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA195/TA280/TA375
|
||||
ABATACEPT,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA195/TA280/TA375
|
||||
ABATACEPT,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA568
|
||||
ACALABRUTINIB,Chronic lymphocytic leukaemia,CLL_COD,Chronic lymphocytic leukaemia,TA689
|
||||
ADALIMUMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA130/TA195/TA375
|
||||
ADALIMUMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA130/TA195/TA375
|
||||
ADALIMUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA146/TA455
|
||||
ADALIMUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA146/TA455
|
||||
ADALIMUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA125/TA199
|
||||
ADALIMUMAB,Crohn's disease,CROHNS_COD,Crohn's disease codes,TA187
|
||||
ADALIMUMAB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA329
|
||||
ADALIMUMAB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA143/TA383
|
||||
AFLIBERCEPT,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA346
|
||||
AFLIBERCEPT,Diabetic macular oedema,DMTYPE2AUDIT_COD,Type 2 diabetes codes,TA346
|
||||
ALIROCUMAB,Hypercholesterolaemia,HYPERCHOL_COD,Hypercholesterolaemia codes,TA393
|
||||
APREMILAST,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA419
|
||||
APREMILAST,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA419
|
||||
APREMILAST,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA433
|
||||
ATEZOLIZUMAB,Cancer (various),CANCER_COD,Cancer codes (various),TA492/TA520/TA525
|
||||
BARICITINIB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA466
|
||||
BARICITINIB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA466
|
||||
BARICITINIB,Atopic dermatitis,ECZEMA_COD,Atopic dermatitis/eczema codes,TA681
|
||||
BEVACIZUMAB,Cancer (various),CANCER_COD,Cancer codes (various),TA584/TA666
|
||||
BIMEKIZUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA723
|
||||
BIMEKIZUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA723
|
||||
BOTULINUM A TOXIN,Spasticity (various),SPASTICITY_COD,Spasticity and movement disorder codes,No specific TA
|
||||
BRODALUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA511
|
||||
BRODALUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA511
|
||||
CERTOLIZUMAB PEGOL,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA375/TA415
|
||||
CERTOLIZUMAB PEGOL,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA375/TA415
|
||||
CERTOLIZUMAB PEGOL,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA574
|
||||
CERTOLIZUMAB PEGOL,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA445
|
||||
CERTOLIZUMAB PEGOL,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA383
|
||||
DENOSUMAB,Osteoporosis,OSTEO_COD,Osteoporosis codes,TA204
|
||||
DENOSUMAB,Bone metastases,CANCER_COD,Cancer codes (bone metastases),TA265
|
||||
DEXAMETHASONE,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA349/TA824
|
||||
DEXAMETHASONE,Diabetic macular oedema,DMTYPE2AUDIT_COD,Type 2 diabetes codes,TA349/TA824
|
||||
DEXAMETHASONE,Multiple myeloma,MM_COD,Multiple myeloma codes,TA311/TA380
|
||||
DEXAMETHASONE,Uveitis,UVEITIS_COD,Uveitis codes,TA460
|
||||
DIMETHYL FUMARATE,Multiple sclerosis,MS_COD,Multiple sclerosis codes,TA320
|
||||
DIMETHYL FUMARATE,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA475
|
||||
DOCETAXEL,Cancer (various),CANCER_COD,Cancer codes (breast/lung/prostate),TA006/TA030/TA101
|
||||
DUPILUMAB,Atopic dermatitis,ECZEMA_COD,Atopic dermatitis/eczema codes,TA534
|
||||
DUPILUMAB,Asthma,ASTHMA_COD,Asthma codes,TA751
|
||||
ERENUMAB,Migraine,MIGRAINE_COD,Migraine codes,TA682
|
||||
ETANERCEPT,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA036/TA130/TA195
|
||||
ETANERCEPT,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA036/TA130/TA195
|
||||
ETANERCEPT,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA103
|
||||
ETANERCEPT,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA103
|
||||
ETANERCEPT,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA104/TA199
|
||||
ETANERCEPT,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA143/TA383
|
||||
EVOLOCUMAB,Hypercholesterolaemia,HYPERCHOL_COD,Hypercholesterolaemia codes,TA394
|
||||
FARICIMAB,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA799
|
||||
FARICIMAB,Diabetic macular oedema,DMTYPE2AUDIT_COD,Type 2 diabetes codes,TA799
|
||||
FILGOTINIB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA676
|
||||
FILGOTINIB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA676
|
||||
FILGOTINIB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA792
|
||||
FLUOCINOLONE,Atopic dermatitis,ECZEMA_COD,Atopic dermatitis/eczema codes,TA081
|
||||
FLUOCINOLONE,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA301
|
||||
FLUOCINOLONE,Uveitis,UVEITIS_COD,Uveitis codes,TA590
|
||||
FLUOCINOLONE ACETONIDE,Atopic dermatitis,ECZEMA_COD,Atopic dermatitis/eczema codes,TA081
|
||||
FLUOCINOLONE ACETONIDE,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA301
|
||||
FLUOCINOLONE ACETONIDE,Uveitis,UVEITIS_COD,Uveitis codes,TA590
|
||||
FREMANEZUMAB,Migraine,MIGRAINE_COD,Migraine codes,TA631/TA764
|
||||
GALCANEZUMAB,Migraine,MIGRAINE_COD,Migraine codes,TA659
|
||||
GOLIMUMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA225/TA375
|
||||
GOLIMUMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA225/TA375
|
||||
GOLIMUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA220
|
||||
GOLIMUMAB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA329
|
||||
GOLIMUMAB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA233/TA383
|
||||
GUSELKUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA521
|
||||
GUSELKUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA521
|
||||
GUSELKUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA711/TA815
|
||||
IDARUCIZUMAB,Anticoagulant reversal,ANTICOAG_COD,Anticoagulation-related codes,No specific TA
|
||||
IMATINIB,Chronic myeloid leukaemia,CML_COD,Chronic myeloid leukaemia codes,TA050/TA070/TA251
|
||||
IMATINIB,Gastrointestinal stromal tumours,GIST_COD,Gastrointestinal stromal tumour codes,TA086/TA326
|
||||
IMMUNOGLOBULIN,Immunodeficiency (various),IMMUNODEF_COD,Primary/secondary immunodeficiency codes,TA481/TA482
|
||||
INFLIXIMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA036/TA130/TA195
|
||||
INFLIXIMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA036/TA130/TA195
|
||||
INFLIXIMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA134
|
||||
INFLIXIMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA134
|
||||
INFLIXIMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA104/TA199
|
||||
INFLIXIMAB,Crohn's disease,CROHNS_COD,Crohn's disease codes,TA040/TA187
|
||||
INFLIXIMAB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA163/TA329
|
||||
INFLIXIMAB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA383
|
||||
IXEKIZUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA442
|
||||
IXEKIZUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA442
|
||||
IXEKIZUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA537
|
||||
IXEKIZUMAB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA718
|
||||
LUCENTIS,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,Biosimilar of ranibizumab
|
||||
LUCENTIS,Diabetic macular oedema,DMTYPE2AUDIT_COD,Type 2 diabetes codes,Biosimilar of ranibizumab
|
||||
OBINUTUZUMAB,Chronic lymphocytic leukaemia,CLL_COD,Chronic lymphocytic leukaemia codes,TA343/TA663
|
||||
OBINUTUZUMAB,Follicular lymphoma,FL_COD,Follicular lymphoma codes,TA472/TA513/TA629
|
||||
OCTREOTIDE,Neuroendocrine tumours,NET_COD,Neuroendocrine tumour codes,No specific TA
|
||||
OMALIZUMAB,Asthma,ASTHMA_COD,Asthma codes,TA133/TA278
|
||||
OMALIZUMAB,Chronic urticaria,URTICARIA_COD,Urticaria codes,TA339
|
||||
RANIBIZUMAB,Diabetic macular oedema,DM_COD,Diabetes mellitus codes,TA274
|
||||
RANIBIZUMAB,Diabetic macular oedema,DMTYPE2AUDIT_COD,Type 2 diabetes codes,TA274
|
||||
REMICADE,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,Brand name for infliximab
|
||||
REMICADE,Crohn's disease,CROHNS_COD,Crohn's disease codes,Brand name for infliximab
|
||||
REMICADE,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,Brand name for infliximab
|
||||
REMICADE,Psoriasis,PSORIASIS_COD,Psoriasis codes,Brand name for infliximab
|
||||
RILUZOLE,Motor neurone disease,MND_COD,Motor neurone disease codes,TA020
|
||||
RISANKIZUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA596
|
||||
RISANKIZUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA596
|
||||
RISANKIZUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA803
|
||||
RITUXIMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA126/TA195
|
||||
RITUXIMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA126/TA195
|
||||
RITUXIMAB,Non-Hodgkin's lymphoma,NHL_COD,Non-Hodgkin's lymphoma codes,TA037/TA065/TA110
|
||||
RITUXIMAB,Chronic lymphocytic leukaemia,CLL_COD,Chronic lymphocytic leukaemia codes,TA174/TA193/TA359
|
||||
RITUXIMAB,ANCA-associated vasculitis,VASCULITIS_COD,Vasculitis codes,TA308
|
||||
RIXATHON,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,Biosimilar of rituximab
|
||||
RIXATHON,Non-Hodgkin's lymphoma,NHL_COD,Non-Hodgkin's lymphoma codes,Biosimilar of rituximab
|
||||
SACITUZUMAB,Triple-negative breast cancer,BREASTCA_COD,Breast cancer codes,TA819
|
||||
SARILUMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA485
|
||||
SARILUMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA485
|
||||
SECUKINUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA350/TA734
|
||||
SECUKINUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA350/TA734
|
||||
SECUKINUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA445
|
||||
SECUKINUMAB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA407/TA719
|
||||
TERIPARATIDE,Osteoporosis,OSTEO_COD,Osteoporosis codes,TA087/TA161
|
||||
TILDRAKIZUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,No TA match found
|
||||
TILDRAKIZUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),No TA match found
|
||||
TOCILIZUMAB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA198/TA247/TA375
|
||||
TOCILIZUMAB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA198/TA247/TA375
|
||||
TOCILIZUMAB,Juvenile idiopathic arthritis,JIA_COD,Juvenile idiopathic arthritis codes,TA238/TA373
|
||||
TOCILIZUMAB,Giant cell arteritis,GCA_COD,Giant cell arteritis codes,TA518
|
||||
TOFACITINIB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA480
|
||||
TOFACITINIB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA480
|
||||
TOFACITINIB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA543
|
||||
TOFACITINIB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA547
|
||||
UPADACITINIB,Rheumatoid arthritis,RARTH_COD,Rheumatoid arthritis diagnosis codes,TA665/TA744
|
||||
UPADACITINIB,Rheumatoid arthritis,C19RARTH_COD,Rheumatoid arthritis disorders (broader),TA665/TA744
|
||||
UPADACITINIB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA768
|
||||
UPADACITINIB,Atopic dermatitis,ECZEMA_COD,Atopic dermatitis/eczema codes,TA814
|
||||
UPADACITINIB,Ankylosing spondylitis,ANKSPON_COD,Ankylosing spondylitis codes,TA829
|
||||
UPADACITINIB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA856
|
||||
USTEKINUMAB,Psoriasis,PSORIASIS_COD,Psoriasis codes,TA180/TA455
|
||||
USTEKINUMAB,Psoriasis,CUST_CMMS_PSORIASIS,Psoriasis (Cambridge Multimorbidity),TA180/TA455
|
||||
USTEKINUMAB,Psoriatic arthritis,PSORIASIS_COD,Psoriasis codes (for psoriatic arthritis),TA340
|
||||
USTEKINUMAB,Crohn's disease,CROHNS_COD,Crohn's disease codes,TA456
|
||||
USTEKINUMAB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA633
|
||||
VEDOLIZUMAB,Ulcerative colitis,ULCCOLITIS_COD,Ulcerative colitis codes,TA342
|
||||
VEDOLIZUMAB,Crohn's disease,CROHNS_COD,Crohn's disease codes,TA352
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# Re-export app from app_v2 for the new UI redesign
|
||||
from pathways_app.app_v2 import app
|
||||
# Re-export app from pathways_app
|
||||
from pathways_app.pathways_app import app
|
||||
|
||||
__all__ = ["app"]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,15 +6,13 @@
|
||||
Outer loop for iterative Reflex frontend development.
|
||||
Each iteration spawns a fresh `claude --print` invocation.
|
||||
Memory persists via filesystem only: git commits, progress.txt, IMPLEMENTATION_PLAN.md, guardrails.md.
|
||||
Completion detected via <promise>COMPLETE</promise> in output.
|
||||
|
||||
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)
|
||||
- Maximum iteration count reached
|
||||
|
||||
.PARAMETER MaxIterations
|
||||
Maximum number of loop iterations before stopping. Default: 15.
|
||||
|
||||
.PARAMETER Model
|
||||
Claude model to use. Default: "sonnet".
|
||||
@@ -29,15 +27,14 @@
|
||||
Number of consecutive iterations with the same error before circuit breaker trips. Default: 3.
|
||||
|
||||
.EXAMPLE
|
||||
.\ralph.ps1 -MaxIterations 15 -Model "sonnet" -BranchName "feature/ui-redesign"
|
||||
.\ralph.ps1 -Model "sonnet" -BranchName "feature/ui-redesign"
|
||||
|
||||
.EXAMPLE
|
||||
.\ralph.ps1 -Model "opus" -MaxNoProgress 2
|
||||
#>
|
||||
|
||||
param(
|
||||
[int]$MaxIterations = 15,
|
||||
[string]$Model = "sonnet",
|
||||
[string]$Model = "opus",
|
||||
[string]$BranchName,
|
||||
[int]$MaxNoProgress = 3,
|
||||
[int]$MaxSameError = 3
|
||||
@@ -151,17 +148,19 @@ if (Test-Path $progressFile) {
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===== Ralph Wiggum Loop (Reflex UI) =====" -ForegroundColor Cyan
|
||||
Write-Host "Model: $Model | Max iterations: $MaxIterations" -ForegroundColor Cyan
|
||||
Write-Host "Model: $Model | 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 ""
|
||||
|
||||
for ($i = 1; $i -le $MaxIterations; $i++) {
|
||||
$i = 0
|
||||
while ($true) {
|
||||
$i++
|
||||
$totalIteration = $existingIterations + $i
|
||||
Write-Host ""
|
||||
Write-Host "--- Iteration $i of $MaxIterations (Total: $totalIteration) ---" -ForegroundColor Yellow
|
||||
Write-Host "--- Iteration $i (Total: $totalIteration) ---" -ForegroundColor Yellow
|
||||
|
||||
# Record HEAD before this iteration
|
||||
$headBefore = git rev-parse HEAD 2>$null
|
||||
@@ -199,41 +198,41 @@ for ($i = 1; $i -le $MaxIterations; $i++) {
|
||||
$line = $_.ToString().Trim()
|
||||
if (-not $line) { return }
|
||||
|
||||
# Save raw event for debugging
|
||||
Add-Content -Path $rawLogFile -Value $line -Encoding UTF8
|
||||
# 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 detection ---
|
||||
# --- 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
|
||||
}
|
||||
elseif ($evt.tool_name) {
|
||||
$toolCount++
|
||||
Write-Host " [$($evt.tool_name)]" -ForegroundColor DarkCyan
|
||||
}
|
||||
|
||||
# --- Text content ---
|
||||
# --- 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.result) {
|
||||
Write-Host $evt.result
|
||||
[void]$textBuilder.AppendLine($evt.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)
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($evt.message.content) {
|
||||
# --- 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
|
||||
@@ -243,12 +242,16 @@ for ($i = 1; $i -le $MaxIterations; $i++) {
|
||||
$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 — likely stderr output
|
||||
if ($line) {
|
||||
# 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)
|
||||
}
|
||||
@@ -338,9 +341,3 @@ for ($i = 1; $i -le $MaxIterations; $i++) {
|
||||
# Brief pause between iterations
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "===== MAX ITERATIONS REACHED =====" -ForegroundColor Red
|
||||
Write-Host "Completed $MaxIterations iterations without finishing all tasks." -ForegroundColor Red
|
||||
Write-Host "Check progress.txt for current state and what remains." -ForegroundColor Red
|
||||
exit 1
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
-- NICE TA Indication SNOMED Mapping Query (v2 - optimized clusters)
|
||||
-- Excludes overly broad clusters (GDPPR_COD, GDPPR2YR_COD)
|
||||
|
||||
WITH SearchTermClusters AS (
|
||||
SELECT Search_Term, Cluster_ID FROM (VALUES
|
||||
('acute lymphoblastic leukaemia', 'HAEMCANMORPH_COD'),
|
||||
('acute myeloid leukaemia', 'C19HAEMCAN_COD'),
|
||||
('acute promyelocytic leukaemia', 'HAEMCANMORPH_COD'),
|
||||
('allergic asthma', 'AST_COD'),
|
||||
('allergic rhinitis', 'MILDINTAST_COD'),
|
||||
('alzheimer''s disease', 'DEMALZ_COD'),
|
||||
('amyloidosis', 'AMYLOID_COD'),
|
||||
('anaemia', 'eFI2_AnaemiaTimeSensitive'),
|
||||
('anaplastic large cell lymphoma', 'C19HAEMCAN_COD'),
|
||||
('apixaban', 'DOACCON_COD'),
|
||||
('aplastic anaemia', 'eFI2_AnaemiaEver'),
|
||||
('arthritis', 'eFI2_InflammatoryArthritis'),
|
||||
('asthma', 'eFI2_Asthma'),
|
||||
('atopic dermatitis', 'ATOPDERM_COD'),
|
||||
('atrial fibrillation', 'eFI2_AtrialFibrillation'),
|
||||
('attention deficit hyperactivity disorder', 'ADHD_COD'),
|
||||
('bipolar disorder', 'MH_COD'),
|
||||
('bladder', 'eFI2_UrinaryIncontinence'),
|
||||
('breast cancer', 'BRCANSCR_COD'),
|
||||
('cardiomyopathy', 'eFI2_HarmfulDrinking'),
|
||||
('cardiovascular disease', 'CVDRISKASS_COD'),
|
||||
('cervical cancer', 'CSDEC_COD'),
|
||||
('cholangiocarcinoma', 'eFI2_Cancer'),
|
||||
('chronic kidney disease', 'CKD_COD'),
|
||||
('chronic liver disease', 'eFI2_LiverProblems'),
|
||||
('chronic lymphocytic leukaemia', 'EPPHAEMCAN_COD'),
|
||||
('chronic myeloid leukaemia', 'EPPHAEMCAN_COD'),
|
||||
('chronic obstructive pulmonary disease', 'eFI2_COPD'),
|
||||
('colon cancer', 'eFI2_Cancer'),
|
||||
('colorectal cancer', 'GICANREF_COD'),
|
||||
('constipation', 'CHRONCONSTIP_COD'),
|
||||
('covid-19', 'POSSPOSTCOVID_COD'),
|
||||
('crohn''s disease', 'eFI2_InflammatoryBowelDisease'),
|
||||
('cutaneous t-cell lymphoma', 'C19HAEMCAN_COD'),
|
||||
('cystic fibrosis', 'CUST_ICB_CYSTIC_FIBROSIS'),
|
||||
('deep vein thrombosis', 'VTE_COD'),
|
||||
('depression', 'eFI2_Depression'),
|
||||
('diabetes', 'eFI2_DiabetesEver'),
|
||||
('diabetic retinopathy', 'DRSELIGIBILITY_COD'),
|
||||
('diffuse large b-cell lymphoma', 'C19HAEMCAN_COD'),
|
||||
('dravet syndrome', 'EPIL_COD'),
|
||||
('drug misuse', 'ILLSUBINT_COD'),
|
||||
('dyspepsia', 'eFI2_AbdominalPain'),
|
||||
('epilepsy', 'eFI2_Seizures'),
|
||||
('fallopian tube', 'STERIL_COD'),
|
||||
('follicular lymphoma', 'C19HAEMCAN_COD'),
|
||||
('gastric cancer', 'eFI2_Cancer'),
|
||||
('giant cell arteritis', 'GCA_COD'),
|
||||
('glioma', 'NHAEMCANMORPH_COD'),
|
||||
('gout', 'eFI2_InflammatoryArthritis'),
|
||||
('graft versus host disease', 'GVHD_COD'),
|
||||
('granulomatosis with polyangiitis', 'WEGENERVASC_COD'),
|
||||
('growth hormone deficiency', 'HYPOPITUITARY_COD'),
|
||||
('hand eczema', 'ECZEMA_COD'),
|
||||
('heart failure', 'eFI2_HeartFailure'),
|
||||
('hepatitis b', 'HEPBCVAC_COD'),
|
||||
('hepatocellular carcinoma', 'eFI2_Cancer'),
|
||||
('hiv', 'PREFLANG_COD'),
|
||||
('hodgkin lymphoma', 'HAEMCANMORPH_COD'),
|
||||
('hormone receptor', 'eFI2_ThyroidProblems'),
|
||||
('hypercholesterolaemia', 'CLASSFH_COD'),
|
||||
('immune thrombocytopenia', 'ITP_COD'),
|
||||
('influenza', 'FLUINVITE_COD'),
|
||||
('insomnia', 'eFI2_SleepProblems'),
|
||||
('irritable bowel syndrome', 'IBS_COD'),
|
||||
('ischaemic stroke', 'OSTR_COD'),
|
||||
('juvenile idiopathic arthritis', 'RARTHAD_COD'),
|
||||
('kidney transplant', 'RENALTRANSP_COD'),
|
||||
('leukaemia', 'eFI2_Cancer'),
|
||||
('lung cancer', 'FTCANREF_COD'),
|
||||
('lymphoma', 'C19HAEMCAN_COD'),
|
||||
('macular degeneration', 'CUST_ICB_VISUAL_IMPAIRMENT'),
|
||||
('macular oedema', 'CUST_ICB_VISUAL_IMPAIRMENT'),
|
||||
('major depressive episodes', 'eFI2_Depression'),
|
||||
('malignant melanoma', 'eFI2_Cancer'),
|
||||
('malignant pleural mesothelioma', 'LUNGCAN_COD'),
|
||||
('manic episode', 'MH_COD'),
|
||||
('mantle cell lymphoma', 'HAEMCANMORPH_COD'),
|
||||
('melanoma', 'eFI2_Cancer'),
|
||||
('merkel cell carcinoma', 'C19CAN_COD'),
|
||||
('migraine', 'eFI2_Headache'),
|
||||
('motor neurone disease', 'MND_COD'),
|
||||
('multiple myeloma', 'C19HAEMCAN_COD'),
|
||||
('multiple sclerosis', 'MS_COD'),
|
||||
('myelodysplastic', 'eFI2_AnaemiaEver'),
|
||||
('myelofibrosis', 'MDS_COD'),
|
||||
('myocardial infarction', 'eFI2_IschaemicHeartDisease'),
|
||||
('myotonia', 'CNDATRISK2_COD'),
|
||||
('narcolepsy', 'LD_COD'),
|
||||
('neuroendocrine tumour', 'LUNGCAN_COD'),
|
||||
('non-small cell lung cancer', 'LUNGCAN_COD'),
|
||||
('non-small-cell lung cancer', 'FTCANREF_COD'),
|
||||
('obesity', 'BMI30_COD'),
|
||||
('osteoarthritis', 'CUST_ICB_OSTEOARTHRITIS'),
|
||||
('osteoporosis', 'eFI2_Osteoporosis'),
|
||||
('osteosarcoma', 'NHAEMCANMORPH_COD'),
|
||||
('ovarian cancer', 'C19CAN_COD'),
|
||||
('peripheral arterial disease', 'PADEXC_COD'),
|
||||
('plaque psoriasis', 'PSORIASIS_COD'),
|
||||
('polycystic kidney disease', 'EPPCONGMALF_COD'),
|
||||
('polycythaemia vera', 'C19HAEMCAN_COD'),
|
||||
('pregnancy', 'C19PREG_COD'),
|
||||
('primary biliary cholangitis', 'eFI2_LiverProblems'),
|
||||
('primary hypercholesterolaemia', 'FNFHYP_COD'),
|
||||
('prostate cancer', 'EPPSOLIDCAN_COD'),
|
||||
('psoriasis', 'PSORIASIS_COD'),
|
||||
('psoriatic arthritis', 'RARTHAD_COD'),
|
||||
('pulmonary embolism', 'eFI2_RespiratoryDiseaseTimeSensitive'),
|
||||
('pulmonary fibrosis', 'ILD_COD'),
|
||||
('relapsing multiple sclerosis', 'MS_COD'),
|
||||
('renal cell carcinoma', 'C19CAN_COD'),
|
||||
('renal transplantation', 'RENALTRANSP_COD'),
|
||||
('retinal vein occlusion', 'CUST_ICB_VISUAL_IMPAIRMENT'),
|
||||
('rheumatoid arthritis', 'eFI2_InflammatoryArthritis'),
|
||||
('rivaroxaban', 'DOACCON_COD'),
|
||||
('schizophrenia', 'MH_COD'),
|
||||
('seizures', 'LSZFREQ_COD'),
|
||||
('sepsis', 'C19ACTIVITY_COD'),
|
||||
('severe persistent allergic asthma', 'SEVAST_COD'),
|
||||
('sickle cell disease', 'SICKLE_COD'),
|
||||
('sleep apnoea', 'CUST_ICB_NON_SEVERE_LDA'),
|
||||
('smoking cessation', 'SMOKINGINT_COD'),
|
||||
('soft tissue sarcoma', 'NHAEMCANMORPH_COD'),
|
||||
('spinal muscular atrophy', 'MND_COD'),
|
||||
('squamous cell', 'C19CAN_COD'),
|
||||
('squamous cell carcinoma', 'C19CAN_COD'),
|
||||
('stem cell transplant', 'ALLOTRANSP_COD'),
|
||||
('stroke', 'eFI2_Stroke'),
|
||||
('systemic lupus erythematosus', 'SLUPUS_COD'),
|
||||
('systemic mastocytosis', 'HAEMCANMORPH_COD'),
|
||||
('thrombocytopenic purpura', 'TTP_COD'),
|
||||
('thrombotic thrombocytopenic purpura', 'TTP_COD'),
|
||||
('thyroid cancer', 'C19CAN_COD'),
|
||||
('tophaceous gout', 'CUST_ICB_OSTEOARTHRITIS'),
|
||||
('transitional cell carcinoma', 'C19CAN_COD'),
|
||||
('type 1 diabetes', 'DMTYPE1_COD'),
|
||||
('type 2 diabetes', 'DMTYPE2_COD'),
|
||||
('ulcerative colitis', 'eFI2_InflammatoryBowelDisease'),
|
||||
('urothelial carcinoma', 'NHAEMCANMORPH_COD'),
|
||||
('urticaria', 'XSAL_COD'),
|
||||
('uveitis', 'CUST_ICB_VISUAL_IMPAIRMENT'),
|
||||
('vascular disease', 'CVDINVITE_COD'),
|
||||
('vasculitis', 'CRYOGLOBVASC_COD')
|
||||
) AS t(Search_Term, Cluster_ID)
|
||||
),
|
||||
|
||||
ClusterCodes AS (
|
||||
SELECT
|
||||
stc.Search_Term,
|
||||
c."SNOMEDCode",
|
||||
c."SNOMEDDescription"
|
||||
FROM SearchTermClusters stc
|
||||
JOIN DATA_HUB.PHM."ClinicalCodingClusterSnomedCodes" c
|
||||
ON stc.Cluster_ID = c."Cluster_ID"
|
||||
WHERE c."SNOMEDCode" IS NOT NULL
|
||||
),
|
||||
|
||||
ExplicitCodes AS (
|
||||
SELECT Search_Term, SNOMEDCode, SNOMEDDescription FROM (VALUES
|
||||
('acute coronary syndrome', '837091000000100', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '162930007', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '239805001', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '239810002', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '239811003', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '394990003', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '429712009', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '441562009', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '441680005', 'Manual mapping'),
|
||||
('ankylosing spondylitis', '441930001', 'Manual mapping'),
|
||||
('axial spondyloarthritis', '723116002', 'Manual mapping'),
|
||||
('choroidal neovascularisation', '380621000000102', 'Manual mapping'),
|
||||
('choroidal neovascularisation', '733124000', 'Manual mapping')
|
||||
) AS t(Search_Term, SNOMEDCode, SNOMEDDescription)
|
||||
)
|
||||
|
||||
SELECT Search_Term, "SNOMEDCode" AS SNOMEDCode, "SNOMEDDescription" AS SNOMEDDescription
|
||||
FROM ClusterCodes
|
||||
UNION ALL
|
||||
SELECT Search_Term, SNOMEDCode, SNOMEDDescription
|
||||
FROM ExplicitCodes
|
||||
ORDER BY Search_Term, SNOMEDCode;
|
||||
Reference in New Issue
Block a user