@hippo-digital/hippocampus 2.7.2 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +5 -4
  3. package/agents/knowledge-builder.md +2 -0
  4. package/agents/workflow-orchestrator.md +2 -0
  5. package/assets/dist/hippocampus.css +1 -1
  6. package/assets/hippocampus.scss +124 -0
  7. package/bin/hippocampus.js +1 -0
  8. package/docs/add-project-context.md +8 -2
  9. package/docs/ask-whats-already-known.md +6 -2
  10. package/docs/check-for-unintended-consequences.md +7 -2
  11. package/docs/data-and-governance.md +6 -2
  12. package/docs/describe-the-context-of-use.md +134 -0
  13. package/docs/design-actions-and-decisions.md +8 -3
  14. package/docs/hippocampus-for-designers-and-researchers.md +98 -220
  15. package/docs/hippocampus-technical.md +16 -0
  16. package/docs/human-centred-design.md +165 -0
  17. package/docs/import-a-research-round.md +9 -2
  18. package/docs/link-insights-to-needs.md +6 -2
  19. package/docs/record-a-usability-test.md +118 -0
  20. package/docs/record-design-principles.md +76 -0
  21. package/docs/research-knowledge-graph.md +25 -6
  22. package/docs/review-and-promote-a-draft.md +7 -2
  23. package/docs/set-quality-objectives.md +87 -0
  24. package/docs/source-model.md +104 -23
  25. package/docs/start-here.md +67 -34
  26. package/docs/turn-personas-into-users-and-needs.md +9 -2
  27. package/docs/weigh-options-against-requirements.md +96 -0
  28. package/docs/write-requirements.md +161 -0
  29. package/lib/breadcrumb.js +67 -14
  30. package/lib/create-router.js +125 -2
  31. package/lib/docs.js +28 -4
  32. package/lib/flow-map.js +15 -4
  33. package/lib/hcd-views.js +362 -0
  34. package/lib/known.js +5 -2
  35. package/lib/lint-knowledge.js +170 -1
  36. package/lib/load-knowledge.js +128 -5
  37. package/lib/record-links.js +11 -2
  38. package/lib/schema.js +190 -4
  39. package/lib/tidy-principles.js +112 -0
  40. package/package.json +1 -1
  41. package/scripts/import-design-actions.js +11 -2
  42. package/scripts/init.js +19 -0
  43. package/scripts/migrate-knowledge.js +9 -1
  44. package/scripts/smoke-routes.js +12 -1
  45. package/scripts/tidy-principles.js +68 -0
  46. package/skills/COVERAGE-MATRIX.md +2 -0
  47. package/skills/README.md +5 -0
  48. package/skills/SKILL-FORMAT.md +1 -1
  49. package/skills/add-scenario/SKILL.md +5 -1
  50. package/skills/add-user-needs/SKILL.md +11 -1
  51. package/skills/create-journey-from-scenario/SKILL.md +5 -2
  52. package/skills/ingest-research-round/SKILL.md +3 -3
  53. package/skills/ingest-user-personas/SKILL.md +24 -7
  54. package/skills/map-research-to-graph/SKILL.md +7 -5
  55. package/skills/record-design-decision/SKILL.md +1 -0
  56. package/skills/review-research-import-draft/SKILL.md +7 -1
  57. package/skills/skills.json +54 -1
  58. package/skills/structure-research-draft/SKILL.md +12 -2
  59. package/skills/weigh-options-against-requirements/SKILL.md +60 -0
  60. package/skills/write-requirements/SKILL.md +69 -0
  61. package/views/hippocampus/_layout.html +15 -12
  62. package/views/hippocampus/components/_activity.njk +36 -0
  63. package/views/hippocampus/components/_journey-step.njk +30 -0
  64. package/views/hippocampus/context.html +197 -0
  65. package/views/hippocampus/design.html +128 -0
  66. package/views/hippocampus/evaluation.html +119 -0
  67. package/views/hippocampus/index.html +57 -11
  68. package/views/hippocampus/journey.html +25 -1
  69. package/views/hippocampus/journeys.html +3 -0
  70. package/views/hippocampus/plan.html +64 -0
  71. package/views/hippocampus/requirements.html +94 -0
  72. package/views/hippocampus/research.html +20 -1
  73. package/views/hippocampus/scenarios.html +3 -0
  74. package/views/hippocampus/user.html +43 -3
