Skip to content

Commit e05f699

Browse files
committed
Improvements
1 parent e4a6c3b commit e05f699

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# Sidebar grouping
22

33
The probe sidebar turns a manufacturer's flat probe list into a hierarchy from
4-
an explicit, hand-curated config. There are no rules and no inference: every
4+
an explicit, hand-curated config. The goal is a more human-friendly menu: users
5+
may not know the probes' SKUs and instead recognize the marketing names and
6+
categories. There are no rules and no inference: every
57
probe is placed by model id under a path of named nodes. A manufacturer with no
68
config (everything except IMEC today) renders as a flat list.
79

8-
This replaced an earlier rule-based engine that derived the grouping by regex on
9-
the part number and substring-matching the free-text description. Those rules
10-
were fragile because the probe metadata does not carry the facts we group on
11-
(generation, family, length), so we were reconstructing editorial decisions from
12-
strings. The explicit file states those decisions directly instead.
13-
1410
## Format
1511

1612
JSON (`imec_neuropixels.json`), because Vite imports it with no extra
@@ -21,7 +17,9 @@ order) at the leaves.
2117
`collapsible` is a per-node property that **defaults to `true`**, so only the
2218
exceptions need stating: the length bands set `collapsible: false`, while every
2319
other node omits it. `true` is a foldable header with a caret; `false` is a
24-
static, always-open divider.
20+
static, always-open divider. This is useful for divisions worth mentioning but
21+
not worth occluding, usually the finer levels, like the length bands of the
22+
non-human-primate (NHP) probes in Neuropixels.
2523

2624
The walker (`groupEntries.ts`) attaches each manifest entry to the node listing
2725
its model, prunes empty branches, and collects anything not placed into a
@@ -32,5 +30,11 @@ manifest needs a home in the config.
3230

3331
Edit the relevant `probes` list. To add a new manufacturer, add its JSON file
3432
and one line in `index.ts`. No engine changes. JSON has no comments, so if a
35-
placement is non-obvious, record the rationale here or in a `note` field on the
36-
node.
33+
placement is non-obvious, record the rationale in a `note` field on the node
34+
(documentation only, not rendered). For example, the Neuropixels NXT node:
35+
36+
```json
37+
{ "label": "Neuropixels NXT",
38+
"note": "NP3023/NP3024 describe themselves as 'Neuropixels 3.0' but belong to the NXT generation.",
39+
"children": [ ... ] }
40+
```

apps/probe-viewer/src/grouping/groupEntries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ManifestEntry } from "../types/probe";
2-
import type { GroupNode, HierarchyConfig, HierarchyNode } from "./types";
2+
import type { GroupNode, HierarchyConfig, DisplayCategory } from "./types";
33

44
// Label for the trailing bucket that catches any probe present in the manifest
55
// but not placed anywhere in the hierarchy. It is the visible signal that a new
@@ -18,7 +18,7 @@ export function groupEntries(
1818
for (const entry of entries) byModel.set(entry.model, entry);
1919
const placed = new Set<string>();
2020

21-
const walk = (node: HierarchyNode): GroupNode | null => {
21+
const walk = (node: DisplayCategory): GroupNode | null => {
2222
const collapsible = node.collapsible ?? true;
2323

2424
if (node.children) {

apps/probe-viewer/src/grouping/imec_neuropixels.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
{ "label": "Legacy", "probes": ["PRB2_1_2_0640_0", "PRB2_4_2_0640_0"] }
2626
] },
2727
{ "label": "Neuropixels NXT",
28+
"note": "NP3023/NP3024 describe themselves as 'Neuropixels 3.0' but I am gruping them here as the NXT generation.",
2829
"children": [
2930
{ "label": "Single-shank", "probes": ["NP3010", "NP3011"] },
3031
{ "label": "Multi-shank", "probes": ["NP3020", "NP3021", "NP3022", "NP3023", "NP3024"] },

apps/probe-viewer/src/grouping/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ import type { ManifestEntry } from "../types/probe";
99
// need stating: the length bands set `collapsible: false` to render as static
1010
// dividers, and every other node omits it and stays a foldable header.
1111

12-
export interface HierarchyNode {
12+
export interface DisplayCategory {
1313
label: string;
1414
// true (default) => a collapsible group header; false => a static, always-open
1515
// divider.
1616
collapsible?: boolean;
17-
children?: HierarchyNode[];
17+
// Free-text rationale for a non-obvious placement. Documentation only, since
18+
// JSON has no comments; not rendered.
19+
note?: string;
20+
children?: DisplayCategory[];
1821
probes?: string[]; // model ids, in display order
1922
}
2023

2124
export interface HierarchyConfig {
22-
hierarchy: HierarchyNode[];
25+
hierarchy: DisplayCategory[];
2326
}
2427

2528
// One node of the resolved tree the walker returns, with manifest entries

0 commit comments

Comments
 (0)