@hippo-digital/hippocampus 2.8.0 → 2.9.0
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.
- package/CHANGELOG.md +64 -3
- package/bin/hippocampus.js +2 -0
- package/docs/design-actions-and-decisions.md +19 -0
- package/docs/review-and-promote-a-draft.md +77 -0
- package/docs/source-model.md +23 -3
- package/docs/start-here.md +15 -0
- package/lib/collections.js +53 -0
- package/lib/consequences.js +2 -0
- package/lib/create-router.js +39 -0
- package/lib/hcd-views.js +4 -1
- package/lib/lint-knowledge.js +1 -1
- package/lib/load-knowledge.js +146 -136
- package/lib/schema-version.js +74 -1
- package/lib/schema.js +53 -1
- package/package.json +1 -1
- package/scripts/check-draft.js +48 -0
- package/scripts/import-design-actions.js +42 -6
- package/scripts/lib/draft.js +265 -0
- package/scripts/promote-draft.js +92 -0
- package/scripts/promote-research-draft.js +5 -12
- package/scripts/smoke-routes.js +13 -2
- package/skills/SKILL-FORMAT.md +1 -1
- package/skills/add-scenario/SKILL.md +1 -1
- package/skills/create-journey-from-scenario/SKILL.md +1 -1
- package/views/hippocampus/research.html +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
Release 1 of the traceability work: the knowledge base can say who decided,
|
|
6
|
+
when, and on what, and any draft can be checked and promoted the same way.
|
|
7
|
+
Everything is additive within schemaVersion 1. A knowledge base that uses the
|
|
8
|
+
new link types or method records that it needs 2.9.0, so an older package
|
|
9
|
+
refuses it rather than reading it partially.
|
|
10
|
+
|
|
11
|
+
- **`draft check` and `draft promote`.** One route for drafts of any record
|
|
12
|
+
type, not just research rounds. `draft check` validates the draft against the
|
|
13
|
+
whole knowledge base without changing it, and writes what it found into the
|
|
14
|
+
draft's review note. `draft promote` needs a `--reviewer` who is not the
|
|
15
|
+
author, honours `after` (drafts that must go first), records each promotion
|
|
16
|
+
in `hippocampus/manifests/drafts.json`, and is safe to run twice. See
|
|
17
|
+
[Review a draft and promote it](docs/review-and-promote-a-draft.md#drafts-of-any-other-record).
|
|
18
|
+
- **Who and when on decisions.** Decisions take `decidedBy`, `decidedOn`
|
|
19
|
+
(`YYYY-MM-DD`) and `owner`; design actions take `owner`; insights take
|
|
20
|
+
`signedOffOn` beside `signedOffBy`. `import design-actions` now writes
|
|
21
|
+
Owner, Decided by and Date agreed into these fields instead of prose, reads
|
|
22
|
+
ISO, UK and Excel dates, and keeps a date it cannot read in the consequence
|
|
23
|
+
with a note.
|
|
24
|
+
- **Expert reviews are evaluation.** A new research method, `expert-review`,
|
|
25
|
+
for reviews such as a clinical safety review. A round can say whether it was
|
|
26
|
+
`formative` or `summative`. A participant can be a `reviewer`: reviewers are
|
|
27
|
+
listed separately on the research page and never counted as users the
|
|
28
|
+
research heard from.
|
|
29
|
+
- **Two new links.** `rests-on` (design action, decision or requirement to an
|
|
30
|
+
assumption) and `challenged-by` (assumption, decision or requirement to
|
|
31
|
+
evidence or an insight). Both show on record pages in each direction.
|
|
32
|
+
- **`_meta.json` records `requiresPackage`.** Written by `draft promote`, never
|
|
33
|
+
lowered, and checked on load with a message naming the version to upgrade to.
|
|
34
|
+
- **One list of collection files.** `lib/collections.js` is shared by loading,
|
|
35
|
+
validation and promotion, so `promote research` now sees ids in every record
|
|
36
|
+
type when it checks for clashes, and tolerates missing files.
|
|
37
|
+
|
|
38
|
+
## 2.8.1
|
|
39
|
+
|
|
40
|
+
- **The viewer works with nhsuk-prototype-kit 8.5.2.** That kit renders through
|
|
41
|
+
a view class that puts `views/` in front of every template name, so every
|
|
42
|
+
viewer page was a 500 ("template not found: views/hippocampus/index...") and
|
|
43
|
+
`hippocampus doctor` reported that the prototype never started. The viewer
|
|
44
|
+
now asks the kit's view class how it names templates and passes names that
|
|
45
|
+
resolve either way. Nothing to change in a host.
|
|
46
|
+
- **`import design-actions` works again.** A message edit shipped in 1.0.0 put backticks
|
|
47
|
+
inside a template literal, so the script stopped parsing and every
|
|
48
|
+
`npx hippocampus import design-actions` failed with a SyntaxError. Once it
|
|
49
|
+
loaded, it also refused to write on a newly initialised project, because its
|
|
50
|
+
pre-write check read the source files directly instead of the way `validate`
|
|
51
|
+
does. Both are fixed, and a test now checks that every CLI script parses.
|
|
52
|
+
- **Skill descriptions say what each skill is not for.** `create-journey-from-scenario`
|
|
53
|
+
and `add-scenario` claimed "build, draft or map a user journey" and "write a
|
|
54
|
+
scenario", the same words a project's own journey and scenario skills use, so an
|
|
55
|
+
agent could pick either. Both now say they write knowledge-base records and name
|
|
56
|
+
what they are not for. `SKILL-FORMAT.md` asks for the same wherever two skills
|
|
57
|
+
could fire on the same words. Run `npx hippocampus skills install` after upgrading
|
|
58
|
+
to pick up the new descriptions.
|
|
59
|
+
|
|
3
60
|
## 2.8.0
|
|
4
61
|
|
|
5
62
|
The knowledge model and the viewer follow the human-centred design cycle
|
|
@@ -46,9 +103,13 @@ so a 2.7 knowledge base loads unchanged. Old viewer URLs are unchanged.
|
|
|
46
103
|
round's methods and a usability finding's polarity and rating, never rate a
|
|
47
104
|
finding catastrophic, and record which requirements a test evaluated.
|
|
48
105
|
`map-research-to-graph` no longer suggests the backwards `leads-to-action`.
|
|
49
|
-
- **After upgrading, run `npx hippocampus init
|
|
50
|
-
|
|
51
|
-
|
|
106
|
+
- **After upgrading, run `npx hippocampus init`, then
|
|
107
|
+
`npx hippocampus skills install` if your team uses an AI agent.** `init` adds
|
|
108
|
+
the four new collections as empty files to an existing knowledge base,
|
|
109
|
+
because the skills check that the files they read exist; existing files are
|
|
110
|
+
not touched. `skills install` brings in the two new skills and the updated
|
|
111
|
+
ones, leaving alone any your team has edited and naming them. Then
|
|
112
|
+
`npx hippocampus validate` confirms the knowledge base loads.
|
|
52
113
|
- **The guide is grouped by activity**, with new pages on the cycle, quality
|
|
53
114
|
objectives, the context of use, requirements, weighing options, principles and
|
|
54
115
|
usability tests, and the existing recipes placed under the activity they serve.
|
package/bin/hippocampus.js
CHANGED
|
@@ -31,6 +31,8 @@ const COMMANDS = {
|
|
|
31
31
|
'import design-actions': 'import-design-actions.js',
|
|
32
32
|
'promote research': 'promote-research-draft.js',
|
|
33
33
|
'promote project-context': 'promote-project-context-draft.js',
|
|
34
|
+
'draft check': 'check-draft.js',
|
|
35
|
+
'draft promote': 'promote-draft.js',
|
|
34
36
|
'link insight-needs': 'link-insights-to-needs.js',
|
|
35
37
|
'source index': 'index-source-artefacts.js',
|
|
36
38
|
'source audit': 'audit-provenance.js',
|
|
@@ -90,6 +90,25 @@ design action ID a decision points at exists, that statuses are in the permitted
|
|
|
90
90
|
and that no action has two accepted options. It validates the whole knowledge base
|
|
91
91
|
before writing anything, so a bad workbook cannot leave source data broken.
|
|
92
92
|
|
|
93
|
+
### Who and when
|
|
94
|
+
|
|
95
|
+
The importer writes the workbook's people and dates as fields, not prose, so they
|
|
96
|
+
can be checked and shown:
|
|
97
|
+
|
|
98
|
+
| Workbook column | Record field |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| Design Actions `Owner` | design action `owner` |
|
|
101
|
+
| Decisions `Decided by` | decision `decidedBy` |
|
|
102
|
+
| Decisions `Date agreed` | decision `decidedOn` |
|
|
103
|
+
|
|
104
|
+
`Date agreed` may be an ISO date (`2026-11-11`), a UK date (`11/11/2026`) or an
|
|
105
|
+
Excel date cell. A date it cannot read is kept in the decision's `consequence` as
|
|
106
|
+
"Agreed ..." and the importer says so, rather than guessing. A design action's
|
|
107
|
+
`Dependency` stays in its rationale.
|
|
108
|
+
|
|
109
|
+
Where the knowledge base may be shared, put a role in `Owner` and `Decided by`
|
|
110
|
+
rather than a name.
|
|
111
|
+
|
|
93
112
|
## How this traces
|
|
94
113
|
|
|
95
114
|
Relationships point from a dependent to what it relies on, because evidence impact
|
|
@@ -201,6 +201,83 @@ git checkout -- hippocampus/source hippocampus/manifests
|
|
|
201
201
|
After you have committed, use `git revert` on that commit. Either way, the
|
|
202
202
|
draft is still in `hippocampus/imports/research/` to correct and promote again.
|
|
203
203
|
|
|
204
|
+
## Drafts of any other record
|
|
205
|
+
|
|
206
|
+
`promote research` handles one research round. For anything else - decisions
|
|
207
|
+
from a meeting, requirements, assumptions, a finding that challenges an earlier
|
|
208
|
+
call - write a draft in the general format and use `draft check` and
|
|
209
|
+
`draft promote`. They work the same way for every record type.
|
|
210
|
+
|
|
211
|
+
### The draft format
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"draft": {
|
|
216
|
+
"title": "Decisions from the 11 November playback",
|
|
217
|
+
"createdOn": "2026-11-12",
|
|
218
|
+
"summary": "Two options weighed for the medications drawer.",
|
|
219
|
+
"after": ["hippocampus/inbox/2026-11-11-playback-round.draft.json"],
|
|
220
|
+
"reviewNote": "2026-11-12-playback-decisions.review.md",
|
|
221
|
+
"draftedBy": "Interaction designer"
|
|
222
|
+
},
|
|
223
|
+
"records": {
|
|
224
|
+
"decisions": [ { "id": "meds-drawer-grouped", "title": "...", "status": "proposed", "decision": "...", "consequence": "..." } ],
|
|
225
|
+
"relationships": [ { "id": "meds-drawer-grouped-rests-on-gp-codes", "type": "rests-on", "from": "meds-drawer-grouped", "to": "gp-codes-are-consistent" } ]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- `records` is keyed by collection name, the same names as the files in
|
|
231
|
+
`hippocampus/source/` (`decisions`, `requirements`, `assumptions`,
|
|
232
|
+
`insights`, `relationships` and so on). Each record is checked against the
|
|
233
|
+
same schema as the source file it will join.
|
|
234
|
+
- `after` lists drafts that must be promoted first, because this one links to
|
|
235
|
+
their records. A listed draft counts as promoted once it is in the promotion
|
|
236
|
+
manifest, or once every record in it is already in the knowledge base.
|
|
237
|
+
- `reviewNote` names the markdown file the reviewer works in. Without it, a
|
|
238
|
+
`.review.md` beside the draft is used if there is one.
|
|
239
|
+
- `draftedBy` is who wrote the draft, a person or a role.
|
|
240
|
+
|
|
241
|
+
### Check it
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npx hippocampus draft check --draft hippocampus/inbox/<name>.draft.json
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
It changes nothing in the knowledge base. It checks each record, looks for ids
|
|
248
|
+
already in use, checks `after`, and then validates the whole knowledge base as
|
|
249
|
+
it would be with the draft added. Only problems the draft would cause are
|
|
250
|
+
listed; any the knowledge base already had are mentioned once, separately.
|
|
251
|
+
|
|
252
|
+
It writes what it found into the review note, between
|
|
253
|
+
`<!-- hippocampus draft check: start -->` and
|
|
254
|
+
`<!-- hippocampus draft check: end -->`. Running it again replaces that block
|
|
255
|
+
and leaves the rest of the note alone. `--note <file>` writes to another file;
|
|
256
|
+
`--no-note` writes nothing. It exits with 1 if there are problems.
|
|
257
|
+
|
|
258
|
+
### Promote it
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npx hippocampus draft promote --draft hippocampus/inbox/<name>.draft.json --reviewer "Clinical safety officer" --dry-run
|
|
262
|
+
npx hippocampus draft promote --draft hippocampus/inbox/<name>.draft.json --reviewer "Clinical safety officer"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
- It runs every check `draft check` does, and refuses if there is a problem.
|
|
266
|
+
- `--reviewer` is required, and must not be the draft's `draftedBy`: a draft is
|
|
267
|
+
not reviewed by the person who wrote it. Use a role where the knowledge base
|
|
268
|
+
may be shared.
|
|
269
|
+
- It adds the records to the source files and records the promotion in
|
|
270
|
+
`hippocampus/manifests/drafts.json`: the draft, its title, when, who reviewed
|
|
271
|
+
it, who drafted it, and how many of each record.
|
|
272
|
+
- If the draft uses something an older Hippocampus cannot read, such as a
|
|
273
|
+
`rests-on` link, it records the version needed in `_meta.json` and says so.
|
|
274
|
+
See [Source model](source-model.md#which-version-a-knowledge-base-needs).
|
|
275
|
+
- Promoting a draft whose records are all already there does nothing and says
|
|
276
|
+
"Already promoted", so running it twice is safe.
|
|
277
|
+
|
|
278
|
+
Then review the change with `git diff hippocampus/source hippocampus/manifests`
|
|
279
|
+
and commit it. To undo, use the same steps as for a research draft.
|
|
280
|
+
|
|
204
281
|
## Related skills
|
|
205
282
|
|
|
206
283
|
- `review-research-import-draft`: an AI agent checks the draft against the
|
package/docs/source-model.md
CHANGED
|
@@ -252,9 +252,11 @@ Do not invent evidence. If a claim is not evidenced, add an assumption instead.
|
|
|
252
252
|
|
|
253
253
|
Files: `research-rounds.json`, `participants.json`, `insights.json`. Their import is described in [Research knowledge graph](research-knowledge-graph.md). Optional fields:
|
|
254
254
|
|
|
255
|
-
- a round's `methods`: a list of `contextual-interview`, `interview`, `observation`, `focus-group`, `user-survey`, `usability-test`, `usability-inspection`, `card-sort`, `preference-test`, `desk-research`, `analytics`, `other`. The method decides which activity page lists the round.
|
|
255
|
+
- a round's `methods`: a list of `contextual-interview`, `interview`, `observation`, `focus-group`, `user-survey`, `usability-test`, `usability-inspection`, `expert-review`, `card-sort`, `preference-test`, `desk-research`, `analytics`, `other`. The method decides which activity page lists the round. `expert-review` is a review by a specialist against what they know, such as a clinical safety review of a screen; it counts as evaluation.
|
|
256
|
+
- a round's `evaluation`: `formative` (to find problems while the design can still change) or `summative` (to show the finished design is safe and usable). IEC 62366-1 asks for both.
|
|
257
|
+
- a participant's `kind`: `research-participant` (the default) or `reviewer`. A reviewer, such as a clinical safety officer, is listed under the round's reviewers and never counted as a user the research heard from.
|
|
256
258
|
- a participant's `userId`: the user group they were recruited as
|
|
257
|
-
- an insight's `polarity` (`problem`, `positive`, `observation`), `rating` (`positive`, `minor`, `major`, `critical`, `catastrophic`), `signedOffBy` (who agreed a catastrophic rating) and `qualityDimension`
|
|
259
|
+
- an insight's `polarity` (`problem`, `positive`, `observation`), `rating` (`positive`, `minor`, `major`, `critical`, `catastrophic`), `signedOffBy` (who agreed a catastrophic rating), `signedOffOn` (the date, `YYYY-MM-DD`) and `qualityDimension`
|
|
258
260
|
|
|
259
261
|
### Quality objectives
|
|
260
262
|
|
|
@@ -299,6 +301,16 @@ Allowed statuses:
|
|
|
299
301
|
- `superseded`
|
|
300
302
|
- `rejected`
|
|
301
303
|
|
|
304
|
+
Optional fields, so a decision says who made it and when:
|
|
305
|
+
|
|
306
|
+
| Field | Notes |
|
|
307
|
+
| --- | --- |
|
|
308
|
+
| `decidedBy` | The person or role who made the call. Prefer a role where the record may be shared. |
|
|
309
|
+
| `decidedOn` | The date it was made, `YYYY-MM-DD` |
|
|
310
|
+
| `owner` | Who carries it out |
|
|
311
|
+
|
|
312
|
+
A design action may also carry an `owner`. See [Design actions and decisions](design-actions-and-decisions.md).
|
|
313
|
+
|
|
302
314
|
### Assumptions
|
|
303
315
|
|
|
304
316
|
File: `hippocampus/source/assumptions.json`
|
|
@@ -343,8 +355,16 @@ Typed links in `relationships.json` point from the record that depends to the re
|
|
|
343
355
|
| `weighed-against` | decision | requirement | `meets`, `partly`, `fails`, `not-assessed` |
|
|
344
356
|
| `applies-principle` | screen, requirement, decision or journey | principle | |
|
|
345
357
|
| `observed-on` | insight | screen | |
|
|
358
|
+
| `rests-on` | design action, decision or requirement | assumption | |
|
|
359
|
+
| `challenged-by` | assumption, decision or requirement | evidence or insight | |
|
|
360
|
+
|
|
361
|
+
A relationship may carry a `note` saying why. Validation checks the From and To of these ten; a link written the wrong way round does not fail on its own, it just stops traversal, so validation catches it instead. The older types are listed in [Research knowledge graph](research-knowledge-graph.md).
|
|
362
|
+
|
|
363
|
+
`rests-on` makes an assumption's reach visible: when it turns out to be wrong, the work resting on it is listed on its page. `challenged-by` records the evidence or finding that calls a record into question, without deleting or overwriting it.
|
|
364
|
+
|
|
365
|
+
### Which version a knowledge base needs
|
|
346
366
|
|
|
347
|
-
|
|
367
|
+
`hippocampus/source/_meta.json` holds the `schemaVersion` and, once a knowledge base uses something an older package cannot read, `requiresPackage`: the lowest version of Hippocampus that understands everything in it. `draft promote` writes it when it adds a newer link type or method, and never lowers it. An older package refuses the knowledge base and says which version to upgrade to, rather than reading it partially. The `rests-on` and `challenged-by` links and the `expert-review` method need 2.9.0.
|
|
348
368
|
|
|
349
369
|
Project context stays outside the graph: it is briefing material, and organisational requirements are where its rules become checkable.
|
|
350
370
|
|
package/docs/start-here.md
CHANGED
|
@@ -191,6 +191,21 @@ prototype, where agents such as GitHub Copilot read them. Run it again after
|
|
|
191
191
|
upgrading Hippocampus; it leaves alone any file your team has edited and tells
|
|
192
192
|
you which.
|
|
193
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
|
+
|
|
194
209
|
## When anything leaves your machine
|
|
195
210
|
|
|
196
211
|
- **The `hippocampus` commands send nothing anywhere.** Importing reads PDFs,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
// Every file a knowledge base is made of, keyed by the name the schema uses.
|
|
5
|
+
// One list, so that validate, the viewer and every promote command read the
|
|
6
|
+
// same set. `promote research` once kept its own shorter list and refused any
|
|
7
|
+
// draft that linked to a requirement, a goal or a principle, because it had
|
|
8
|
+
// never heard of them.
|
|
9
|
+
const COLLECTION_FILES = {
|
|
10
|
+
project: 'project.json',
|
|
11
|
+
projectContext: 'project-context.json',
|
|
12
|
+
users: 'users.json',
|
|
13
|
+
needs: 'needs.json',
|
|
14
|
+
scenarios: 'scenarios.json',
|
|
15
|
+
journeys: 'journeys.json',
|
|
16
|
+
screens: 'screens.json',
|
|
17
|
+
evidence: 'evidence.json',
|
|
18
|
+
decisions: 'decisions.json',
|
|
19
|
+
assumptions: 'assumptions.json',
|
|
20
|
+
researchRounds: 'research-rounds.json',
|
|
21
|
+
participants: 'participants.json',
|
|
22
|
+
insights: 'insights.json',
|
|
23
|
+
designActions: 'design-actions.json',
|
|
24
|
+
goals: 'goals.json',
|
|
25
|
+
qualityObjectives: 'quality-objectives.json',
|
|
26
|
+
requirements: 'requirements.json',
|
|
27
|
+
principles: 'principles.json',
|
|
28
|
+
relationships: 'relationships.json'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The collections that are lists of records with ids, as opposed to the
|
|
32
|
+
// single project and project context objects.
|
|
33
|
+
const RECORD_COLLECTIONS = Object.keys(COLLECTION_FILES)
|
|
34
|
+
.filter((key) => key !== 'project' && key !== 'projectContext')
|
|
35
|
+
|
|
36
|
+
function readCollectionFile (knowledgeSourceDir, key) {
|
|
37
|
+
const filePath = path.join(knowledgeSourceDir, COLLECTION_FILES[key])
|
|
38
|
+
if (!fs.existsSync(filePath)) return []
|
|
39
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Every record id in the knowledge base, whatever its type. A missing file is
|
|
43
|
+
// an empty collection: a freshly initialised project has almost none of them.
|
|
44
|
+
function readAllRecordIds (knowledgeSourceDir) {
|
|
45
|
+
const ids = new Set()
|
|
46
|
+
for (const key of RECORD_COLLECTIONS) {
|
|
47
|
+
if (key === 'relationships') continue
|
|
48
|
+
for (const item of readCollectionFile(knowledgeSourceDir, key)) ids.add(item.id)
|
|
49
|
+
}
|
|
50
|
+
return ids
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { COLLECTION_FILES, RECORD_COLLECTIONS, readCollectionFile, readAllRecordIds }
|
package/lib/consequences.js
CHANGED
|
@@ -301,6 +301,8 @@ function checkConsequences (knowledge, scenarioId, { concerns = STANDING_CONCERN
|
|
|
301
301
|
const distinctive = ownWords.filter((w) => !otherWords.has(w))
|
|
302
302
|
const words = distinctive.length ? distinctive : ownWords
|
|
303
303
|
const participants = (knowledge.participants || []).filter((p) => {
|
|
304
|
+
// A reviewer in an expert review is not research with that user group.
|
|
305
|
+
if (p.kind === 'reviewer') return false
|
|
304
306
|
const role = roleWords(p.role)
|
|
305
307
|
return words.some((w) => role.includes(w))
|
|
306
308
|
})
|
package/lib/create-router.js
CHANGED
|
@@ -33,6 +33,22 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
|
|
|
33
33
|
router.use('/assets', express.static(path.join(packagePaths.assetsDir, 'dist'), { fallthrough: true }))
|
|
34
34
|
router.use('/assets', express.static(path.join(packagePaths.assetsDir, 'javascript'), { fallthrough: true }))
|
|
35
35
|
|
|
36
|
+
// nhsuk-prototype-kit 8.5.2 renders through a view class that joins
|
|
37
|
+
// "views/" onto every name and resolves it against the project root, so
|
|
38
|
+
// `hippocampus/index` became `views/hippocampus/index` and was looked for
|
|
39
|
+
// under the package's views directory as views/views/... - every viewer page
|
|
40
|
+
// was a 500 and `doctor` reported the prototype never started. Under that
|
|
41
|
+
// class the viewer passes `../hippocampus/...`, which the kit's join folds
|
|
42
|
+
// back to `hippocampus/...`. Kits that pass the name through unchanged get
|
|
43
|
+
// it unchanged.
|
|
44
|
+
router.use((req, res, next) => {
|
|
45
|
+
if (kitPrefixesViews(req.app)) {
|
|
46
|
+
const render = res.render.bind(res)
|
|
47
|
+
res.render = (name, ...rest) => render(typeof name === 'string' && name.startsWith('hippocampus/') ? `../${name}` : name, ...rest)
|
|
48
|
+
}
|
|
49
|
+
next()
|
|
50
|
+
})
|
|
51
|
+
|
|
36
52
|
router.use((req, res, next) => {
|
|
37
53
|
res.locals.basePath = basePath
|
|
38
54
|
res.locals.hippocampusAssets = `${basePath}/assets`
|
|
@@ -199,6 +215,7 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
|
|
|
199
215
|
{ key: 'Finding', value: r.polarity },
|
|
200
216
|
{ key: 'Rating', value: r.rating },
|
|
201
217
|
{ key: 'Rating signed off by', value: r.signedOffBy },
|
|
218
|
+
{ key: 'Signed off on', value: r.signedOffOn },
|
|
202
219
|
{ key: 'Quality', value: hcd.DIMENSION_LABELS[r.qualityDimension] },
|
|
203
220
|
{ key: 'Reference', value: r.reference },
|
|
204
221
|
{ key: 'Summary', value: r.summary }
|
|
@@ -240,6 +257,9 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
|
|
|
240
257
|
{ key: 'Status', value: r.status },
|
|
241
258
|
{ key: 'Decision', value: r.decision },
|
|
242
259
|
{ key: 'Consequence', value: r.consequence },
|
|
260
|
+
{ key: 'Decided by', value: r.decidedBy },
|
|
261
|
+
{ key: 'Decided on', value: r.decidedOn },
|
|
262
|
+
{ key: 'Owner', value: r.owner },
|
|
243
263
|
{ key: 'Reference', value: r.reference }
|
|
244
264
|
],
|
|
245
265
|
Screen: (r) => [
|
|
@@ -546,4 +566,23 @@ function uniqueById (items) {
|
|
|
546
566
|
return Object.values(Object.fromEntries(items.map((item) => [item.id, item])))
|
|
547
567
|
}
|
|
548
568
|
|
|
569
|
+
// Asks the host's view class what it does with a name, once per app, rather
|
|
570
|
+
// than reading the kit's version: behaviour is what matters, and a kit that
|
|
571
|
+
// changes it back needs no release here.
|
|
572
|
+
const viewPrefixByApp = new WeakMap()
|
|
573
|
+
function kitPrefixesViews (app) {
|
|
574
|
+
if (!app || typeof app.get !== 'function') return false
|
|
575
|
+
if (viewPrefixByApp.has(app)) return viewPrefixByApp.get(app)
|
|
576
|
+
let prefixed = false
|
|
577
|
+
try {
|
|
578
|
+
const View = app.get('view')
|
|
579
|
+
const probe = new View('hippocampus-probe', { defaultEngine: 'html', engines: {}, root: app.get('views') })
|
|
580
|
+
prefixed = typeof probe.path === 'string' && /^views[\\/]hippocampus-probe/.test(probe.path)
|
|
581
|
+
} catch (error) {
|
|
582
|
+
prefixed = false
|
|
583
|
+
}
|
|
584
|
+
viewPrefixByApp.set(app, prefixed)
|
|
585
|
+
return prefixed
|
|
586
|
+
}
|
|
587
|
+
|
|
549
588
|
module.exports = { createHippocampusRouter }
|
package/lib/hcd-views.js
CHANGED
|
@@ -18,7 +18,9 @@ const CONTEXT_METHODS = new Set([
|
|
|
18
18
|
'contextual-interview', 'interview', 'observation', 'focus-group',
|
|
19
19
|
'user-survey', 'desk-research', 'analytics', 'card-sort'
|
|
20
20
|
])
|
|
21
|
-
|
|
21
|
+
// An expert review evaluates a design too - a clinician judging it rather than
|
|
22
|
+
// users being observed - so its rounds sit with the other evaluations.
|
|
23
|
+
const EVALUATION_METHODS = new Set(['usability-test', 'usability-inspection', 'preference-test', 'expert-review'])
|
|
22
24
|
|
|
23
25
|
const METHOD_LABELS = {
|
|
24
26
|
'contextual-interview': 'Contextual interview',
|
|
@@ -32,6 +34,7 @@ const METHOD_LABELS = {
|
|
|
32
34
|
'preference-test': 'Preference test',
|
|
33
35
|
'desk-research': 'Desk research',
|
|
34
36
|
analytics: 'Analytics',
|
|
37
|
+
'expert-review': 'Expert review',
|
|
35
38
|
other: 'Other'
|
|
36
39
|
}
|
|
37
40
|
|
package/lib/lint-knowledge.js
CHANGED
|
@@ -180,7 +180,7 @@ function lintKnowledge (knowledge) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
const usabilityRounds = new Set((knowledge.researchRounds || [])
|
|
183
|
-
.filter((round) => (round.methods || []).some((m) => m === 'usability-test' || m === 'usability-inspection'))
|
|
183
|
+
.filter((round) => (round.methods || []).some((m) => m === 'usability-test' || m === 'usability-inspection' || m === 'expert-review'))
|
|
184
184
|
.map((round) => round.id))
|
|
185
185
|
const unratedFindings = (knowledge.insights || []).filter((insight) => usabilityRounds.has(insight.roundId) && !insight.polarity && !insight.rating)
|
|
186
186
|
if (unratedFindings.length) {
|