@@ -6,11 +6,16 @@ summary: What Hippocampus is and is not, how research moves through it, and how
6
6
  ---
7
7
  # Start here
8
8
 
9
- Hippocampus keeps a design team's knowledge in one connected place: the
10
- research a team has done, what it learned, the needs that came out of it, and
11
- the journeys and screens built to meet them. Every record is linked to the
12
- records it relies on, so you can follow a screen back to the research that
13
- shaped it.
9
+ Hippocampus keeps a design team's knowledge in one connected place: who the
10
+ service is for and how they work, what they need, the requirements a design is
11
+ checked against, the options weighed and the design chosen, and what happened
12
+ when people used it. Every record is linked to the records it relies on, so you
13
+ can follow a screen back to the research that shaped it.
14
+
15
+ It is organised around the human-centred design cycle - plan, understand the
16
+ context of use, specify the requirements, design, evaluate - and the viewer's
17
+ navigation is that cycle. [Hippocampus and human-centred design](human-centred-design.md)
18
+ explains it.
14
19
 
15
20
  This page covers what Hippocampus is, how research moves through it, and how
16
21
  to set it up. If you only ever look at the pages in a prototype and never run
@@ -19,12 +24,14 @@ commands, read the first three sections and skip to
19
24
 
20
25
  ## What Hippocampus is
21
26
 
22
- - **A structured record.** Users, needs, research rounds, insights, evidence,
23
- scenarios, journeys, screens and decisions, each stored as data in the same
24
- repository as your NHS Prototype Kit prototype.
27
+ - **A structured record.** Quality objectives; users, goals, scenarios and
28
+ journeys; needs and requirements; design actions, decisions, principles and
29
+ screens; research rounds, insights and evidence. Each is stored as data in
30
+ the same repository as your NHS Prototype Kit prototype.
25
31
  - **A set of links between them.** A need says which evidence supports it. A
26
- screen says which needs it meets. A decision says what it changed. That is
27
- what lets you ask "why is this screen like this?" and get an answer.
32
+ requirement says which need it makes checkable. A decision says how it fares
33
+ against each requirement, and a finding says whether the design met one.
34
+ That is what lets you ask "why is this screen like this?" and get an answer.
28
35
  - **A viewer.** Pages inside your prototype, at `/hippocampus`, that show the
29
36
  records and the links between them. Nobody has to read the data files.
30
37
  - **A set of commands and skills.** Commands bring research in and check the
@@ -86,15 +93,21 @@ You can follow the evidence behind a prototype without running anything. The
86
93
  pages below are under `/hippocampus` by default; your team may have mounted
87
94
  the viewer somewhere else.
88
95
 
96
+ The navigation bar is the five activities, then three views that cut across
97
+ them.
98
+
89
99
  | To find out | Open |
90
100
  | --- | --- |
91
- | Where the work stands: rounds not yet mined, insights with no need, needs with no screen | `/hippocampus` |
92
- | Why a screen is designed the way it is | `/hippocampus/trace`, then choose the screen |
93
- | What depends on a piece of research | any evidence link on a need or user page, which opens its impact page |
94
- | Every need, and what supports it | `/hippocampus/user-needs` |
95
- | The journey being prototyped, and what it is built on | `/hippocampus/handover` |
96
- | How the records connect | `/hippocampus/graph` |
97
- | This guide | `/hippocampus/docs` |
101
+ | Where the work stands, and the cycle at a glance | Overview, `/hippocampus` |
102
+ | Why the service exists and what it must achieve for its users | Plan, `/hippocampus/plan` |
103
+ | Who the users are, their goals, how they work today and in what conditions | Context of use, `/hippocampus/context` |
104
+ | What users need, and what a design will be checked against | Requirements, `/hippocampus/requirements` |
105
+ | The options weighed against the requirements, principles and decisions | Design, `/hippocampus/design` |
106
+ | Whether the design meets the requirements, and what testing found | Evaluation, `/hippocampus/evaluation` |
107
+ | Why a screen is designed the way it is | Trace, `/hippocampus/trace`, then choose the screen |
108
+ | What depends on a piece of research | any evidence link, which opens its impact page |
109
+ | How the record types connect | Graph, `/hippocampus/graph` |
110
+ | This guide | Docs, `/hippocampus/docs` |
98
111
 
