Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /**
* The view model of a persona overview (issue #271, discussion #265).
*
* `GET /api/overview?persona=` returns one `OverviewView`. The page renders
* the signals as a list (the accessible path), the nodes and links as a
* layered 3D scene (an enhancement), and one node at a time in the detail
* panel. Everything a client needs is in the JSON: no functions, no lookups.
*/
import type { Range, SeriesPoint, Severity } from "./derive";
export type { Range, SeriesPoint, Severity };
export type NodeStatus = Severity | "none";
export interface OverviewLayer {
id: string;
name: string;
/** Stacking order; the scene puts z * 110 units between layers */
z: number;
color: string;
}
export type Fact = [string, string];
export interface OverviewLinkRef {
href: string;
text: string;
}
export interface OverviewLink {
source: string;
target: string;
/** What the link means, e.g. "drives", "treats", "consent", "accesses" */
kind?: string;
status?: NodeStatus;
color?: string;
width?: number;
distance?: number;
/** Animated particles along the link: a flow */
particles?: number;
arrow?: boolean;
}
export interface OverviewNode {
id: string;
label: string;
layer: string;
/** The record type in plain words, never a Neo4j label: "Patient", "Diagnosis", "Parameter" */
kind: string;
status?: NodeStatus;
pulse?: boolean;
size?: number;
color?: string;
/** Fixed x/y on its layer */
pin?: [number, number];
title?: string;
sub?: string;
description?: string;
facts?: Fact[];
/** The article the node rests on, adopted numbering */
article?: string;
links?: OverviewLinkRef[];
/** A series over time, with what it measures and the expected band */
series?: SeriesPoint[];
unit?: string;
measure?: string;
range?: Range | null;
higherIsWorse?: boolean;
/** Nodes and links a click unfolds from this node (the single measurements, the months) */
expand?: { nodes: OverviewNode[]; links: OverviewLink[] };
}
export interface OverviewSignal {
severity: Severity;
nodeId: string;
/** Stable machine code, e.g. "parameter-out-of-range" */
code: string;
text: string;
article?: string;
}
export interface OverviewLegendItem {
color: string;
text: string;
}
export interface OverviewView {
persona: "patient" | "researcher" | "hdab" | "hospital";
/** ISO date the view was computed for */
asOf: string;
me: { id: string; name: string };
title: string;
question: string;
article: string;
layers: OverviewLayer[];
nodes: OverviewNode[];
links: OverviewLink[];
/** Sorted worst first */
signals: OverviewSignal[];
legend: OverviewLegendItem[];
dataNote?: string;
}
|