Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Stacked Bar Chart for Activity Counts by Resident and Activity Type #43

Closed
Tracked by #38
brylie opened this issue Nov 28, 2023 · 3 comments · Fixed by #50
Closed
Tracked by #38

Implement Stacked Bar Chart for Activity Counts by Resident and Activity Type #43

brylie opened this issue Nov 28, 2023 · 3 comments · Fixed by #50
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@brylie
Copy link
Member

brylie commented Nov 28, 2023

Objective

To introduce a stacked bar chart on the Home profile template that displays activity counts grouped by resident and activity type. This visualization aims to provide a clear overview of each resident's participation in different activities, enhancing the understanding of individual engagement patterns.

Chart Details

  • Type: Stacked Bar Chart (Horizontal Orientation)
  • X-Axis: Activity Count.
  • Y-Axis: Residents (each bar represents a resident with their name as the label).
  • Bar Composition: Each resident's bar is a stack of colors, each representing a different activity type they participated in.
  • Color Coding: Consistent across all bars, where each color denotes the same activity type.

Data Calculation and Aggregation

  • Data Source: Activity records.
  • Aggregation Method: Group activity records first by resident, then by activity type. For each grouping, aggregate to a single count representing the number of times the resident participated in that activity type.
  • Bar Composition: Each resident's bar in the chart will consist of segments (stacked), each segment’s length proportional to the count of activities of that type the resident participated in.
  • Color Consistency: Maintain uniformity in color representation for each activity type across all resident bars.

Aggregation Summary for Activity Counts by Resident and Activity Type Chart

This chart requires a multi-level aggregation approach:

  1. Resident Identification: For each resident, compile all their activity records.
  2. Activity Type Grouping: Within each resident's data, group the activities by type.
  3. Count Aggregation: For each group (resident-activity type combination), count the total number of activities.
  4. Bar Segment Representation: Represent each activity type count as a segment in the resident's bar, with the segment's length corresponding to the activity count.
  5. Color Coding: Assign a unique color to each activity type and use this color consistently across all residents' bars.
  6. Data Structuring for Visualization: Organize the aggregated data to fit the stacked bar chart format, ensuring clarity in representing each resident's activity engagement.

Design Considerations

  • The chart should be intuitive, with clear labels for residents and distinct colors for activity types.
  • Ensure the chart is responsive and aligns with the UI design of the Home profile template.
  • Prioritize readability, especially when dealing with multiple activity types and residents.

Technical Requirements

  • Use Python Plotly library for chart implementation, focusing on backend data processing for accuracy.
  • Ensure efficient data processing for the aggregation of activity counts by resident and activity type.

Reference Image

Desired Chart Output

Acceptance Criteria

  • A responsive, horizontal stacked bar chart displaying activity counts by resident and activity type is integrated into the Home profile template.
  • The chart accurately reflects the aggregated data and updates dynamically with current records.
  • The visualization adheres to design and performance standards set for the platform.
@brylie brylie added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Nov 28, 2023
@adrienneli104
Copy link
Contributor

Hi could I be assigned to this issue? My teammate Tanay has decided to handle the data fixtures by himself

@brylie
Copy link
Member Author

brylie commented Nov 28, 2023

Thanks, @adrienneli104! I’ve assigned you to the issue.

@brylie
Copy link
Member Author

brylie commented Nov 29, 2023

@adrienneli104, before working on the data aggregations, I realized we should create a database table that would make it easier to query and aggregate chart data. Please look at the following issue, which would serve as a foundation for this and other data visualization tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Archived in project
2 participants