99
112
  A link that is missing in the viewer is a link missing in the record. Ask the
100
113
  team to add it rather than drawing it in by hand somewhere else.
@@ -178,6 +191,21 @@ prototype, where agents such as GitHub Copilot read them. Run it again after
178
191
  upgrading Hippocampus; it leaves alone any file your team has edited and tells
179
192
  you which.
180
193
 
194
+ ### Upgrade it
195
+
196
+ ```bash
197
+ npm install @hippo-digital/hippocampus@latest
198
+ npx hippocampus init
199
+ npx hippocampus skills install
200
+ npx hippocampus doctor
201
+ ```
202
+
203
+ `init` is safe to run again. It adds anything a newer version expects, such as
204
+ new empty collections in `hippocampus/source/`, and leaves your existing files
205
+ as they are. Skip `skills install` if your team doesn't use an AI agent. The
206
+ package's `CHANGELOG.md` says what changed in each release and whether there is
207
+ anything else to do.
208
+
181
209
  ## When anything leaves your machine
182
210
 
183
211
  - **The `hippocampus` commands send nothing anywhere.** Importing reads PDFs,
@@ -201,24 +229,29 @@ along with who can see the knowledge base and what to keep out of git.
201
229
 
202
230
  ## What to read next
203
231
 
232
+ - [Hippocampus and human-centred design](human-centred-design.md): the cycle,
233
+ what is kept for each activity, and the words the viewer uses
204
234
  - [Data and governance](data-and-governance.md): what to agree with your
205
235
  information governance lead before the first research file goes in
