Skip to content

feat: keyword search over topics in the prospective demo - #6

Open
picaultj wants to merge 1 commit into
mainfrom
feat/topic-keyword-search
Open

feat: keyword search over topics in the prospective demo#6
picaultj wants to merge 1 commit into
mainfrom
feat/topic-keyword-search

Conversation

@picaultj

Copy link
Copy Markdown
Owner

Summary

Implements "search among topics by keywords" — the third idea in upstream issue rte-france/BERTrend#59 — for the prospective demo's signal-analysis view.

What it does

Adds a keyword search box above the weak/strong/noise topic tables. Typing filters all three tables to the topics whose title, LLM description, or representation match the query.

  • Case-insensitive substring matching.
  • Whitespace-separated terms are combined with AND (a topic must contain every term).
  • Blank query → tables shown unchanged.
  • A caption echoes the active filter when a query is present.

Changes

  • topic_search.py (new): pure, dependency-light helper filter_topics_by_keywords(df, query, search_columns=None). No Streamlit dependency, so it is unit-testable in isolation.
  • dashboard_signals.py: adds the st.text_input search box and routes each category dataframe through the helper before display.
  • i18n_translations.py: FR/EN strings (search_topics, search_topics_placeholder, search_active).
  • tests/apps/test_topic_search.py (new): unit tests for the helper.

Scope notes

  • Kept to the signal-analysis topic tables (the primary "topics" surface). The source-explorer selectbox in the right column is left as-is; extending the filter there (and to the comparative dashboard) is a natural follow-up.
  • This covers only the "keyword search" bullet of Some ideas rte-france/BERTrend#59; the other ideas (topic feedback, geographical filtering, better weak-signal characterisation) are separate, larger pieces.

Tests

tests/apps/test_topic_search.py: 9 passed (blank/None/empty handling, case-insensitive matches on title/description/representation, AND semantics, no-match, missing columns, custom search_columns).


Generated by Claude Code

Add a keyword search box to the signal-analysis view of the prospective demo so
users can filter the weak/strong/noise topic tables by keywords (issue rte-france#59,
'search among topics by keywords').

- New pure helper filter_topics_by_keywords() (topic_search.py) matches
  case-insensitively across the topic title, LLM description and representation,
  combining whitespace-separated terms with AND semantics; a blank query leaves
  the tables unchanged.
- dashboard_signals wires a st.text_input above the tables and filters each
  category through the helper, with a caption echoing the active filter.
- Added FR/EN translations and unit tests for the helper.
@picaultj
picaultj force-pushed the feat/topic-keyword-search branch from 185d416 to 1b1f541 Compare August 18, 2026 12:54
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.

1 participant