@hippo-digital/hippocampus 1.0.0-rc.7 → 1.0.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +114 -3
  2. package/README.md +36 -0
  3. package/assets/dist/hippocampus.css +1 -1
  4. package/assets/hippocampus.scss +994 -133
  5. package/assets/javascript/blueprint.js +21 -0
  6. package/assets/javascript/trace.js +54 -0
  7. package/bin/hippocampus.js +9 -3
  8. package/index.js +2 -1
  9. package/lib/breadcrumb.js +80 -0
  10. package/lib/create-router.js +246 -6
  11. package/lib/discover-projects.js +5 -0
  12. package/lib/filter.js +81 -0
  13. package/lib/flow-map.js +214 -0
  14. package/lib/lint-knowledge.js +31 -0
  15. package/lib/load-knowledge.js +335 -34
  16. package/lib/record-links.js +51 -0
  17. package/lib/schema-version.js +1 -1
  18. package/lib/templates.js +174 -0
  19. package/package.json +1 -1
  20. package/scripts/doctor.js +10 -0
  21. package/scripts/import-design-actions.js +2 -2
  22. package/scripts/import-research-batch.js +1 -1
  23. package/scripts/import-research-deck.js +1 -1
  24. package/scripts/lib/make-blueprint-template.py +107 -0
  25. package/scripts/promote-project-context-draft.js +22 -3
  26. package/scripts/promote-research-draft.js +7 -2
  27. package/scripts/smoke-routes.js +19 -0
  28. package/scripts/sync-project-context.js +9 -5
  29. package/scripts/sync-research-artefacts.js +9 -5
  30. package/templates/service-blueprint.xlsx +0 -0
  31. package/views/hippocampus/_layout.html +116 -3
  32. package/views/hippocampus/blueprint-classic.html +0 -1
  33. package/views/hippocampus/blueprint.html +0 -1
  34. package/views/hippocampus/components/_blueprint-cell.njk +6 -3
  35. package/views/hippocampus/components/_blueprint-controls.njk +2 -1
  36. package/views/hippocampus/components/_breadcrumb.njk +29 -0
  37. package/views/hippocampus/components/_connections.njk +38 -0
  38. package/views/hippocampus/components/_filters.njk +56 -0
  39. package/views/hippocampus/components/_journey-step.njk +11 -7
  40. package/views/hippocampus/components/_screen-preview.njk +41 -0
  41. package/views/hippocampus/doc.html +0 -1
  42. package/views/hippocampus/docs.html +67 -6
  43. package/views/hippocampus/evidence-impact.html +66 -33
  44. package/views/hippocampus/graph.html +137 -31
  45. package/views/hippocampus/handover-empty.html +0 -1
  46. package/views/hippocampus/handover.html +0 -1
  47. package/views/hippocampus/index.html +102 -13
  48. package/views/hippocampus/journey-flow.html +0 -1
  49. package/views/hippocampus/journey.html +21 -6
  50. package/views/hippocampus/journeys.html +63 -0
  51. package/views/hippocampus/project.html +19 -2
  52. package/views/hippocampus/record.html +33 -0
  53. package/views/hippocampus/research.html +14 -2
  54. package/views/hippocampus/route-review.html +0 -1
  55. package/views/hippocampus/scenarios.html +21 -3
  56. package/views/hippocampus/screens.html +45 -0
  57. package/views/hippocampus/trace.html +35 -22
  58. package/views/hippocampus/user-needs.html +55 -19
  59. package/views/hippocampus/user.html +131 -79
  60. package/views/hippocampus/users.html +33 -19
@@ -1,32 +1,68 @@
1
1
  {% extends "hippocampus/_layout.html" %}
2
2
  {% from "hippocampus/components/_empty-state.njk" import emptyState %}
3
+ {% from "hippocampus/components/_filters.njk" import findBar, noMatches %}
3
4
 
4
5
  {% block pageTitle %}User needs{% endblock %}
5
6
 
6
7
  {% block content %}