206
236
  - [Ask what's already known](ask-whats-already-known.md): check what the team
207
237
  already knows before you research or design something
208
- - [Import a research round](import-a-research-round.md) and
209
- [Review a draft and promote it](review-and-promote-a-draft.md): bring a
210
- round of research in, steps 1 to 6 above
211
- - [Add project context](add-project-context.md) and
212
- [Turn personas into users and needs](turn-personas-into-users-and-needs.md):
213
- the briefing material and the users everything else hangs off
214
- - [Link insights to needs](link-insights-to-needs.md) and
215
- [Check for unintended consequences](check-for-unintended-consequences.md):
216
- connect the research to the needs, then use those links before designing a
217
- new journey
218
- - [Hippocampus for designers and researchers](hippocampus-for-designers-and-researchers.md):
219
- the record types and viewer pages in more detail
220
- - [Research source file conventions](research-source-file-conventions.md):
221
- how to write research files so they import cleanly
222
- - [Repeatable research round ingestion](repeatable-research-round-ingestion.md):
223
- the full import and promotion procedure
224
- - [Source model](source-model.md): every record type and its fields
238
+
239
+ Then by activity:
240
+
241
+ 1. **Plan**: [Add project context](add-project-context.md),
242
+ [Set quality objectives](set-quality-objectives.md)
243
+ 2. **Context of use**: [Describe the context of use](describe-the-context-of-use.md),
244
+ [Turn personas into users and needs](turn-personas-into-users-and-needs.md),
245
+ [Import a research round](import-a-research-round.md),
246
+ [Review a draft and promote it](review-and-promote-a-draft.md)
247
+ 3. **Requirements**: [Write requirements](write-requirements.md),
248
+ [Link insights to needs](link-insights-to-needs.md)
249
+ 4. **Design**: [Weigh options against requirements](weigh-options-against-requirements.md),
250
+ [Record design principles](record-design-principles.md),
251
+ [Design actions and decisions](design-actions-and-decisions.md),
252
+ [Check for unintended consequences](check-for-unintended-consequences.md)
253
+ 5. **Evaluation**: [Record a usability test](record-a-usability-test.md)
254
+
255
+ And for reference: [Source model](source-model.md) for every record type and
256
+ field, [Research source file conventions](research-source-file-conventions.md)
257
+ and [Repeatable research round ingestion](repeatable-research-round-ingestion.md).
@@ -1,6 +1,6 @@
1
1
  ---
2
- section: recipes
3
- order: 50
2
+ section: context
3
+ order: 20
4
4
  audience: [viewer, cli]
5
5
  summary: Turn persona documents into the users and needs everything else hangs off. There is no draft for this, so git is where you review it.
6
6
  ---
@@ -17,6 +17,13 @@ needs and the evidence behind them straight into `hippocampus/source/`, or you
17
17
  add them by hand. Either way, **you review the change with git before you
18
18
  commit it**.
19
19
 
20
+ This is part of **Context of use**, the second activity. Once the users are
21
+ in, place each one in the context of use - primary, secondary or indirect, their
22
+ goals, the conditions they work in - as described in
23
+ [Describe the context of use](describe-the-context-of-use.md). Persona
24
+ documents rarely say whether a user is primary or indirect, so that is usually a
25
+ team decision rather than something the agent can read off the page.
26
+
20
27
  ## Who this is for
21
28
 
22
29
  Researchers and designers who own the personas. You need to be able to run
@@ -0,0 +1,96 @@
1
+ ---
2
+ section: design
3
+ order: 10
4
+ audience: [viewer, cli]
5
+ summary: Lay the options for a design question against the requirements, so the team can see which requirements no option meets on its own - before choosing.
6
+ ---
7
+ # Weigh options against requirements
8
+
9
+ When a design question has several possible answers, teams usually compare the
10
+ answers with each other. Comparing each one with the requirements instead shows
11
+ something the first way hides: a requirement that **no** option meets on its
12
+ own. That row is the real design problem.
13
+
14
+ This is part of **Design**, the fourth activity. The viewer draws the grid at
15
+ `/hippocampus/design`.
16
+
17
+ ## An example
18
+
19
+ Round 16 of the NCRS research asked how staff keep a route to a household once
20
+ search moves to an API with no location-only search. There were five options.
21
+ Weighed against each other, they read as five competing answers.
22
+
23
+ Weighed against eleven requirements, two rows stood out:
24
+
25
+ - "The user must be able to select every address in a postcode when the exact
26
+ property cannot be identified"
27
+ - "The user must be able to select a period and see only the people who lived at
28
+ the address during it"
29
+
30
+ No option meant to replace the old search met either on its own. So the choice
31
+ was never one of five: it was "keep the old route or get the new API to add one,
32
+ and then add one or both of the targeted searches on top". The grid made that
33
+ visible in a way the option list had not.
34
+
35
+ ## What you need first
36
+
37
+ - a **design action**: the open question. See
38
+ [Design actions and decisions](design-actions-and-decisions.md).
39
+ - a **decision** for each option, linked to the action with `resolves-action`,
40
+ all at `status: "proposed"` while the team is deciding
41
+ - the **requirements** the options should be judged by. See
42
+ [Write requirements](write-requirements.md).
43
+
44
+ ## Record each judgement
45
+
46
+ One `weighed-against` link per option and requirement, from the decision to the
47
+ requirement, with an `outcome`:
48
+
49
+ ```json
50
+ {
51
+ "id": "rel-dec-r16-05-postcode",
52
+ "from": "dec-r16-05",
53
+ "type": "weighed-against",
54
+ "to": "req-q-select-whole-postcode",
55
+ "outcome": "fails",
56
+ "note": "UPRN identifies one property; a missing flat number has nothing to resolve to."
57
+ }
58
+ ```
59
+
60
+ | `outcome` | Use when |
61
+ | --- | --- |
62
+ | `meets` | The option provides it as it stands |
63
+ | `partly` | Only with something else as well, or only in some cases. Say which in `note`. |
64
+ | `fails` | The option cannot provide it |
65
+ | `not-assessed` | Nobody has judged it yet |
66
+
67
+ Write the reason in `note` whenever the outcome is not obvious. The grid shows
68
+ it under the cell, and it is what someone will want to read in a year.
69
+
70
+ A requirement that comes down to how the screen is designed, whichever option
71
+ wins, does not need an outcome for every option. Leave those out, or mark them
72
+ `not-assessed` - and start designing them, because they are not waiting on the
73
+ decision.
74
+
75
+ ## In the viewer
76
+
77
+ `/hippocampus/design` shows a grid for each design action with weighed options:
78
+
79
+ - one column per option, with its status and how many requirements it fails
80
+ - one row per requirement, with each option's outcome
81
+ - **rows no option meets on its own** marked, with a warning above the grid
82
+ saying how many there are
83
+
84
+ Each decision has its own page at `/hippocampus/decisions/<id>` listing the
85
+ requirements it was weighed against. Each requirement's page lists the options
86
+ weighed against it.
87
+
88
+ ## Then decide
89
+
90
+ The grid does not choose. It shows the trade-off clearly enough for the team to
91
+ choose, and it stays on the record afterwards:
92
+
93
+ 1. Accept one decision, or several that combine. Reject the rest.
94
+ 2. Write each one's `consequence`, including the rejected ones - the rejected
95
+ options are the ones people ask about later.
96
+ 3. Leave the `weighed-against` links in place. They are the reason.
@@ -0,0 +1,161 @@
1
+ ---
2
+ section: requirements
3
+ order: 10
4
+ audience: [viewer, cli]
5
+ summary: Turn user needs into requirements a design can be checked against - what users must recognise, select or input, how well, and the rules the service must follow.
6
+ ---
7
+ # Write requirements
8
+
9
+ A need says what is necessary for a user to reach a goal. A requirement says
10
+ what the user must be able to do, precisely enough that someone can look at a
11
+ design and say whether it does it. Without requirements, "this screen addresses
12
+ that need" is a claim nobody can check.
13
+
14
+ This is the third activity. The viewer shows needs and requirements at
15
+ `/hippocampus/requirements`.
16
+
17
+ ## Check the needs first
18
+
19
+ A need must not name a solution. Look at `/hippocampus/requirements` or run:
20
+
21
+ ```bash
22
+ npx hippocampus validate
23
+ ```
24
+
25
+ Two coverage notes matter here:
26
+
27
+ - **needs that name the service or an interface element**: "the system",
28
+ "highlighted", "the screen", "filters", or the service's own name (set
29
+ `shortName` in `project.json` so the check knows it). Rewrite them as what the
30
+ user needs to know or do. "I need conflicting records highlighted" becomes
31
+ "I need to know when two records disagree".
32
+ - **needs with no goal**: no "so that" and no `goalId`. A need without a reason
33
+ cannot be weighed against another.
34
+
35
+ Some flagged needs are really conditions of the context of use - "I need it to
36
+ work on a small screen". Record those as a technical condition instead; see
37
+ [Describe the context of use](describe-the-context-of-use.md).
38
+
39
+ ## The kinds of requirement
40
+
41
+ | `kind` | Says | Must have |
42
+ | --- | --- | --- |
43
+ | `user-qualitative` | What the user must be able to recognise, select or input | `needIds`, `verb` |
44
+ | `user-quantitative` | How well, as a measure | `needIds`, `measure` |
45
+ | `organisational` | A rule users must follow that becomes a requirement on the service | `source` |
46
+ | `market` | What the service must offer to be adopted | `source` |
47
+
48
+ Validation refuses a requirement missing what its kind needs, and names it.
49
+
50
+ ### Qualitative
51
+
52
+ Written as "The user must be able to recognise / select / input …", with the
53
+ verb recorded:
54
+
55
+ ```json
56
+ {
57
+ "id": "req-q-recognise-partial-results",
58
+ "kind": "user-qualitative",
59
+ "verb": "recognise",
60
+ "statement": "The user must be able to recognise that a search returned only some of the people who match.",
61
+ "needIds": ["need-identify-safeguarding-household"],
62
+ "insightIds": ["round-16-insight-40"],
63
+ "qualityDimension": "harm"
64
+ }
65
+ ```
66
+
67
+ Two tests of a good one: it names no solution ("a red banner" is a design), and
68
+ someone could watch a person use a prototype and say whether they managed it.
69
+
70
+ ### Quantitative
71
+
72
+ A measure of human-centred quality, with how it is measured:
73
+
74
+ ```json
75
+ {
76
+ "id": "req-n-address-only-identification",
77
+ "kind": "user-quantitative",
78
+ "statement": "Of at least 15 clinical advisors given only the address from a 999 call, 90% identify the correct resident within 2 minutes.",
79
+ "needIds": ["need-identify-emergency-patient-by-address"],
80
+ "measure": {
81
+ "dimension": "efficiency",
82
+ "userId": "clinical-advisor",
83
+ "task": "Identify the resident from an address-only 999 call",
84
+ "sampleSize": 15,
85
+ "successRate": 0.9,
86
+ "timeLimit": "2 minutes",
87
+ "valuesStatus": "placeholder"
88
+ }
89
+ }
90
+ ```
91
+
92
+ **The numbers start as placeholders.** `valuesStatus` is `placeholder` unless
93
+ you say `agreed`, and the viewer marks placeholder measures so a first guess is
94
+ never read as a target. Set the numbers with the team - starting from how the
95
+ current service performs - and check them with users before changing it to
96
+ `agreed`.
97
+
98
+ The task must be a whole task that reaches a goal, not a subtask. That is what
99
+ makes it usable as a usability test task later.
100
+
101
+ ### Organisational
102
+
103
+ A rule from information governance, access control or policy. It comes from a
104
+ source, not from users, so it has no `needIds`:
105
+
106
+ ```json
107
+ {
108
+ "id": "req-org-result-cap-50",
109
+ "kind": "organisational",
110
+ "statement": "A patient search returns no more than 50 patient records.",
111
+ "source": "Caldicott Guardian - information governance decision for PDS FHIR",
112
+ "qualityDimension": "harm"
113
+ }
114
+ ```
115
+
116
+ A user requirement that has to work within a rule says so with a
117
+ `constrained-by` link. The rule then shows on the requirement's page, and the
118
+ requirement on the rule's.
119
+
120
+ ## Link them
121
+
122
+ Put these in `relationships.json`. Each points from the requirement:
123
+
124
+ | Type | To | Meaning |
125
+ | --- | --- | --- |
126
+ | `derives-from` | a need | The need this requirement makes checkable. Same as listing it in `needIds`. |
127
+ | `based-on-insight` | an insight | The research that shaped the wording. Same as `insightIds`. |
128
+ | `constrained-by` | an organisational requirement | The rule it has to work within |
129
+ | `refines-objective` | a quality objective | The objective this measures |
130
+ | `verified-by` | an insight | A finding that evaluated it, with an `outcome` - see [Record a usability test](record-a-usability-test.md) |
131
+
132
+ Journey steps can list the requirements they must meet in `requirementIds`.
133
+
134
+ Validation checks which way each of these runs. A link written backwards does
135
+ not fail on its own - traversal just stops at it - so validation catches it
136
+ instead.
137
+
138
+ ## Draft them somewhere safe first
139
+
140
+ Requirements are usually written in a workshop and argued over. Draft them in
141
+ a file under `hippocampus/imports/requirements/` with a `.review.md` beside it,
142
+ and move them into `source/requirements.json` once the team agrees. The draft
143
+ is not read by the viewer, so half-agreed wording never appears as fact.
144
+
145
+ ## In the viewer
146
+
147
+ `/hippocampus/requirements` shows:
148
+
149
+ - how many needs have no requirement yet, and how many name a solution
150
+ - the requirements grouped by kind, each with its verb, quality dimension, the
151
+ needs it meets and the rules it works within
152
+ - which requirements have placeholder numbers
153
+ - which have been evaluated, and with what result
154
+ - how many options were weighed against each, linking to the grid under Design
155
+
156
+ Each requirement has its own page at `/hippocampus/requirements/<id>`.
157
+
158
+ ## Next
159
+
160
+ [Weigh options against requirements](weigh-options-against-requirements.md):
161
+ use the requirements to compare the designs a team is choosing between.
package/lib/breadcrumb.js CHANGED
@@ -9,27 +9,52 @@
9
9
  // assembled by hand on twenty pages is a trail that disagrees with itself
10
10
  // within a month.
11
11
 
12
+ // The five activities of human-centred design, as the CPUX-F curriculum
13
+ // teaches them, are the top of the viewer: the navigation bar is these plus
14
+ // the cross-cutting views. Every section below belongs to one of them, and the
15
+ // trail says which - so a user page reads Knowledge base > Context of use >
16
+ // Users > the user, and the activity is never more than one click away.
17
+ const AREAS = {
18
+ plan: { prefix: '/plan', text: 'Plan' },
19
+ context: { prefix: '/context', text: 'Context of use' },
20
+ requirements: { prefix: '/requirements', text: 'Requirements' },
21
+ design: { prefix: '/design', text: 'Design' },
22
+ evaluation: { prefix: '/evaluation', text: 'Evaluation' }
23
+ }
24
+
12
25
  // Longest prefix wins, so /user-needs is not swallowed by /users. `listPath`
13
26
  // is for detail pages whose list lives at a different URL - a need is at
14
27
  // /needs/:id while the list of needs is /user-needs.
15
28
  const SECTIONS = [
16
- { prefix: '/project', text: 'Project' },
17
- { prefix: '/user-needs', text: 'Needs' },
18
- { prefix: '/users', text: 'Users' },
19
- { prefix: '/needs', text: 'Needs', listPath: '/user-needs' },
20
- { prefix: '/scenarios', text: 'Scenarios' },
21
- { prefix: '/screens', text: 'Screens' },
22
- { prefix: '/research', text: 'Research' },
23
- { prefix: '/insights', text: 'Research', listPath: '/research' },
29
+ { prefix: '/plan', text: 'Plan', area: 'plan' },
30
+ { prefix: '/project', text: 'Project', area: 'plan' },
31
+ { prefix: '/objectives', text: 'Plan', listPath: '/plan', area: 'plan' },
32
+ { prefix: '/context', text: 'Context of use', area: 'context' },
33
+ { prefix: '/users', text: 'Users', area: 'context' },
34
+ { prefix: '/goals', text: 'Context of use', listPath: '/context', area: 'context' },
35
+ { prefix: '/scenarios', text: 'Scenarios', area: 'context' },
36
+ { prefix: '/requirements', text: 'Requirements', area: 'requirements' },
37
+ { prefix: '/user-needs', text: 'Needs', area: 'requirements' },
38
+ { prefix: '/needs', text: 'Needs', listPath: '/user-needs', area: 'requirements' },
39
+ { prefix: '/design', text: 'Design', area: 'design' },
40
+ { prefix: '/principles', text: 'Design', listPath: '/design', area: 'design' },
41
+ { prefix: '/decisions', text: 'Design', listPath: '/design', area: 'design' },
42
+ { prefix: '/screens', text: 'Screens', area: 'design' },
43
+ { prefix: '/evaluation', text: 'Evaluation', area: 'evaluation' },
44
+ { prefix: '/research', text: 'Research', area: 'evaluation' },
45
+ { prefix: '/insights', text: 'Research', listPath: '/research', area: 'evaluation' },
24
46
  { prefix: '/graph', text: 'Relationship graph' },
25
47
  { prefix: '/trace', text: 'Trace tree' },
26
48
  { prefix: '/docs', text: 'Documentation' },
27
49
  // The slice's own handover is a journey view like any other; it just does not
28
50
  // name its journey in the URL. Listing it under Journeys keeps it where the
29
51
  // navigation already puts it.
30
- { prefix: '/handover', text: 'Journeys', listPath: '/journeys' },
31
- { prefix: '/route-review', text: 'Route review' },
32
- { prefix: '/journeys', text: 'Journeys' },
52
+ { prefix: '/handover', text: 'Journeys', listPath: '/journeys', area: 'context' },
53
+ { prefix: '/route-review', text: 'Route review', area: 'design' },
54
+ // A journey map describes the context of use as it is; a to-be journey is a
55
+ // design. Most journeys in a knowledge base are the first kind, and the
56
+ // Design page lists the second, so the section sits with the context of use.
57
+ { prefix: '/journeys', text: 'Journeys', area: 'context' },
33
58
  { prefix: '/evidence', text: 'Evidence' }
34
59
  ].sort((a, b) => b.prefix.length - a.prefix.length)
