Skip to content

Implement excluded_topics and excluded_opinions in the report UI and fix summary topic count - #119

Merged
peterwgnd merged 1 commit into
Jigsaw-Code:mainfrom
CoslaDigital:excluded-topics
Oct 12, 2026
Merged

peterwgnd merged 1 commit into
Jigsaw-Code:mainfrom
CoslaDigital:excluded-topics

Conversation

@digitalWestie

Copy link
Copy Markdown
Contributor

Summary

  • Read excluded_topics and excluded_opinions in src/report_ui/data.js from config.json
  • filter excluded topics and opinions in groupOpinions with exact matches, then recalculate count from remaining rows after filtering; drop topics left with no opinions.
  • Set topicsIdentified from the filtered tree (opinionsGrouped.length) instead of the unfiltered summary.sub_contents.length -- this has side effect of correcting the the topic count in the executive summary card
  • Document snake_case keys in the repo and report_ui READMEs. Also update config.json to use snake case to be consitent with the other config.json options e.g. overview_chart or number_of_top_opinions.

Test plan

Manual check was performed by running cd src/report_ui && npm run inline. This drew on src/report_ui/input/opinions.csv (community transport feedback).

Topics in that file: Challenges in Current Transport Systems, Geographic Coverage and Accessibility, Use Cases and Purpose of Community Transport, Benefits of Minibus Services, and Preferences for Community Transport Models.

Built with excluded_topics set to one of those (e.g. Challenges in Current Transport Systems) and confirmed it disappeared from the overview and topic sections while the others remained; topic count matched the filtered set.

Using the same config.json before and after:

before

image

after

image

@peterwgnd

Copy link
Copy Markdown
Collaborator

Hey, thanks for catching and implementing this @digitalWestie!

I'm not able to make edits here, so wondering if you can make a few small changes so I can merge, or I can cherrypick and update if you prefer.

  1. Rebase onto main: src/report_ui/data.js and src/report_ui/README.md were recently updated on main (I've been working through clean up this week), so this branch currently has a merge conflict.

  2. Backwards compatibility for camelCase keys: Since README.md and input/config.json previously listed excludedTopics and excludedOpinions, existing user configs may still use the camelCase names. Could we fall back to the camelCase keys in data.js while keeping snake_case in the docs?

    const excludedTopics = new Set(
      config.excluded_topics ?? config.excludedTopics ?? [],
    );
    const excludedOpinions = new Set(
      config.excluded_opinions ?? config.excludedOpinions ?? [],
    );

@digitalWestie

Copy link
Copy Markdown
Contributor Author

@peterwgnd Rebased and introduced the fall back as suggested. Working as expected using the backwards compatible option:-

image image

@peterwgnd

Copy link
Copy Markdown
Collaborator

Looks great, Rory, thank you!

@peterwgnd peterwgnd closed this Oct 12, 2026
@peterwgnd peterwgnd reopened this Oct 12, 2026
@peterwgnd
peterwgnd merged commit 2c2f4d8 into Jigsaw-Code:main Oct 12, 2026
12 checks passed
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.

2 participants