Skip to content

2026 04 08 Hematology Comparison Summary Cards Design

Date: 2026-04-08 Branch: fixes/client Status: Approved

The Comparison page’s ComparisonSummaryCard always renders the solid-tumour layout — showing “Early Stage %”, “Metastatic %”, and both “Early Stage” / “Metastatic Line 1” treatment eligible rows — regardless of disease type. Hematology diseases don’t have stage distribution and use “therapy” line categories instead of “early”/“metastatic”.

Additionally, collectComparisonData has a data bug: groupLinesByStage assigns hematology therapy lines stageCategory: "therapy", but the eligible count capture only handles "early" and "metastatic" groups — so hematology txEligible values are always 0/0.

For hematology diseases, the comparison summary card should show:

  • Context: Geography + Indication (unchanged)
  • Incidence: Just the incidence number (no ”& Stage” heading, no Early Stage %, no Metastatic %)
  • Treatment Eligible: Single row labeled “Therapy Line 1” (not “Metastatic Line 1”), no “Early Stage” row

The DOCX export summary table should also adapt headers for hematology scenarios.

Thread diseaseType through ComparisonScenarioData (Approach A from brainstorming). The data is already available in collectComparisonData which reads geoDiseaseConfigAtom. Minimal surface area, follows existing data-collection pattern.

Add diseaseType to ComparisonScenarioData:

export interface ComparisonScenarioData {
meta: TabMeta;
geo: string;
indication: string | null;
selectedYear: number;
diseaseType: "Solid Tumor" | "Hematology"; // <-- new field
// ... rest unchanged
}

2. Data Collection Fix — Comparison/collectComparisonData.ts

Section titled “2. Data Collection Fix — Comparison/collectComparisonData.ts”

A) Populate diseaseType:

Read from diseaseConfig?.config.type (already available at line 46), default to "Solid Tumor":

diseaseType: diseaseConfig?.config.type ?? "Solid Tumor",

B) Fix therapy group txEligible bug:

Add a third branch in the eligible-count capture loop (lines 98-103) for "therapy" groups:

if (group.stageCategory === "early") {
txEligibleEarly = items[0]?.eligibleCount ?? 0;
} else if (group.stageCategory === "metastatic") {
txEligibleMetL1 = items[0]?.eligibleCount ?? 0;
} else if (group.stageCategory === "therapy") {
txEligibleMetL1 = items[0]?.eligibleCount ?? 0;
}

Stores the first therapy line’s eligible count in the metL1 slot since hematology has no metastatic lines (metL1 is otherwise always 0). The card uses diseaseType to pick the correct label.

3. Conditional Rendering — Comparison/ComparisonSummaryCard.tsx

Section titled “3. Conditional Rendering — Comparison/ComparisonSummaryCard.tsx”

Derive isSolidTumor from the new field:

const isSolidTumor = data.diseaseType === "Solid Tumor";

Three conditional changes:

  • Section heading: "Incidence & Stage" for solid, "Incidence" for hematology
  • Stage rows (Early Stage % and Metastatic %): shown for solid, hidden for hematology
  • Treatment Eligible section:
    • Solid: both “Early Stage” and “Metastatic Line 1” rows (current behavior)
    • Hematology: single row labeled “Therapy Line 1” using data.txEligible.metL1

4. DOCX Export — Comparison/reporting/buildComparisonReport.ts

Section titled “4. DOCX Export — Comparison/reporting/buildComparisonReport.ts”

Adapt buildSummaryTable based on whether all scenarios are hematology:

  • All hematology: Headers ["Scenario", "Geography", "Indication", "Incidence", "Therapy L1 Tx Eligible"] — drop Early column, relabel Met L1
  • All solid / mixed: Current headers unchanged

Row data follows the same logic — omit txEligible.early column for all-hematology.

FileChange
src/.../Comparison/types.tsAdd diseaseType field to ComparisonScenarioData
src/.../Comparison/collectComparisonData.tsPopulate diseaseType + fix therapy group txEligible bug
src/.../Comparison/ComparisonSummaryCard.tsxConditional rendering based on diseaseType
src/.../Comparison/reporting/buildComparisonReport.tsAdapt DOCX summary table headers for hematology
  • Changes to the main Configuration page summary cards (already working correctly)
  • Other comparison page sections (sales, MC, tornado) — unaffected by disease type
  • Mixed disease type scenarios in a single comparison (edge case; defaults to solid layout)