35
60
 
@@ -56,25 +81,53 @@ function buildTrail ({ basePath, path, leaf, crumbs = [] }) {
56
81
  const listPath = section.listPath || section.prefix
57
82
  const onSection = clean === section.prefix || clean === listPath
58
83
 
59
- if (onSection && !leaf && !crumbs.length) return [root, { text: section.text }]
84
+ // The activity this section belongs to, unless the section IS the activity's
85
+ // own page - Plan > Plan says nothing.
86
+ const area = section.area && AREAS[section.area]
87
+ const areaCrumb = area && area.prefix !== listPath
88
+ ? [{ text: area.text, href: `${basePath}${area.prefix}` }]
89
+ : []
90
+
91
+ if (onSection && !leaf && !crumbs.length) return [root, ...areaCrumb, { text: section.text }]
60
92
 
61
93
  // A section with no list page of its own - a journey or a piece of evidence,
62
94
  // both reached from elsewhere - is left out rather than shown unlinked. An
63
95
  // unlinked middle crumb reads as the page you are on, which it is not.
64
96
  if (NO_LIST.includes(section.prefix)) {
65
- return [root, ...crumbs, { text: leaf || section.text }]
97
+ return [root, ...areaCrumb, ...crumbs, { text: leaf || section.text }]
66
98
  }
67
99
 
68
100
  return [
69
101
  root,
102
+ ...areaCrumb,
70
103
  { text: section.text, href: `${basePath}${listPath}` },
71
104
  ...crumbs,
72
105
  { text: leaf || section.text }
73
106
  ]
74
107
  }
75
108
 
109
+ /**
110
+ * The navigation bar: the five activities, then the views that cut across
111
+ * them. Each activity is current on its own page and on every section that
112
+ * belongs to it, so the bar says which part of the cycle a page is in.
113
+ */
114
+ function navItems () {
115
+ const activities = Object.entries(AREAS).map(([key, area]) => ({
116
+ href: area.prefix,
117
+ text: area.text,
118
+ match: SECTIONS.filter((section) => section.area === key).map((section) => section.prefix)
119
+ }))
120
+ return [
121
+ { href: '', text: 'Overview', match: [] },
122
+ ...activities,
123
+ { href: '/graph', text: 'Graph', match: ['/graph'], secondary: true },
124
+ { href: '/trace', text: 'Trace', match: ['/trace'], secondary: true },
125
+ { href: '/docs', text: 'Docs', match: ['/docs'], secondary: true }
126
+ ]
127
+ }
128
+
76
129
  // Reached from other pages; no index of its own to link back to. Journeys had
77
130
  // been in here for the same reason, until they got one.
78
131
  const NO_LIST = ['/evidence']
79
132
 
80
- module.exports = { buildTrail, SECTIONS }
133
+ module.exports = { buildTrail, navItems, SECTIONS, AREAS }