Skip to content

1121 design implementation 1 show all datasets#1128

Merged
pooleycodes merged 3 commits into
mainfrom
1121-design-implementation-1-show-all-datasets
Nov 13, 2025
Merged

1121 design implementation 1 show all datasets#1128
pooleycodes merged 3 commits into
mainfrom
1121-design-implementation-1-show-all-datasets

Conversation

@pooleycodes
Copy link
Copy Markdown
Contributor

@pooleycodes pooleycodes commented Nov 12, 2025

Description

Updated the designs of the LPA Dashboard in line with new Service Designs placing datasets in different sections on the dashboard depending on each dataset's provision reason for that organisation.

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related Tickets & Documents

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above.

  • Yes
  • No, and this is why: Please replace this line with details on why tests have not been included
  • I need help with writing tests

QA sign off

  • Code has been checked and approved
  • Design has been checked and approved
  • Product and business logic has been checked and proved

Summary by CodeRabbit

  • New Features

    • Added new dataset categories ("expected" and "prospective") to organisation overviews.
  • Improvements

    • Updated dataset status labels and descriptive text for clarity.
    • Refined error wording to emphasise URL access issues and improved issue hints.
    • Restructured overview layout with dedicated sections for each dataset type and adjusted pluralisation.
  • Tests

    • Updated unit and acceptance tests to reflect new dataset groups and rendering behaviour.
  • Chores

    • Enabled Playwright UI flag for local acceptance test script.

@pooleycodes pooleycodes linked an issue Nov 12, 2025 that may be closed by this pull request
5 tasks
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 12, 2025

Walkthrough

Fetch logic now returns provisions for the organisation without a dataset filter; dataset grouping was extended from two groups to four (statutory, expected, prospective, other) and templates/schemas/tests updated to surface the new groups and adjusted UI text.

Changes

Cohort / File(s) Summary
Middleware / data processing
src/middleware/lpa-overview.middleware.js
fetchProvisions removes the dataset-level filter so provisions are fetched for the organisation; prepareOverviewTemplateParams maps provision reasons into statutory, expected, prospective, and other groups.
Schema
src/routes/schemas.js
OrgOverviewPage schema extended: datasets now includes optional expected and prospective arrays in addition to statutory and other.
View template
src/views/organisations/overview.html
Replaces datasets.other rendering with separate datasets.expected and datasets.prospective blocks; updates status/issue wording to "authoritative dataset(s) provided", "error(s) accessing URLs", and "can be improved"; adds informational paragraph and test IDs for new sections.
Unit tests
test/unit/middleware/lpa-overview.middleware.test.js, test/unit/views/organisations/lpaOverviewPage.test.js
Tests adjusted to assert datasets.expected and datasets.prospective presence/absence and updated wording; conditional handling added for ODP membership rendering differences.
Acceptance tests
test/acceptance/dataset_overview.test.js
Acceptance tests updated to reference datasetsExpected (replacing previous mandatory/ODP-specific selectors) and adjusted headings/selectors accordingly.
Package scripts
package.json
test:acceptance:local script updated to add --ui flag to the Playwright invocation.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Browser
    participant Server
    participant DB as Database
    participant Template

    Browser->>Server: GET /organisations/:orgId/overview
    Server->>DB: fetchProvisions(orgId)  %% style rect with color `#DFF0D8`
    note right of DB `#DFF0D8`: provision rows for org (no dataset filter)
    DB-->>Server: provisions[]
    Server->>Server: prepareOverviewTemplateParams(provisions[])
    note right of Server `#E8F4FF`: group into statutory, expected,\nprospective, other
    Server->>Template: render overview with grouped datasets
    Template-->>Browser: HTML response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to src/middleware/lpa-overview.middleware.js (SQL change + grouping logic).
  • Verify src/views/organisations/overview.html conditional branches and pluralisation updates.
  • Confirm tests in test/unit/... and test/acceptance/... cover both ODP member and non-member flows.

Possibly related issues

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • rosado
  • DilwoarH
  • eveleighoj

Poem

