Skip to content

Refactor Suggestion: Improve Separation of Concerns in visualize_data.py #4

@ValerioVontobel

Description

@ValerioVontobel

Refactor Suggestion: Improve Separation of Concerns in visualize_data.py

Description

The visualize_data.py module currently mixes multiple responsibilities, including:

  • UI layout and Streamlit controls
  • Data filtering and preprocessing
  • Summary statistics computation
  • Plot rendering logic

This violates the Separation of Concerns principle and can make the code harder to maintain, test, and extend.

Suggested Improvements

  • Move plotting-related functions (e.g. generate_line_chart) into a separate module, such as plot_utils.py
  • Extract the sidebar UI controls (user ID, date range, resolution selector) into a helper or ui_components.py
  • Let visualize_data.py focus on orchestrating the app (run_app()), and delegate heavy logic elsewhere
  • Consider a controller/helper layer to coordinate data processing and UI logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions