GeriLife / caregiving

GeriLife is a comprehensive toolkit designed to empower caregivers in elder-care communities, promoting wellness and ensuring equitable engagement in life-enriching activities. This project, rooted in real-world insights and collaborative innovation, aims to transform elder care by making quality-of-life activities visible and coordinated.
European Union Public License 1.2
7 stars 7 forks source link

Implemented ResidentActivity Model and Stacked Bar Chart for Activity Counts by Resident and Activity Type #50

Closed adrienneli104 closed 12 months ago

adrienneli104 commented 12 months ago

Resolves https://github.com/GeriLife/caregiving/issues/44

Closes https://github.com/GeriLife/caregiving/issues/43

What:

  1. Created a new Django application, metrics, featuring a more efficient data model called ResidentActivity. Used atomic transactions and added to resident_activity when creating an activity in activities/views.py for data synchronization. It only saves the transaction if both resident and resident_activity are successfully committed to the database.
  2. Created a stacked bar chart on the Home profile template that displays activity counts grouped by resident and activity type.

image

Why: The current Activity data model, while robust, presents challenges in generating charts and reports due to its complex relationships, particularly the ManyToMany relationship between Residents and Activities. To streamline data aggregation and improve performance, I created a new Django application, metrics, featuring a more efficient data model. The visualization provides a clear overview of each resident's participation in different activities, enhancing the understanding of individual engagement patterns.

How:

  1. Add an activity
  2. Go to the home profile that you added the activity to

Testing: Tests are found in metrics/test.py and can be run with /manage.py test metrics.tests

codeclimate[bot] commented 12 months ago

Code Climate has analyzed commit ae0cbc17 and detected 34 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2
Duplication 2
Style 24
Bug Risk 6

Note: there are 2 critical issues.

View more on Code Climate.

adrienneli104 commented 12 months ago

Hey I saw your suggestions and updated the code! Is there anything else to modify?

brylie commented 12 months ago

@all-contributors please add @adrienneli104 for code, design, ux

allcontributors[bot] commented 12 months ago

@brylie

I've put up a pull request to add @adrienneli104! :tada: