Skip to content

Conversation

murugapl
Copy link
Contributor

@murugapl murugapl commented May 16, 2025

An endpoint which serves a UI used to view events related to a patient record.

This is a tool designed for use by the Ops Support people, to visualise the patient data without having to use the console.

The information that can be displayed for each 'event' is as follows:

AVAILABLE_DETAILS_CONFIG = {
consents: %i[response route updated_at withdrawn_at invalidated_at],
sessions: %i[location_id slug academic_year],
triages: %i[status updated_at invalidated_at performed_by_user_id],
vaccination_records: %i[
outcome
performed_at
updated_at
discarded_at
uuid
session_id
nhs_immunisations_api_synced_at
protocol
source
],
cohort_imports: %i[
csv_filename
processed_at
status
rows_count
new_record_count
exact_duplicate_record_count
changed_record_count
],
class_imports: %i[
csv_filename
processed_at
status
rows_count
new_record_count
exact_duplicate_record_count
changed_record_count
year_groups
],
parents: %i[],
gillick_assessments: %i[],
parent_relationships: %i[],
school_moves: %i[school_id source],
school_move_log_entries: %i[school_id user_id],
teams: %i[name],
changesets: %i[import_id import_type],
pds_search_results: %i[step]
}.freeze
AVAILABLE_DETAILS_CONFIG_PII = {
parents: %i[full_name email phone],
gillick_assessments: %i[
knows_vaccination
knows_disease
knows_consequences
knows_delivery
knows_side_effects
],
parent_relationships: %i[type other_name],
changesets: %i[uploaded_nhs_number pds_nhs_number],
pds_search_results: %i[nhs_number]
}.freeze

And the following audited changes are allowed:

ALLOWED_AUDITED_CHANGES = %i[
patient_id
session_id
location_id
programme_id
vaccine_id
organisation_id
team_id
school_id
gp_practice_id
uploaded_by_user_id
performed_by_user_id
user_id
parent_id
status
outcome
response
route
date_of_death_recorded_at
restricted_at
invalidated_at
withdrawn_at
rows_count
year_groups
home_educated
source
].freeze
ALLOWED_AUDITED_CHANGES_PII = %i[
full_name
email
phone
nhs_number
given_name
family_name
gender_code
date_of_birth
address_line_1
address_line_2
address_town
address_postcode
updated_from_pds_at
date_of_death
pending_changes
].freeze

These details include PII, but there is a show_pii flag that can be turned off in the controller to remove any identifiable information from the above lists

@tvararu tvararu temporarily deployed to mavis-pr-3559 May 16, 2025 08:25 Inactive
@murugapl murugapl force-pushed the timeline-records-ui branch from 4ee1935 to 93d5139 Compare May 16, 2025 13:10
@tvararu tvararu temporarily deployed to mavis-pr-3559 May 16, 2025 13:10 Inactive
@tvararu tvararu temporarily deployed to mavis-pr-3559 May 16, 2025 13:14 Inactive
@murugapl murugapl force-pushed the timeline-records-ui branch from 0d4f5fb to 82ef38e Compare May 16, 2025 13:15
@tvararu tvararu temporarily deployed to mavis-pr-3559 May 16, 2025 13:15 Inactive
@murugapl murugapl force-pushed the timeline-records-ui branch from 82ef38e to d8af2c9 Compare May 16, 2025 13:18
@tvararu tvararu temporarily deployed to mavis-pr-3559 May 16, 2025 13:18 Inactive
@thomasleese thomasleese added the operations Improving live support label May 16, 2025
@thomasleese thomasleese modified the milestones: v2.2.2, v2.2.3 May 16, 2025
@thomasleese thomasleese modified the milestones: v2.2.3, v2.3.0 May 23, 2025
@murugapl murugapl force-pushed the timeline-records-ui branch 3 times, most recently from e1f411b to 331a694 Compare May 29, 2025 13:53
@thomasleese thomasleese removed this from the v2.3.0 milestone Jun 10, 2025
@murugapl murugapl force-pushed the timeline-records-ui branch from 331a694 to 2d03c8e Compare June 23, 2025 10:25
@murugapl murugapl requested a review from a team as a code owner June 23, 2025 10:25
Copy link

@murugapl murugapl force-pushed the timeline-records-ui branch from 2d03c8e to d5e6d24 Compare July 28, 2025 20:31
@murugapl murugapl requested review from a team as code owners July 28, 2025 20:31
@murugapl murugapl force-pushed the timeline-records-ui branch from d5e6d24 to d32e5c9 Compare July 30, 2025 12:03
@murugapl murugapl changed the base branch from main to next July 30, 2025 12:04
@murugapl murugapl force-pushed the timeline-records-ui branch from d32e5c9 to 018ae97 Compare August 12, 2025 13:29
@murugapl murugapl force-pushed the timeline-records-ui branch 4 times, most recently from f1780a5 to 8c21362 Compare September 29, 2025 14:00
@murugapl murugapl force-pushed the pds-lookup-timeline branch 2 times, most recently from c89e29e to 5d0a857 Compare September 29, 2025 15:12
Base automatically changed from pds-lookup-timeline to next September 29, 2025 15:37
@thomasleese thomasleese added this to the v4.6.0 milestone Sep 30, 2025
Introduces a TimelineRecords class that collects and displays a chronological
view of patient-related events across multiple record types. Features configurable
detail display, audit trail integration, and privacy controls to ensure no PII
is exposed.
@murugapl murugapl force-pushed the timeline-records-ui branch from cb46dac to ceeac97 Compare October 1, 2025 08:30
Implements a front-end interface for the TimelineRecords module with:
- Interactive filters for event types and detail levels
- Tabular timeline view with chronological grouping
- Controller and views in the Inspect::Timeline namespace
- Routes restricted to test environments only
- Comparison view to analyze events between patients
…n is selected

Changed the default behavior of the sample_patient function to return nil when
no comparison option is provided, instead of raising an error.
Added a meaningful error message when an invalid comparison option is chosen.
A show_pii flag allows optional exclusion of personally-identifiable
information from the event details and audited changes relating to
a patient. This has been set to false by default in the controller,
but can be toggled on or off with a check box in the UI.
@murugapl murugapl force-pushed the timeline-records-ui branch from ceeac97 to 730766c Compare October 1, 2025 14:14
Refactor details and audits config for TimelineRecords to make it mroe readable. The PII fields are separated and merged into the base fields to created "with_pii" variables
@murugapl murugapl force-pushed the timeline-records-ui branch from 730766c to d2b3867 Compare October 2, 2025 10:30
Copy link

sonarqubecloud bot commented Oct 2, 2025

<% card.with_heading { "Customise timeline" } %>
<%= form_with url: @url,
method: :get,
data: { module: "autosubmit",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we've removed Stimulus from Mavis, probably since this was originally written (see b66c0f4). Not a show-stopper, but it would be nice to see if we can get this functionality back, although I suspect NHSUK won't support it directly so we'll have to bring Stimulus back.

@@ -0,0 +1,388 @@
# frozen_string_literal: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this isn't in app/lib? It feels like it should be to me.

Copy link
Contributor

@misaka misaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a couple things I think we should sort, but it's more important now to just get this PR in. 🚀

@alistair-white-horne-tng alistair-white-horne-tng changed the base branch from next to ops-tools October 2, 2025 16:42
@alistair-white-horne-tng alistair-white-horne-tng merged commit 3ae2b28 into ops-tools Oct 2, 2025
13 checks passed
@alistair-white-horne-tng alistair-white-horne-tng deleted the timeline-records-ui branch October 2, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operations Improving live support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants