import type { Protocol, RobSummaryItem, SearchResultItem } from "../types"; import { useRobReference } from "./useRobReference"; import "./review-fixes.css"; interface RobHeatMapProps { protocol: Protocol; summary: RobSummaryItem[]; papersById: Map; } /** Studies × OHAT questions, colour-coded, with each study's tier. */ export function RobHeatMap({ summary, papersById }: RobHeatMapProps) { const { reference } = useRobReference(); if (!reference) return null; const finals = summary.filter((i) => i.final); const open = summary.length - finals.length; const symbol = (v: string) => reference.ratings.find((r) => r.value === v)?.symbol ?? v; return (
{finals.length === 0 ? (

No final risk-of-bias assessments yet.

) : (
{reference.questions.map((q) => ( ))} {finals.map((item) => { const paper = papersById.get(item.paper_id); const answers = new Map(item.final!.answers.map((a) => [a.question, a.rating])); return ( {reference.questions.map((q) => { const rating = answers.get(q.number); const key = item.key_questions.includes(q.number); return ( ); })} ); })}
Study Outcome Q{q.number} Tier
{paper ? `${paper.authors.split(",")[0]}${paper.year ? ` (${paper.year})` : ""}` : item.paper_id} {item.outcome} {rating ? symbol(rating) : "—"} {item.tier ? `Tier ${item.tier}` : "—"}
)}

++ definitely low · + probably low · − probably high · NR not reported (probably high) · −− definitely high · bordered cells are key questions · — = question doesn't apply to the design. {open > 0 && ` ${open} assessment${open === 1 ? "" : "s"} still awaiting a second reviewer or resolution.`}

); }