Skip to content

Conversation

@KonstantinosKorovesis
Copy link
Contributor

@KonstantinosKorovesis KonstantinosKorovesis commented Jun 4, 2025

Description

This contribution introduces an interactive Tkinter-based GUI for analyzing question similarity. Through the GUI, users can see the following graphs: Cosine similarity matrix (heatmap), Cluster scatter plot (K-Means or Affinity Propagation based on the number of given questions) and Network graph. Users can also add new questions and display all current questions.
Note: This feature's additional dependencies (tkinter, matplotlib, networkx) are intentionally excluded from requirements.txt since they are not core requirements for the library. This GUI aims to provide an additional optional way to visualize and manage instrument questions without impacting the core package's minimal dependencies.

Fixes

No existing issue was fixed.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

I have added some basic tests to ensure the draw functions run without error and that empty input exits program correctly.

  • test_draw_cosine_similarity_matrix: make sure the draw_cosine_similarity_matrix function runs without error, with mock ax and canvas objects
  • test_draw_clusters_scatter_plot: make sure the draw_clusters_scatter_plot function runs without error, with mock ax and canvas objects
  • test_draw_network_graph: make sure the draw_network_graph function runs without error, with mock ax and canvas objects
  • test_empty_questions: check that empty input through the entry point function leads to the appropriate system exit

The Harmony API still runs with the introduced changes, since they implement a separate feature and do not affect existing functionality.

Test Configuration

  • Library version: current Harmony version (1.0.3)
  • OS: Windows 10
  • Toolchain: unittest, unittest.mock

Checklist

  • My PR is for one issue, rather than for multiple unrelated fixes.
  • My code follows the style guidelines of this project. I have applied a Linter (recommended: Pycharm's code formatter) to make my whitespace consistent with the rest of the project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • The Harmony API is not broken by my change to the Harmony Python library
  • I add third party dependencies only when necessary. If I changed the requirements, it changes in requirements.txt, pyproject.toml and also in the requirements.txt in the API repo
  • If I introduced a new feature, I documented it (e.g. making a script example in the script examples repository so that people will know how to use it.

@jaydugad
Copy link
Collaborator

Hey @KonstantinosKorovesis — this is a really nice addition! The feature looks well through out and the structure is clean overall.

Just one small thing before we can merge: the CI is failing during the python -m build step, and it looks like it’s because tkinter, matplotlib, and networkx are being imported at the top of the visualize_questions_gui.py file. Since the build runs in a headless environment, those GUI-related imports tend to cause issues even if they’re wrapped in a try/except.

Quick fix: If you move those imports inside the relevant functions (like setup_gui() or wherever they’re used), that should prevent them from loading during build time and should fix the CI error.

Once that’s done, happy to re-run the workflow and get this merged in! Let me know if you’d like a hand with restructuring — happy to help.

@woodthom2 woodthom2 merged commit 3eab57b into harmonydata:main Sep 21, 2025
0 of 3 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.

3 participants