🐰 I hopped through rows and dropped the sieve,
Now four baskets hold each dataset we give.
Statutory, expected, prospective, and other—so clear,
The overview sings, the deadlines near. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and generic—"1121 design implementation 1 show all datasets" uses non-descriptive terms that don't clearly convey the specific change. While related to the PR objectives, it reads more like a ticket reference than a meaningful summary of the actual implementation. Consider a clearer title such as "Reorganize datasets by provision reason on LPA overview page" or "Display expected and prospective datasets in separate sections" to better reflect the specific design changes made.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1121-design-implementation-1-show-all-datasets

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dda71b5 and d439061.

📒 Files selected for processing (2)
  • package.json (1 hunks)
  • test/acceptance/dataset_overview.test.js (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-21T08:57:17.338Z
Learnt from: GeorgeGoodall-GovUk
Repo: digital-land/submit PR: 510
File: test/unit/middleware/datasetOverview.middleware.test.js:1-3
Timestamp: 2024-10-21T08:57:17.338Z
Learning: Tests for `pullOutDatasetSpecification` have been moved to `common.middleware.test`.

Applied to files:

  • test/acceptance/dataset_overview.test.js
🔇 Additional comments (3)
package.json (1)

35-35: LGTM! Good developer experience improvement.

Adding the --ui flag enables Playwright's UI mode for local acceptance tests, which provides a better debugging experience during development.

test/acceptance/dataset_overview.test.js (2)

102-102: Consider environment-specific test reliability.

The selector update to datasetsExpected is correct. However, the comment on line 82 notes that the test "may only work when environment is NOT 'local' or 'development'". This could be problematic since the package.json changes enable UI mode specifically for the test:acceptance:local script (line 35), which runs with NODE_ENV=local.

Verify that the test works reliably in the local environment with the updated selectors, particularly given the comment's warning about environment-specific behaviour.


22-25: Verify test coverage for new datasetsProspective section.

The template confirms a datasetsProspective section exists (data-testid on line 160 of src/views/organisations/overview.html), but the test snippet shown does not include assertions for this section. Ensure the test file includes corresponding expectations for this newly added dataset group.

Note: The middleware recognises four dataset categories (statutory, expected, prospective, other), but only three have visible template sections. Verify whether the "other" category requires test coverage or is rendered conditionally.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 12, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.46% 6348 / 9551
🔵 Statements 66.46% 6348 / 9551
🔵 Functions 64.87% 266 / 410
🔵 Branches 80.63% 866 / 1074
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/middleware/lpa-overview.middleware.js 79.62% 78.78% 50% 79.62% 23, 31-32, 39-40, 80-82, 94-96, 102-104, 125-136, 153-155, 165-167, 214-215, 268-276, 290, 292, 323-336, 339-351
src/routes/schemas.js 100% 100% 100% 100%
Generated in workflow #1259 for commit d439061 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf6e89e and dda71b5.

📒 Files selected for processing (5)
  • src/middleware/lpa-overview.middleware.js (2 hunks)
  • src/routes/schemas.js (1 hunks)
  • src/views/organisations/overview.html (4 hunks)
  • test/unit/middleware/lpa-overview.middleware.test.js (3 hunks)
  • test/unit/views/organisations/lpaOverviewPage.test.js (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: GeorgeGoodall-GovUk
Repo: digital-land/submit PR: 510
File: test/unit/middleware/datasetOverview.middleware.test.js:1-3
Timestamp: 2024-10-21T08:57:17.338Z
Learning: Tests for `pullOutDatasetSpecification` have been moved to `common.middleware.test`.
📚 Learning: 2024-10-21T08:57:17.338Z
Learnt from: GeorgeGoodall-GovUk
Repo: digital-land/submit PR: 510
File: test/unit/middleware/datasetOverview.middleware.test.js:1-3
Timestamp: 2024-10-21T08:57:17.338Z
Learning: Tests for `pullOutDatasetSpecification` have been moved to `common.middleware.test`.

Applied to files:

  • test/unit/views/organisations/lpaOverviewPage.test.js
  • test/unit/middleware/lpa-overview.middleware.test.js
📚 Learning: 2024-11-12T10:54:09.485Z
Learnt from: GeorgeGoodall-GovUk
Repo: digital-land/submit PR: 609
File: test/unit/noErrorsPage.test.js:68-68
Timestamp: 2024-11-12T10:54:09.485Z
Learning: In `test/unit/noErrorsPage.test.js`, avoid using `prettifyColumnName` for column headers because the table can contain spec fields, as requested by Alex.

Applied to files:

  • test/unit/views/organisations/lpaOverviewPage.test.js
📚 Learning: 2024-11-14T16:38:49.883Z
Learnt from: rosado
Repo: digital-land/submit PR: 657
File: test/unit/middleware/issueDetails.middleware.test.js:43-43
Timestamp: 2024-11-14T16:38:49.883Z
Learning: In `test/unit/middleware/issueDetails.middleware.test.js`, template params are verified with a schema, so it's acceptable for the test expectations to use primitive values while the test input uses an object for `issueEntitiesCount`.

Applied to files:

  • test/unit/middleware/lpa-overview.middleware.test.js
🧬 Code graph analysis (1)
test/unit/middleware/lpa-overview.middleware.test.js (1)
src/middleware/lpa-overview.middleware.js (7)
  • prepareOverviewTemplateParams (257-311)
  • req (76-76)
  • req (125-125)
  • req (150-150)
  • req (208-208)
  • req (323-323)
  • req (339-339)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: run-tests / test
🔇 Additional comments (10)
src/middleware/lpa-overview.middleware.js (2)

287-290: LGTM!

The new provision reason handling correctly maps 'expected' and 'prospective' to their respective groups whilst maintaining the existing 'statutory' and 'other' categories.


29-35: No changes required—the provisions query is correctly designed.

The dataset filter removal is intentional and safe. Whilst the query now fetches all provisions for an organisation, the data flow ensures only relevant provisions are used:

  1. prepareOverviewTemplateParams receives provisions as a lookup table and datasets that are already filtered to availableDatasets
  2. Provisions are accessed only via provisionData.get(ds.dataset) for datasets in the filtered set
  3. Unused provision rows cause no performance impact or logical errors

This design is actually more flexible than SQL-level filtering, as configuration changes to availableDatasets are automatically reflected without requiring query logic updates.

src/routes/schemas.js (1)

139-140: LGTM!

The schema correctly extends the datasets object to include the new optional expected and prospective arrays, maintaining consistency with the middleware changes.

test/unit/middleware/lpa-overview.middleware.test.js (3)

99-102: LGTM!

The test expectations correctly reference datasets.expected instead of the previous datasets.other, aligning with the middleware changes.


117-133: LGTM!

Good test coverage for the conditional rendering of the expected datasets section based on ODP membership. The test correctly verifies both the presence of the section for ODP members and its absence for non-members.


148-150: LGTM!

The dataset patching test correctly references datasets.expected[1] to align with the updated grouping structure.

test/unit/views/organisations/lpaOverviewPage.test.js (2)

76-86: LGTM!

The tests correctly verify rendering of the new 'expected' and 'prospective' dataset groups with appropriate conditional checks.


88-92: LGTM!

The allDatasets aggregation properly includes all three dataset groups (statutory, expected, prospective) using the nullish coalescing operator to handle optional arrays.

src/views/organisations/overview.html (2)

94-104: LGTM!

The deadline notice loops for the new datasets.expected and datasets.prospective groups are correctly implemented, maintaining consistency with the existing statutory datasets loop.


116-126: LGTM!

The updated copy for the dataset status boxes improves clarity:

  • "authoritative dataset(s) provided" better describes the metric
  • "error(s) accessing URLs" is more specific than endpoint errors
  • "can be improved" is more user-friendly than "needs fixing"

Comment on lines +147 to 157
{% if datasets.expected.length > 0 and isODPMember %}
<div data-testid="datasetsExpected">
<h2 class="govuk-heading-m">Datasets {{ organisation.name}} are expected to provide</h2>
<p class="org-membership-info">We expect you to provide these datasets as a condition of your funding with the Open Digital Planning community.</p>
<ul class="govuk-task-list govuk-!-margin-bottom-8" data-reason="expected">
{% for dataset in datasets.expected %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix spacing in template variable.

Missing space after the template variable will cause the text to run together.

Apply this diff:

-      <h2 class="govuk-heading-m">Datasets {{ organisation.name}} are expected to provide</h2>
+      <h2 class="govuk-heading-m">Datasets {{ organisation.name }} are expected to provide</h2>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{% if datasets.expected.length > 0 and isODPMember %}
<div data-testid="datasetsExpected">
<h2 class="govuk-heading-m">Datasets {{ organisation.name}} are expected to provide</h2>
<p class="org-membership-info">We expect you to provide these datasets as a condition of your funding with the Open Digital Planning community.</p>
<ul class="govuk-task-list govuk-!-margin-bottom-8" data-reason="expected">
{% for dataset in datasets.expected %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
{% if datasets.expected.length > 0 and isODPMember %}
<div data-testid="datasetsExpected">
<h2 class="govuk-heading-m">Datasets {{ organisation.name }} are expected to provide</h2>
<p class="org-membership-info">We expect you to provide these datasets as a condition of your funding with the Open Digital Planning community.</p>
<ul class="govuk-task-list govuk-!-margin-bottom-8" data-reason="expected">
{% for dataset in datasets.expected %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
🤖 Prompt for AI Agents
In src/views/organisations/overview.html around lines 147 to 157, the template
variable spacing is incorrect causing the rendered text to run together; update
the template to add a space inside the moustache braces so the heading reads
"Datasets {{ organisation.name }} are expected to provide" (ensure a space
before the closing }} and maintain consistent spacing elsewhere in that block).

Comment on lines +159 to +169
{% if datasets.prospective.length > 0 %}
<div data-testid="datasetsProspective">
<h2 class="govuk-heading-m">Datasets {{ organisation.name}} can provide</h2>
<p class="org-membership-info">Your organisation is the authoritative source of this data. Providing this data to the platform helps ensure it is accurate and up to date.</p>
<ul class="govuk-task-list" data-reason="prospective">
{% for dataset in datasets.prospective %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix spacing in template variable.

Missing space after the template variable will cause the text to run together.

Apply this diff:

-      <h2 class="govuk-heading-m">Datasets {{ organisation.name}} can provide</h2>
+      <h2 class="govuk-heading-m">Datasets {{ organisation.name }} can provide</h2>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{% if datasets.prospective.length > 0 %}
<div data-testid="datasetsProspective">
<h2 class="govuk-heading-m">Datasets {{ organisation.name}} can provide</h2>
<p class="org-membership-info">Your organisation is the authoritative source of this data. Providing this data to the platform helps ensure it is accurate and up to date.</p>
<ul class="govuk-task-list" data-reason="prospective">
{% for dataset in datasets.prospective %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
{% if datasets.prospective.length > 0 %}
<div data-testid="datasetsProspective">
<h2 class="govuk-heading-m">Datasets {{ organisation.name }} can provide</h2>
<p class="org-membership-info">Your organisation is the authoritative source of this data. Providing this data to the platform helps ensure it is accurate and up to date.</p>
<ul class="govuk-task-list" data-reason="prospective">
{% for dataset in datasets.prospective %}
{{ datasetItem(dataset) }}
{% endfor %}
</ul>
</div>
{% endif %}
🤖 Prompt for AI Agents
In src/views/organisations/overview.html around lines 159 to 169, the template
variable in the heading "Datasets {{ organisation.name}} can provide" is missing
a space before the closing braces which causes the rendered text to run
together; update the template variable formatting to include a space after the
variable (i.e., use the standard "{{ organisation.name }}" spacing) so the
output separates properly.

@pooleycodes pooleycodes merged commit 21c8105 into main Nov 13, 2025
5 checks passed
@pooleycodes pooleycodes deleted the 1121-design-implementation-1-show-all-datasets branch November 13, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design Implementation 1: Show All Datasets

2 participants