7
- <a class="nhsuk-back-link" href="{{ basePath }}">Back to knowledge base</a>
8
8
  <h1>User needs</h1>
9
- <div class="knowledge-list">
10
- {% if knowledge.needs.length %}
11
- {% for need in knowledge.needs %}
12
- {% set user = knowledge.index.users[need.userId] %}
13
- <article class="knowledge-card">
14
- <p class="knowledge-card__meta">{{ user.label }} · {{ need.priority }} priority</p>
15
- <h2 class="nhsuk-heading-s">{{ need.statement }}</h2>
16
- <h3 class="nhsuk-heading-xs">Evidence</h3>
17
- <ul class="nhsuk-list">
18
- {% for evidenceId in need.evidenceIds %}
19
- {% set evidence = knowledge.index.evidence[evidenceId] %}
20
- <li>{{ evidence.title }}</li>
21
- {% endfor %}
22
- </ul>
23
- </article>
24
- {% endfor %}
9
+
10
+ {% if knowledge.needs.length %}
11
+ {{ findBar(
12
+ basePath + "/user-needs",
13
+ "Search user needs",
14
+ "Any words from the need. Searching search postcode finds only needs containing both words.",
15
+ query, facets, needs.length, knowledge.needs.length,
16
+ [1] if hasFilters else [],
17
+ basePath + "/user-needs"
18
+ ) }}
19
+
20
+ {#
21
+ The same card the persona pages use, in the same grid.
22
+
23
+ This was 132 full-width blocks in one column - the longest scroll in the
24
+ viewer, and the one page where you are most often looking for a need
25
+ rather than reading one. Three columns of the card that already exists
26
+ elsewhere, so a need looks the same wherever you meet it.
27
+
28
+ Wide columns rather than the narrow grid the users list uses: a need is a
29
+ whole user story, and at four columns it sets as a thin ribbon of text.
30
+ #}
31
+ {% if needs.length %}
32
+ <div class="knowledge-card-grid knowledge-card-grid--wide knowledge-card-grid--fill">
33
+ {% for need in needs %}
34
+ {% set user = knowledge.index.users[need.userId] %}
35
+ <article class="knowledge-card knowledge-card--compact">
36
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-1">
37
+ <a href="{{ basePath }}/users/{{ user.id }}">{{ user.label }}</a> · {{ need.priority }} priority
38
+ </p>
39
+ <h2 class="knowledge-card__statement">
40
+ <a href="{{ basePath }}/needs/{{ need.id }}">{{ need.statement }}</a>
41
+ </h2>
42
+ {% if need.evidenceIds.length %}
43
+ <ul class="nhsuk-list knowledge-linked-list">
44
+ {% for evidenceId in need.evidenceIds %}
45
+ {% set evidence = knowledge.index.evidence[evidenceId] %}
46
+ {% if evidence %}
47
+ <li>
48
+ <a href="{{ basePath }}/evidence/{{ evidence.id }}/impact">{{ evidence.title }}</a>
49
+ <span class="knowledge-confidence-tag knowledge-confidence-tag--{{ evidence.confidence }}">{{ evidence.confidence }} confidence</span>
50
+ </li>
51
+ {% endif %}
52
+ {% endfor %}
53
+ </ul>
54
+ {% else %}
55
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-0">No evidence linked</p>
56
+ {% endif %}
57
+ </article>
58
+ {% endfor %}
59
+ </div>
60
+ {% else %}
61
+ {{ noMatches(basePath + "/user-needs", "user needs") }}
62
+ {% endif %}
25
63
  {% else %}
26
64
  {{ emptyState("No user needs yet",
27
65
  "A need says who wants what, and why - the \"so that\" clause is what stops two users' needs being merged into one.",
28
66
  "Add them with the add-user-needs skill once there is at least one user.") }}
29
67
  {% endif %}
30
- </div>
31
68
  {% endblock %}
32
-
@@ -4,7 +4,6 @@
4
4
  {% block pageTitle %}{{ userGraph.user.label }}{% endblock %}
5
5
 
6
6
  {% block content %}
7
- <a class="nhsuk-back-link" href="{{ basePath }}/users">Back to users</a>
8
7
 
9
8
  <div class="nhsuk-grid-row">
10
9
  <div class="nhsuk-grid-column-two-thirds">
@@ -14,40 +13,6 @@
14
13
  </div>
15
14
  </div>
16
15
 
17
- <section class="knowledge-section">
18
- <h2>How this interlinks</h2>
19
- <p>This page resolves links from the source data: user to scenarios, scenarios to needs, needs to evidence, and any journey, screen or decision links that already exist.</p>
20
-
21
- <div class="knowledge-graph-summary">
22
- <div><strong>{{ userGraph.scenarios.length }}</strong><span>Scenarios</span></div>
23
- <div><strong>{{ userGraph.needs.length }}</strong><span>User needs</span></div>
24
- <div><strong>{{ userGraph.evidence.length }}</strong><span>Evidence items</span></div>
25
- <div><strong>{{ userGraph.journeys.length }}</strong><span>Journeys</span></div>
26
- <div><strong>{{ userGraph.screens.length }}</strong><span>Screens</span></div>
27
- <div><strong>{{ userGraph.decisions.length }}</strong><span>Decisions</span></div>
28
- </div>
29
-
30
- <div class="knowledge-graph">
31
- {% for node in userGraph.graph.nodes %}
32
- <article class="knowledge-graph__node knowledge-graph__node--{{ node.type | lower }}">
33
- <strong>{{ node.type }}</strong>
34
- <span>{{ node.label }}</span>
35
- </article>
36
- {% endfor %}
37
- </div>
38
-
39
- <h3 class="nhsuk-heading-s">Link map</h3>
40
- <ul class="nhsuk-list knowledge-edge-list">
41
- {% for edge in userGraph.graph.edges %}
42
- <li>
43
- <strong>{{ edge.fromLabel }}</strong>
44
- <span>{{ edge.label }}</span>
45
- <strong>{{ edge.toLabel }}</strong>
46
- </li>
47
- {% endfor %}
48
- </ul>
49
- </section>
50
-
51
16
  <section class="knowledge-section">
52
17
  <h2>Responsibilities and access needs</h2>
53
18
  <div class="nhsuk-grid-row">
@@ -64,59 +29,101 @@
64
29
 
65
30
  <section class="knowledge-section">
66
31
  <h2>Scenarios</h2>
67
- {% for scenario in userGraph.scenarios %}
68
- <article class="knowledge-linked-block">
69
- <span class="nhsuk-tag nhsuk-tag--{{ 'red' if scenario.riskLevel == 'high' else 'yellow' }}">{{ scenario.riskLevel }} risk</span>
70
- <h3>{{ scenario.title }}</h3>
71
- <p><strong>Trigger:</strong> {{ scenario.trigger }}</p>
72
- <p>{{ scenario.context }}</p>
73
-
74
- {% if scenario.locationSearch %}
75
- <div class="knowledge-linked-block__detail">
76
- <h4 class="nhsuk-heading-s">Location search intent</h4>
77
- <p>{{ scenario.locationSearch.primaryIntent }}</p>
78
- <p><strong>Scope:</strong> {{ scenario.locationSearch.searchScope }}</p>
79
-
80
- <div class="nhsuk-grid-row">
81
- <div class="nhsuk-grid-column-one-half">
82
- <h5 class="nhsuk-heading-xs">Available information</h5>
32
+ {#
33
+ Cards, not full-width blocks.
34
+
35
+ A block here ran to a 70ch measure inside a section that spans the page,
36
+ so half the width was empty while the linked needs below it restated -
37
+ in full, unlinked - statements that are cards in the very next section.
38
+ The needs are links now, at list size: which needs a scenario covers is
39
+ the point, and reading them is what their own pages are for.
40
+
41
+ A scenario has no page of its own, so anything that will not fit here has
42
+ to stay here. The location-search detail is the only part long enough to
43
+ matter, and it goes behind a disclosure rather than off the page.
44
+ #}
45
+ <div class="knowledge-card-grid knowledge-card-grid--wide">
46
+ {% for scenario in userGraph.scenarios %}
47
+ <article class="knowledge-card knowledge-card--compact">
48
+ <p class="knowledge-card__tags">
49
+ <span class="nhsuk-tag nhsuk-tag--{{ 'red' if scenario.riskLevel == 'high' else 'yellow' }}">{{ scenario.riskLevel }} risk</span>
50
+ </p>
51
+ <h3 class="nhsuk-heading-s nhsuk-u-margin-bottom-2">{{ scenario.title }}</h3>
52
+
53
+ <p class="nhsuk-body-s"><strong>Trigger:</strong> {{ scenario.trigger }}</p>
54
+ <p class="nhsuk-body-s">{{ scenario.context }}</p>
55
+
56
+ {% if scenario.locationSearch %}
57
+ <details class="nhsuk-details knowledge-card__details">
58
+ <summary class="nhsuk-details__summary">
59
+ <span class="nhsuk-details__summary-text">Location search intent</span>
60
+ </summary>
61
+ <div class="nhsuk-details__text">
62
+ <p class="nhsuk-body-s">{{ scenario.locationSearch.primaryIntent }}</p>
63
+ <p class="nhsuk-body-s"><strong>Scope:</strong> {{ scenario.locationSearch.searchScope }}</p>
64
+ <h4 class="nhsuk-heading-xs nhsuk-u-margin-bottom-1">Available information</h4>
83
65
  {{ bulletList(scenario.locationSearch.availableInformation) }}
84
- </div>
85
- <div class="nhsuk-grid-column-one-half">
86
- <h5 class="nhsuk-heading-xs">Outcomes</h5>
66
+ <h4 class="nhsuk-heading-xs nhsuk-u-margin-bottom-1">Outcomes</h4>
87
67
  {{ bulletList(scenario.locationSearch.outcomes) }}
88
68
  </div>
89
- </div>
90
- </div>
91
- {% endif %}
69
+ </details>
70
+ {% endif %}
92
71
 
93
- <h4 class="nhsuk-heading-s">Linked needs</h4>
94
- <ul class="nhsuk-list nhsuk-list--bullet">
95
- {% for needId in scenario.needIds %}
96
- {% set need = knowledge.index.needs[needId] %}
97
- <li>{{ need.statement }}</li>
98
- {% endfor %}
99
- </ul>
100
- </article>
101
- {% else %}
102
- <p class="knowledge-muted">No scenarios linked yet.</p>
103
- {% endfor %}
72
+ {% if scenario.needIds.length %}
73
+ <h4 class="nhsuk-heading-xs nhsuk-u-margin-bottom-1">Needs it covers</h4>
74
+ <ul class="nhsuk-list knowledge-linked-list">
75
+ {% for needId in scenario.needIds %}
76
+ {% set need = knowledge.index.needs[needId] %}
77
+ {% if need %}
78
+ <li><a href="{{ basePath }}/needs/{{ need.id }}">{{ need.statement }}</a></li>
79
+ {% endif %}
80
+ {% endfor %}
81
+ </ul>
82
+ {% endif %}
83
+ </article>
84
+ {% else %}
85
+ <p class="knowledge-muted">No scenarios linked yet.</p>
86
+ {% endfor %}
87
+ </div>
104
88
  </section>
105
89
 
90
+ {#
91
+ Small cards in a grid, like the users list. A persona here carries up to
92
+ seventeen needs, and full-width blocks made that a scroll rather than a set
93
+ you can see. Each statement links to the need's own page, which is where
94
+ its scenarios, screens and research live - the card's job is to let you
95
+ pick one, not to hold everything about it.
96
+ #}
106
97
  <section class="knowledge-section">
107
98
  <h2>User needs and evidence</h2>
108
- <div class="knowledge-list">
99
+ <div class="knowledge-card-grid">
109
100
  {% for need in userGraph.needs %}
110
- <article class="knowledge-card">
111
- <p class="knowledge-card__meta">{{ need.priority }} priority</p>
112
- <h3 class="nhsuk-heading-s">{{ need.statement }}</h3>
113
- <h4 class="nhsuk-heading-xs">Evidence</h4>
114
- <ul class="nhsuk-list">
115
- {% for evidenceId in need.evidenceIds %}
116
- {% set evidence = knowledge.index.evidence[evidenceId] %}
117
- <li>{{ evidence.title }} <span class="knowledge-confidence-tag knowledge-confidence-tag--{{ evidence.confidence }}">{{ evidence.confidence }} confidence</span></li>
118
- {% endfor %}
119
- </ul>
101
+ <article class="knowledge-card knowledge-card--compact">
102
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-1">{{ need.priority }} priority</p>
103
+ {#
104
+ Heading-sized text is wrong for these. A need is written as a full
105
+ user story - "As an ED consultant, I need ... so that ..." - and at
106
+ heading size, underlined, a card of them is a wall. It is still a
107
+ heading for structure; it just does not shout.
108
+ #}
109
+ <h3 class="knowledge-card__statement">
110
+ <a href="{{ basePath }}/needs/{{ need.id }}">{{ need.statement }}</a>
111
+ </h3>
112
+ {% if need.evidenceIds.length %}
113
+ <ul class="nhsuk-list knowledge-linked-list">
114
+ {% for evidenceId in need.evidenceIds %}
115
+ {% set evidence = knowledge.index.evidence[evidenceId] %}
116
+ {% if evidence %}
117
+ <li>
118
+ <a href="{{ basePath }}/evidence/{{ evidence.id }}/impact">{{ evidence.title }}</a>
119
+ <span class="knowledge-confidence-tag knowledge-confidence-tag--{{ evidence.confidence }}">{{ evidence.confidence }} confidence</span>
120
+ </li>
121
+ {% endif %}
122
+ {% endfor %}
123
+ </ul>
124
+ {% else %}
125
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-0">No evidence linked</p>
126
+ {% endif %}
120
127
  </article>
121
128
  {% endfor %}
122
129
  </div>
@@ -154,4 +161,49 @@
154
161
  <p class="knowledge-muted">No journey or prototype screen has been generated for this user yet. The scenario, needs and evidence are ready to drive that next slice.</p>
155
162
  {% endif %}
156
163
  </section>
164
+
165
+ {#
166
+ Last, not first.
167
+
168
+ It opened the page, and it is the third place the same records appear -
169
+ every chip and every edge below is also a card in one of the sections
170
+ above, with the context that makes it mean something. What a flat list of
171
+ triples cannot show is the shape of the connections, which is the only
172
+ thing a graph view is for; /graph and /trace do that properly. The counts
173
+ are worth having, so the section stays - at the end, where a summary
174
+ belongs rather than in front of the thing it summarises.
175
+ #}
176
+ <section class="knowledge-section">
177
+ <h2>How this interlinks</h2>
178
+ <p>This page resolves links from the source data: user to scenarios, scenarios to needs, needs to evidence, and any journey, screen or decision links that already exist.</p>
179
+
180
+ <div class="knowledge-graph-summary">
181
+ <div><strong>{{ userGraph.scenarios.length }}</strong><span>Scenarios</span></div>
182
+ <div><strong>{{ userGraph.needs.length }}</strong><span>User needs</span></div>
183
+ <div><strong>{{ userGraph.evidence.length }}</strong><span>Evidence items</span></div>
184
+ <div><strong>{{ userGraph.journeys.length }}</strong><span>Journeys</span></div>
185
+ <div><strong>{{ userGraph.screens.length }}</strong><span>Screens</span></div>
186
+ <div><strong>{{ userGraph.decisions.length }}</strong><span>Decisions</span></div>
187
+ </div>
188
+
189
+ <div class="knowledge-graph">
190
+ {% for node in userGraph.graph.nodes %}
191
+ <article class="knowledge-graph__node knowledge-graph__node--{{ node.type | lower }}">
192
+ <strong>{{ node.type }}</strong>
193
+ <span>{{ node.label }}</span>
194
+ </article>
195
+ {% endfor %}
196
+ </div>
197
+
198
+ <h3 class="nhsuk-heading-s">Link map</h3>
199
+ <ul class="nhsuk-list knowledge-edge-list">
200
+ {% for edge in userGraph.graph.edges %}
201
+ <li>
202
+ <strong>{{ edge.fromLabel }}</strong>
203
+ <span>{{ edge.label }}</span>
204
+ <strong>{{ edge.toLabel }}</strong>
205
+ </li>
206
+ {% endfor %}
207
+ </ul>
208
+ </section>
157
209
  {% endblock %}
@@ -1,29 +1,43 @@
1
1
  {% extends "hippocampus/_layout.html" %}
2
- {% from "hippocampus/components/_list.njk" import bulletList %}
3
2
  {% from "hippocampus/components/_empty-state.njk" import emptyState %}
4
3
 
5
4
  {% block pageTitle %}Users{% endblock %}
6
5
 
7
6
  {% block content %}
8
- <a class="nhsuk-back-link" href="{{ basePath }}">Back to knowledge base</a>
9
7
  <h1>Users</h1>
10
- {% if knowledge.users.length %}
11
- {% for user in knowledge.users %}
12
- <section class="knowledge-section">
13
- <h2><a href="{{ basePath }}/users/{{ user.id }}">{{ user.label }}</a></h2>
14
- <p>{{ user.description }}</p>
15
- <div class="nhsuk-grid-row">
16
- <div class="nhsuk-grid-column-one-half">
17
- <h3 class="nhsuk-heading-s">Responsibilities</h3>
18
- {{ bulletList(user.responsibilities) }}
19
- </div>
20
- <div class="nhsuk-grid-column-one-half">
21
- <h3 class="nhsuk-heading-s">Access needs</h3>
22
- {{ bulletList(user.accessNeeds) }}
23
- </div>
24
- </div>
25
- </section>
26
- {% endfor %}
8
+ <p class="nhsuk-lede-text">
9
+ Who the service is for. Every need, scenario and screen hangs off one of
10
+ these.
11
+ </p>
12
+
13
+ {% if users.length %}
14
+ {#
15
+ Small cards in a grid, rather than a full-width block each.
16
+
17
+ Each block used to carry the person's responsibilities and access needs in
18
+ two columns, which made the page a scroll of near-identical lists: every
19
+ persona has three or four of each, so the detail that was meant to
20
+ distinguish them was the detail that buried them. Fourteen users ran to
21
+ several screens and you could not see the set.
22
+
23
+ The lists have not gone anywhere - they are on the person's own page,
24
+ under "Responsibilities and access needs", which is where you read one
25
+ rather than compare them.
26
+ #}
27
+ <div class="knowledge-card-grid">
28
+ {% for user in users %}
29
+ <article class="knowledge-card knowledge-card--compact">
30
+ <h2 class="nhsuk-heading-s nhsuk-u-margin-bottom-1">
31
+ <a href="{{ basePath }}/users/{{ user.id }}">{{ user.label }}</a>
32
+ </h2>
33
+ <p class="nhsuk-body-s">{{ user.description }}</p>
34
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-0">
35
+ {{ user.needCount }} need{% if user.needCount != 1 %}s{% endif %}
36
+ · {{ user.scenarioCount }} scenario{% if user.scenarioCount != 1 %}s{% endif %}
37
+ </p>
38
+ </article>
39
+ {% endfor %}
40
+ </div>
27
41
  {% else %}
28
42
  {{ emptyState("No users yet",
29
43
  "Users are who the service is for. Every need, scenario and screen hangs off one.",