@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
@@ -6,7 +6,6 @@
6
6
  {% block pageTitle %}{{ blueprint.meta.journeyTitle }} blueprint{% endblock %}
7
7
 
8
8
  {% block content %}
9
- <a class="nhsuk-back-link" href="{{ basePath }}/journeys/{{ blueprint.journey.id }}">Back to journey</a>
10
9
  <span class="nhsuk-caption-l">Stacked service blueprint</span>
11
10
  <h1>{{ blueprint.meta.journeyTitle }}</h1>
12
11
  <p class="nhsuk-lede-text">{{ blueprint.meta.scenarioTitle }}</p>
@@ -1,13 +1,16 @@
1
+ {% from "hippocampus/components/_screen-preview.njk" import screenPreview %}
1
2
  {% from "hippocampus/components/_list.njk" import bulletList %}
2
3
 
3
4
  {% macro renderCell(step, laneKey) %}
4
5
  {% if laneKey == "screens" %}
5
6
  {% if step.screens.length %}
6
- <ul class="nhsuk-list">
7
+ {# The screens lane is where a reader is most often trying to picture the
8
+ screen, and a title is the one thing that does not help them do it. #}
9
+ <div class="knowledge-screen-preview-row">
7
10
  {% for screen in step.screens %}
8
- <li><a href="{{ screen.route }}">{{ screen.title }}</a></li>
11
+ {{ screenPreview(screen, "inline") }}
9
12
  {% endfor %}
10
- </ul>
13
+ </div>
11
14
  {% else %}
12
15
  <span class="knowledge-muted">No linked screens</span>
13
16
  {% endif %}
@@ -1,6 +1,7 @@
1
1
  {% macro renderBlueprintControls(lanes) %}
2
2
  <div class="knowledge-blueprint-controls" data-blueprint-controls>
3
- <div class="knowledge-blueprint-controls__lenses" role="group" aria-label="Blueprint lens presets">
3
+ <div class="knowledge-blueprint-controls__lenses" role="group" aria-labelledby="blueprint-lens-legend">
4
+ <p class="knowledge-blueprint-controls__legend" id="blueprint-lens-legend">Show a view for</p>
4
5
  <button type="button" class="knowledge-lens-btn" data-lens="all" aria-pressed="true">All</button>
5
6
  <button type="button" class="knowledge-lens-btn" data-lens="executive" aria-pressed="false">Executive</button>
6
7
  <button type="button" class="knowledge-lens-btn" data-lens="technical" aria-pressed="false">Technical</button>
@@ -0,0 +1,29 @@
1
+ {# The trail, on every page.
2
+
3
+ NHS.UK's own breadcrumb component renders ancestors only and has no crumb
4
+ for the page you are on, so this uses its classes with a final, unlinked
5
+ crumb carrying aria-current. That is the part that answers "where am I",
6
+ which a row of ancestors alone does not. #}
7
+ {# On the overview there is one crumb and it is the page you are on, so the
8
+ trail says nothing a sighted reader cannot see from the h1 below it. It stays
9
+ in the markup rather than being dropped: a screen reader user arriving by
10
+ landmark still gets told where this page sits, and a breadcrumb that exists
11
+ on every page but one is a landmark that disappears without explanation. #}
12
+ {% macro breadcrumb(items) %}
13
+ {% if items.length %}
14
+ {% set soleCrumb = items.length < 2 %}
15
+ <nav class="nhsuk-breadcrumb knowledge-breadcrumb{% if soleCrumb %} knowledge-breadcrumb--quiet nhsuk-u-visually-hidden{% endif %}" aria-label="Breadcrumb">
16
+ <ol class="nhsuk-breadcrumb__list">
17
+ {% for item in items %}
18
+ <li class="nhsuk-breadcrumb__list-item">
19
+ {% if item.href and not loop.last %}
20
+ <a class="nhsuk-breadcrumb__link" href="{{ item.href }}">{{ item.text }}</a>
21
+ {% else %}
22
+ <span aria-current="page">{{ item.text }}</span>
23
+ {% endif %}
24
+ </li>
25
+ {% endfor %}
26
+ </ol>
27
+ </nav>
28
+ {% endif %}
29
+ {% endmacro %}
@@ -0,0 +1,38 @@
1
+ {# The connections panel every detail page shares.
2
+
3
+ Each group says what the relationship means from this record's point of
4
+ view, so a reader knows why a thing is listed rather than inferring it.
5
+ A record type with no page of its own renders as plain text - a dead link
6
+ is worse than an honest one. #}
7
+ {% macro connections(groups) %}
8
+ {% if groups.length %}
9
+ {# A grid rather than fixed halves: a record with one group left half the
10
+ row empty, and one with three wrapped a lone third onto its own line. #}
11
+ <div class="knowledge-card-grid knowledge-card-grid--wide">
12
+ {% for group in groups %}
13
+ <div>
14
+ <section class="knowledge-section nhsuk-u-margin-bottom-0">
15
+ <h2 class="nhsuk-heading-s">{{ group.label }} <span class="nhsuk-u-font-weight-normal nhsuk-u-secondary-text-color">({{ group.items.length }})</span></h2>
16
+ <ul class="nhsuk-list nhsuk-list--bullet knowledge-connection-list">
17
+ {% for item in group.items %}
18
+ <li>
19
+ {% if item.href %}
20
+ <a href="{{ item.href }}">{{ item.label }}</a>
21
+ {% else %}
22
+ {{ item.label }}
23
+ {% endif %}
24
+ <span class="nhsuk-u-secondary-text-color nhsuk-body-s">{{ item.type }}</span>
25
+ </li>
26
+ {% endfor %}
27
+ </ul>
28
+ </section>
29
+ </div>
30
+ {% endfor %}
31
+ </div>
32
+ {% else %}
33
+ <div class="nhsuk-inset-text">
34
+ <p>This record has no connections recorded. That is usually a gap in the
35
+ graph rather than a fact about the record.</p>
36
+ </div>
37
+ {% endif %}
38
+ {% endmacro %}
@@ -0,0 +1,56 @@
1
+ {# The find bar every list page shares.
2
+
3
+ A plain GET form, so it works without JavaScript, the browser remembers it,
4
+ and a filtered list has a URL worth sending to somebody. The result count is
5
+ always shown: with 132 records, "showing 9" is the difference between
6
+ trusting the page and wondering what it is hiding. #}
7
+
8
+ {% macro findBar(action, searchLabel, searchHint, query, facets, shown, total, activeFilters, clearHref) %}
9
+ <form class="knowledge-find" method="get" action="{{ action }}" role="search">
10
+ <div class="nhsuk-form-group nhsuk-u-margin-bottom-3">
11
+ <label class="nhsuk-label" for="find-q">{{ searchLabel }}</label>
12
+ {% if searchHint %}<div class="nhsuk-hint" id="find-q-hint">{{ searchHint }}</div>{% endif %}
13
+ <input class="nhsuk-input" id="find-q" name="q" type="search"
14
+ value="{{ query.q or '' }}"
15
+ {% if searchHint %}aria-describedby="find-q-hint"{% endif %}>
16
+ </div>
17
+
18
+ {% for facet in facets %}
19
+ {% if facet.options.length > 1 %}
20
+ <div class="nhsuk-form-group nhsuk-u-margin-bottom-3">
21
+ <label class="nhsuk-label" for="find-{{ facet.key }}">{{ facet.label }}</label>
22
+ <select class="nhsuk-select" id="find-{{ facet.key }}" name="{{ facet.key }}">
23
+ <option value="">All</option>
24
+ {% for option in facet.options %}
25
+ <option value="{{ option.value }}" {% if option.selected %}selected{% endif %}>
26
+ {{ option.label }} ({{ option.count }})
27
+ </option>
28
+ {% endfor %}
29
+ </select>
30
+ </div>
31
+ {% endif %}
32
+ {% endfor %}
33
+
34
+ <button class="nhsuk-button nhsuk-u-margin-bottom-3" type="submit">Apply</button>
35
+ {% if activeFilters.length %}
36
+ <a class="nhsuk-u-margin-left-3" href="{{ clearHref }}">Clear all</a>
37
+ {% endif %}
38
+ </form>
39
+
40
+ <p class="nhsuk-body-s knowledge-find__count" role="status">
41
+ {% if shown == total %}
42
+ Showing all {{ total }}
43
+ {% else %}
44
+ Showing <strong>{{ shown }}</strong> of {{ total }}
45
+ {% endif %}
46
+ </p>
47
+ {% endmacro %}
48
+
49
+ {# Shown instead of the list when nothing matches. Says what to do next rather
50
+ than only what went wrong. #}
51
+ {% macro noMatches(clearHref, what) %}
52
+ <div class="nhsuk-inset-text">
53
+ <h2 class="nhsuk-heading-s">No {{ what }} match those filters</h2>
54
+ <p>Try fewer words, or <a href="{{ clearHref }}">clear all filters</a>.</p>
55
+ </div>
56
+ {% endmacro %}
@@ -1,15 +1,19 @@
1
+ {% from "hippocampus/components/_screen-preview.njk" import screenPreview %}
1
2
  {% macro journeyStep(step, knowledge) %}
2
3
  <li class="knowledge-timeline__item">
3
4
  <h2 class="nhsuk-heading-m">{{ step.label }}</h2>
4
5
  <p>{{ step.userAction }}</p>
5
6
 
6
- <h3 class="nhsuk-heading-s">Linked screens</h3>
7
- <ul class="nhsuk-list">
8
- {% for screenId in step.screenIds %}
9
- {% set screen = knowledge.index.screens[screenId] %}
10
- <li><a href="{{ screen.route }}">{{ screen.title }}</a></li>
11
- {% endfor %}
12
- </ul>
7
+ {% if step.screenIds.length %}
8
+ {# What the user is actually looking at during this step. #}
9
+ <h3 class="nhsuk-heading-s">Linked screens</h3>
10
+ <div class="knowledge-screen-preview-row">
11
+ {% for screenId in step.screenIds %}
12
+ {% set screen = knowledge.index.screens[screenId] %}
13
+ {% if screen %}{{ screenPreview(screen, "inline") }}{% endif %}
14
+ {% endfor %}
15
+ </div>
16
+ {% endif %}
13
17
 
14
18
  <h3 class="nhsuk-heading-s">User needs</h3>
15
19
  <ul class="nhsuk-list nhsuk-list--bullet">
@@ -0,0 +1,41 @@
1
+ {# A live look at the screen, not a picture of one.
2
+
3
+ An iframe of the route the host already serves, scaled down. A captured
4
+ image would be sharper and cheaper to render, and it would start going stale
5
+ the moment somebody edits the page - which is the exact failure this viewer
6
+ exists to catch. A preview that can disagree with the prototype is worse than
7
+ no preview, because it is believed.
8
+
9
+ `loading="lazy"` matters on the list: seven of these is seven page loads, and
10
+ only the ones scrolled to should cost anything. #}
11
+
12
+ {% macro screenPreview(screen, size = "card") %}
13
+ {% if screen.external %}
14
+ <div class="knowledge-screen-preview knowledge-screen-preview--{{ size }} knowledge-screen-preview--absent">
15
+ <p class="knowledge-note nhsuk-u-margin-bottom-0">
16
+ Served elsewhere, so it cannot be previewed from here.
17
+ </p>
18
+ </div>
19
+ {% elif screen.route %}
20
+ <figure class="knowledge-screen-preview knowledge-screen-preview--{{ size }}">
21
+ <div class="knowledge-screen-preview__frame">
22
+ {#
23
+ Not interactive. A reader clicking inside a shrunken copy of a page
24
+ navigates a viewport they cannot see, and the back button then leaves
25
+ the frame somewhere unrelated to the record it is meant to illustrate.
26
+ The caption carries the real link.
27
+ #}
28
+ <iframe src="{{ screen.route }}"
29
+ title="Preview of {{ screen.title }}"
30
+ loading="lazy"
31
+ tabindex="-1"
32
+ aria-hidden="true"
33
+ scrolling="no"></iframe>
34
+ </div>
35
+ <figcaption>
36
+ <a href="{{ screen.route }}">Open {{ screen.title }}</a>
37
+ <code>{{ screen.route }}</code>
38
+ </figcaption>
39
+ </figure>
40
+ {% endif %}
41
+ {% endmacro %}
@@ -3,7 +3,6 @@
3
3
  {% block pageTitle %}{{ doc.title }}{% endblock %}
4
4
 
5
5
  {% block content %}
6
- <a class="nhsuk-back-link" href="{{ basePath }}/docs">Back to documentation</a>
7
6
  <article class="knowledge-doc">
8
7
  {{ doc.html | safe }}
9
8
  </article>
@@ -3,17 +3,78 @@
3
3
  {% block pageTitle %}Documentation{% endblock %}
4
4
 
5
5
  {% block content %}
6
- <a class="nhsuk-back-link" href="{{ basePath }}">Back to knowledge base</a>
7
6
  <h1>Documentation</h1>
8
7
  <p class="nhsuk-lede-text">These guides ship with the package, so they always describe the version you have installed.</p>
9
8
  <p class="knowledge-muted">@hippo-digital/hippocampus {{ packageVersion }}</p>
10
9
 
11
- <div class="knowledge-grid">
10
+ <h2 class="nhsuk-heading-m">Guides</h2>
11
+ <div class="knowledge-card-grid knowledge-card-grid--wide knowledge-card-grid--fill">
12
12
  {% for doc in docs %}
13
- <div class="knowledge-card">
14
- <h2 class="nhsuk-heading-s"><a href="{{ basePath }}/docs/{{ doc.slug }}">{{ doc.title }}</a></h2>
15
- {% if doc.summary %}<p>{{ doc.summary }}</p>{% endif %}
16
- </div>
13
+ <article class="knowledge-card knowledge-card--compact">
14
+ <h3 class="nhsuk-heading-s nhsuk-u-margin-bottom-1">
15
+ <a href="{{ basePath }}/docs/{{ doc.slug }}">{{ doc.title }}</a>
16
+ </h3>
17
+ {% if doc.summary %}<p class="nhsuk-body-s nhsuk-u-margin-bottom-0">{{ doc.summary }}</p>{% endif %}
18
+ </article>
17
19
  {% endfor %}
18
20
  </div>
21
+
22
+ {#
23
+ The blank workbooks, where somebody might find them.
24
+
25
+ Both of these already shipped. The only place either was named was inside an
26
+ error message - "start from the blank tracker that ships with the package:
27
+ node_modules/@hippo-digital/hippocampus/templates/..." - which is a path you
28
+ can only follow if you already knew it was there, and it arrives after the
29
+ thing it would have prevented.
30
+ #}
31
+ {% if templates.length %}
32
+ <h2 class="nhsuk-heading-m">Templates to fill in</h2>
33
+ <p class="knowledge-note">
34
+ Workbooks with the columns each importer expects. Fill one in, run the
35
+ command underneath it, then check the draft before promoting it.
36
+ </p>
37
+
38
+ {#
39
+ Grouped by where the file lives, not deduplicated. A project's copy of a
40
+ blank is usually that blank renamed, so in one flat list the two read as
41
+ the same thing listed twice - but deciding from a filename that two
42
+ workbooks are the same workbook is a guess, and a team that has diverged
43
+ from a blank needs to see both.
44
+ #}
45
+ {% for group in templates %}
46
+ <h3 class="nhsuk-heading-s nhsuk-u-margin-bottom-1">{{ group.title }}</h3>
47
+ {% if group.note %}<p class="knowledge-note">{{ group.note }}</p>{% endif %}
48
+
49
+ <div class="knowledge-card-grid knowledge-card-grid--wide knowledge-card-grid--fill nhsuk-u-margin-bottom-5">
50
+ {% for template in group.items %}
51
+ <article class="knowledge-card knowledge-card--compact">
52
+ <p class="knowledge-card__meta nhsuk-u-margin-bottom-1">
53
+ {{ template.format }} · {{ (template.bytes / 1024) | round }}KB
54
+ </p>
55
+ <h4 class="nhsuk-heading-s nhsuk-u-margin-bottom-1">
56
+ <a href="{{ basePath }}/templates/{{ template.file }}" download>{{ template.title }}</a>
57
+ </h4>
58
+ {% if template.matches %}
59
+ <p class="knowledge-note nhsuk-u-margin-bottom-2">
60
+ Same sheets as the blank &ldquo;{{ template.matches }}&rdquo;, so the
61
+ command below reads it.
62
+ </p>
63
+ {% endif %}
64
+ {% if template.summary %}
65
+ <p class="nhsuk-body-s">{{ template.summary }}</p>
66
+ {% endif %}
67
+ {% if template.command %}
68
+ <p class="nhsuk-body-s nhsuk-u-margin-bottom-0">
69
+ <code class="knowledge-template__command">{{ template.command }}</code>
70
+ {% if template.then %}
71
+ <code class="knowledge-template__command">{{ template.then }}</code>
72
+ {% endif %}
73
+ </p>
74
+ {% endif %}
75
+ </article>
76
+ {% endfor %}
77
+ </div>
78
+ {% endfor %}
79
+ {% endif %}
19
80
  {% endblock %}
@@ -1,21 +1,54 @@
1
1
  {% extends "hippocampus/_layout.html" %}
2
+ {% from "hippocampus/components/_connections.njk" import connections %}
2
3
 
3
- {% block pageTitle %}Evidence impact - {{ impact.evidence.title }}{% endblock %}
4
+ {% block pageTitle %}{{ impact.evidence.title }}{% endblock %}
4
5
 
5
6
  {% block content %}
6
- <a class="nhsuk-back-link" href="{{ basePath }}/graph">Back to relationship graph</a>
7
7
 
8
- <span class="nhsuk-caption-l">Evidence impact</span>
8
+ <span class="nhsuk-caption-l">Evidence</span>
9
9
  <h1>{{ impact.evidence.title }}</h1>
10
+
11
+ {#
12
+ What the record IS, before what it touches. The page led with a summary and
13
+ three numbers, so the source type, the confidence and the file it came from
14
+ - the things that tell you whether to trust it - were nowhere on a page
15
+ whose whole subject is what depends on it.
16
+ #}
17
+ <p class="knowledge-card__meta">
18
+ {{ impact.evidence.sourceType }}
19
+ <span class="knowledge-confidence-tag knowledge-confidence-tag--{{ impact.evidence.confidence }}">{{ impact.evidence.confidence }} confidence</span>
20
+ </p>
10
21
  <p class="nhsuk-lede-text">{{ impact.evidence.summary }}</p>
11
22
 
12
- <div class="knowledge-graph-summary">
13
- <div><strong>{{ impact.directRelationships.length }}</strong><span>Direct links</span></div>
14
- <div><strong>{{ impact.impactedEntities.length }}</strong><span>Impacted entities</span></div>
15
- <div><strong>{{ impact.evidence.confidence }}</strong><span>Confidence</span></div>
16
- </div>
23
+ {% if impact.evidence.sourcePath %}
24
+ <p class="knowledge-note">
25
+ From <code>{{ impact.evidence.sourcePath }}</code>
26
+ </p>
27
+ {% endif %}
28
+
29
+ {#
30
+ A caveat, not a tag. Low-confidence evidence that ten needs are built on is
31
+ a different situation from low-confidence evidence nothing cites, and only
32
+ this page knows which one you are looking at.
33
+ #}
34
+ {% if impact.evidence.confidence != "high" and impact.citedCount %}
35
+ <div class="nhsuk-warning-callout nhsuk-u-margin-top-4">
36
+ <h2 class="nhsuk-warning-callout__label">
37
+ <span role="text">
38
+ <span class="nhsuk-u-visually-hidden">Important: </span>
39
+ {{ impact.evidence.confidence | capitalize }} confidence, and relied on
40
+ </span>
41
+ </h2>
42
+ <p>
43
+ {{ impact.citedCount }} record{% if impact.citedCount != 1 %}s{% endif %} cite
44
+ this{% if impact.reachedCount %}, and {{ impact.reachedCount }} more
45
+ {%- if impact.reachedCount == 1 %} was{% else %} were{% endif %} built on
46
+ those{% endif %}. Worth confirming before it carries more weight.
47
+ </p>
48
+ </div>
49
+ {% endif %}
17
50
 
18
- {% if impact.evidence.quotes %}
51
+ {% if impact.evidence.quotes.length %}
19
52
  <section class="knowledge-section">
20
53
  <h2>Quoted signals</h2>
21
54
  <ul class="nhsuk-list nhsuk-list--bullet">
@@ -26,28 +59,28 @@
26
59
  </section>
27
60
  {% endif %}
28
61
 
29
- <section class="knowledge-section">
30
- <h2>Impacted entities</h2>
31
- <div class="knowledge-graph">
32
- {% for entity in impact.impactedEntities %}
33
- <article class="knowledge-graph__node knowledge-graph__node--{{ entity.type | lower }}">
34
- <strong>{{ entity.type }}</strong>
35
- <span>{{ entity.label }}</span>
36
- </article>
37
- {% endfor %}
38
- </div>
39
- </section>
40
-
41
- <section class="knowledge-section">
42
- <h2>Impact path</h2>
43
- <ul class="nhsuk-list knowledge-edge-list">
44
- {% for relationship in impact.relationships %}
45
- <li>
46
- <strong>{{ relationship.fromLabel }}</strong>
47
- <span>{{ relationship.label }}</span>
48
- <strong>{{ relationship.toLabel }}</strong>
49
- </li>
50
- {% endfor %}
51
- </ul>
52
- </section>
62
+ {#
63
+ Two bounded steps, in place of a chip grid and 602 rows of A-label-B.
64
+
65
+ The question this page is named for is what to revisit if the evidence is
66
+ wrong, and that is answered by what cites it and what was built on those -
67
+ not by everything the graph can reach, which past a couple of hops is
68
+ everything.
69
+ #}
70
+ <h2>What cites this</h2>
71
+ <p class="knowledge-note">
72
+ Records that name this evidence directly. If it is wrong, these are wrong
73
+ first.
74
+ </p>
75
+ {{ connections(impact.citedGroups) }}
76
+
77
+ {% if impact.reachedGroups.length %}
78
+ <h2>What was built on those</h2>
79
+ <p class="knowledge-note">
80
+ One step further out: designed on, or tested against, the records above.
81
+ Provenance is deliberately not followed - a research round did not become
82
+ wrong because something drawn from it did.
83
+ </p>
84
+ {{ connections(impact.reachedGroups) }}
85
+ {% endif %}
53
86
  {% endblock %}
@@ -3,46 +3,152 @@
3
3
  {% block pageTitle %}Relationship graph{% endblock %}
4
4
 
5
5
  {% block content %}
6
- <a class="nhsuk-back-link" href="{{ basePath }}">Back to knowledge base</a>
7
6
 
8
7
  <span class="nhsuk-caption-l">Knowledge graph</span>
9
- <h1>Relationship graph</h1>
10
- <p class="nhsuk-lede-text">Explicit relationships from the knowledge source, shown as entities and typed links.</p>
8
+ <h1>How the records connect</h1>
9
+ <p class="nhsuk-lede-text">
10
+ {{ graph.entityCount }} records and {{ graph.relationships.length }} relationships,
11
+ shown as the {{ graph.flowMap.flows.length }} ways the
12
+ {{ graph.flowMap.boxes.length }} kinds of record connect to each other.
13
+ </p>
11
14
 
12
- <div class="knowledge-graph-summary">
13
- <div><strong>{{ graph.nodes.length }}</strong><span>Linked entities</span></div>
14
- <div><strong>{{ graph.relationships.length }}</strong><span>Relationships</span></div>
15
- <div><strong>{{ graph.relationshipTypes.length }}</strong><span>Relationship types</span></div>
16
- </div>
15
+ {#
16
+ A map of the TYPES, not of the records.
17
+
18
+ The page drew all 438 entities as chips and all 1,031 relationships as
19
+ "A - label - B" rows: every fact present, none of them legible. A
20
+ force-directed layout of the same data would have been a hairball - 438
21
+ nodes at a median degree of 2 has no readable shape at that size.
22
+
23
+ There are twelve kinds of record and nineteen ways they connect, and that
24
+ does fit on a screen. The line thickness is how many records take each
25
+ route, so where the chain thins out is visible rather than countable.
26
+
27
+ The list below is the same data as text. It is not a fallback - a thickness
28
+ is a comparison and a number is a fact, and the page owes a reader both.
29
+ #}
30
+ <figure class="knowledge-flowmap">
31
+ <svg viewBox="0 0 {{ graph.flowMap.width }} {{ graph.flowMap.height }}"
32
+ class="knowledge-flowmap__svg"
33
+ role="img"
34
+ aria-labelledby="flowmap-title flowmap-desc">
35
+ <title id="flowmap-title">How each kind of record connects to the others</title>
36
+ <desc id="flowmap-desc">
37
+ A map of {{ graph.flowMap.boxes.length }} record types in
38
+ {{ graph.flowMap.columns.length }} stages, from where knowledge comes
39
+ from through to what gets designed, joined by
40
+ {{ graph.flowMap.flows.length }} connections. The same connections are
41
+ listed with their counts immediately below this map.
42
+ </desc>
43
+
44
+ <g class="knowledge-flowmap__flows">
45
+ {% for flow in graph.flowMap.flows %}
46
+ <path d="{{ flow.path }}"
47
+ stroke-width="{{ flow.width }}"
48
+ class="knowledge-flowmap__flow{% if flow.sameColumn %} knowledge-flowmap__flow--aside{% endif %}">
49
+ <title>{{ flow.count }} · {{ flow.from }} {{ flow.phrase }} {{ flow.to }}</title>
50
+ </path>
51
+ {% endfor %}
52
+ </g>
53
+
54
+ <g class="knowledge-flowmap__boxes">
55
+ {% for box in graph.flowMap.boxes %}
56
+ <g transform="translate({{ box.x }}, {{ box.y }})">
57
+ <rect width="{{ graph.flowMap.boxWidth }}" height="{{ graph.flowMap.boxHeight }}"
58
+ rx="3" class="knowledge-flowmap__box"></rect>
59
+ <text x="12" y="21" class="knowledge-flowmap__label">{{ box.type }}</text>
60
+ <text x="12" y="39" class="knowledge-flowmap__count">{{ box.count }}</text>
61
+ </g>
62
+ {% endfor %}
63
+ </g>
64
+ </svg>
65
+
66
+ <figcaption class="knowledge-note">
67
+ Left to right as the work flows. Thickness is how many records take each
68
+ route.
69
+ </figcaption>
70
+ </figure>
17
71
 
18
72
  <section class="knowledge-section">
19
- <h2>Entities</h2>
20
- <div class="knowledge-graph">
21
- {% for node in graph.nodes %}
22
- <article class="knowledge-graph__node knowledge-graph__node--{{ node.type | lower }}">
23
- <strong>{{ node.type }}</strong>
24
- <span>{{ node.label }}</span>
25
- </article>
73
+ <h2>Every connection, counted</h2>
74
+ <p class="knowledge-note">
75
+ Each row is one way two kinds of record connect. Where a type has a page
76
+ of its own, its name links to it.
77
+ </p>
78
+ <ol class="knowledge-flowlist">
79
+ {% for flow in graph.flowMap.flows %}
80
+ {% set fromBox = null %}
81
+ {% set toBox = null %}
82
+ {% for box in graph.flowMap.boxes %}
83
+ {% if box.type == flow.from %}{% set fromBox = box %}{% endif %}
84
+ {% if box.type == flow.to %}{% set toBox = box %}{% endif %}
85
+ {% endfor %}
86
+ <li class="knowledge-flowlist__row">
87
+ <span class="knowledge-flowlist__label">
88
+ {% if fromBox.href %}<a href="{{ fromBox.href }}">{{ flow.from }}</a>{% else %}{{ flow.from }}{% endif %}
89
+ <span class="knowledge-flowlist__phrase">{{ flow.phrase }}</span>
90
+ {% if toBox.href %}<a href="{{ toBox.href }}">{{ flow.to }}</a>{% else %}{{ flow.to }}{% endif %}
91
+ </span>
92
+ <span class="knowledge-flowlist__bar" aria-hidden="true">
93
+ <span style="width: {{ (flow.count / graph.flowMap.flows[0].count * 100) | round }}%"></span>
94
+ </span>
95
+ <span class="knowledge-flowlist__count">{{ flow.count }}</span>
96
+ </li>
26
97
  {% endfor %}
27
- </div>
98
+ </ol>
28
99
  </section>
29
100
 
101
+ {#
102
+ The records the map cannot show, because they connect to nothing. The old
103
+ page drew only entities that appear in a relationship, so it was the one
104
+ view structurally incapable of showing a gap.
105
+ #}
30
106
  <section class="knowledge-section">
31
- <h2>Relationships</h2>
32
- <ul class="nhsuk-list knowledge-edge-list">
33
- {% for relationship in graph.relationships %}
34
- <li>
35
- <strong>{{ relationship.fromLabel }}</strong>
36
- <span>{{ relationship.label }}</span>
37
- <strong>
38
- {% if relationship.toType == "Evidence" %}
39
- <a href="{{ basePath }}/evidence/{{ relationship.to }}/impact">{{ relationship.toLabel }}</a>
40
- {% else %}
41
- {{ relationship.toLabel }}
42
- {% endif %}
43
- </strong>
44
- </li>
107
+ <h2>Connected to nothing</h2>
108
+ {% if graph.unconnected.length %}
109
+ <p class="knowledge-note">
110
+ {{ graph.entityCount - graph.connectedCount }} of {{ graph.entityCount }}
111
+ records have no relationship at all. Usually a gap in the graph rather
112
+ than a fact about the record.
113
+ </p>
114
+ {#
115
+ A heading per kind, then a card per record. Six bulleted lists inside
116
+ six boxes made the boxes the thing you saw and the records the thing
117
+ you had to read past - and these ARE the point of the section: each one
118
+ is a specific record somebody has to decide about.
119
+ #}
120
+ {% for group in graph.unconnected %}
121
+ <h3 class="nhsuk-heading-s knowledge-orphan-heading">
122
+ {{ group.label }}
123
+ <span class="nhsuk-u-font-weight-normal nhsuk-u-secondary-text-color">({{ group.items.length }})</span>
124
+ </h3>
125
+ <div class="knowledge-card-grid knowledge-card-grid--fill">
126
+ {% for item in group.items %}
127
+ <article class="knowledge-card knowledge-card--compact">
128
+ <h4 class="knowledge-card__statement knowledge-card__statement--only">
129
+ {% if item.href %}
130
+ <a href="{{ item.href }}">{{ item.label }}</a>
131
+ {% else %}
132
+ {{ item.label }}
133
+ {% endif %}
134
+ </h4>
135
+ </article>
136
+ {% endfor %}
137
+ </div>
45
138
  {% endfor %}
46
- </ul>
139
+ {% else %}
140
+ <div class="nhsuk-inset-text">
141
+ <p>Every record is connected to at least one other.</p>
142
+ </div>
143
+ {% endif %}
144
+ </section>
145
+
146
+ <section class="knowledge-section">
147
+ <h2>Following one record</h2>
148
+ <p>
149
+ This map is the shape of the whole knowledge base. To walk the links from
150
+ a single record - upstream to what it rests on, downstream to what rests
151
+ on it - use the <a href="{{ basePath }}/trace">trace tree</a>.
152
+ </p>
47
153
  </section>
48
154
  {% endblock %}
@@ -4,7 +4,6 @@
4
4
  {% block pageTitle %}Handover{% endblock %}
5
5
 
6
6
  {% block content %}
7
- <a class="nhsuk-back-link" href="{{ basePath }}">Back to knowledge base</a>
8
7
  <h1>Handover</h1>
9
8
  {{ emptyState("Nothing to hand over yet",
10
9
  "Handover documentation is generated from a journey - its steps, the screens they touch and the needs and evidence behind them. There are no journeys in this knowledge base.",