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 Activity Level Trends Chart on Home Profile Template #42

Open
Tracked by #38
brylie opened this issue Nov 28, 2023 · 0 comments
Open
Tracked by #38

Implement Activity Level Trends Chart on Home Profile Template #42

brylie opened this issue Nov 28, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@brylie
Copy link
Member

brylie commented Nov 28, 2023

We aim to enhance the Home profile template by adding a multi-line chart to display activity level trends of residents over the past seven days. This visualization will provide insights into the daily activity patterns of residents, categorized into four levels: inactive, low, good, and high.

image

Objective

To visualize the trend of activity levels of residents in a specific home, helping staff and caregivers to monitor and understand changes in resident activity patterns.

Chart Details

  • Type: Multi-Line Chart
  • X-Axis: Dates of the past seven days.
  • Y-Axis: Integer count of residents.
  • Lines: Four lines representing the daily count of residents with different activity levels (inactive, low, good, high).
  • Color Coding: Each line will have a distinct color corresponding to its activity level.

Data Calculation

  • Activity Levels: Defined by the WEEKLY_ACTIVITY_RANGES constant.
  • Data Source: Resident activities, homes, and residencies data. For each of the past seven days, calculate the number of residents in the home and their respective activity levels based on the past week's activities.
  • Activity Level Calculation: The resident's activity level is determined by the count of activities over the prior seven days from the date of counting.

Aggregation Summary for Activity Level Trends Chart

The core of this chart lies in the aggregation of resident activity data to accurately represent activity levels over the past seven days. This involves several key steps:

  1. Time Frame Selection: Identify the seven-day period for analysis, ending with the current date.
  2. Residency Determination: For each day within this period, get a list of residents who were living in the home. This requires checking the move_in and move_out dates for each residency.
  3. Activity Counting: For each resident, count the number of activities they participated in during the seven days prior to the specific date being analyzed.
  4. Categorization: Based on the counted activities, categorize each resident into one of the four activity levels (inactive, low, good, high) as defined by WEEKLY_ACTIVITY_RANGES.
  5. Daily Aggregation: For each of the past seven days, aggregate the number of residents in each activity level category.
  6. Data Structuring: Organize this aggregated data in a format suitable for the multi-line chart, ensuring each line represents one of the activity level categories across the seven-day period.
  7. Data Integrity and Performance: Ensure the aggregation logic is optimized for performance, especially considering the potentially large dataset of residents and activities.

Design Considerations

  • Ensure the chart is visually consistent with the existing UI design of the Home profile template.
  • The chart should be responsive and easily interpretable.
  • Default to dark mode theme

Technical Requirements

  • Implement the chart using Plotly Python (with logic being defined in Python rather than JavaScript)
  • Backend logic should efficiently aggregate and process data to feed into the chart.

Reference Image

picture showing desired output

Acceptance Criteria

  • A multi-line chart accurately displaying the trend of resident activity levels over the past seven days is present on the Home profile template.
  • The chart updates dynamically with the latest data (when page is reloaded).
  • The implementation is efficient, responsive, and aligns with the design aesthetics of the platform.
@brylie brylie added enhancement New feature or request help wanted Extra attention is needed labels Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

1 participant