1. Ensure you have Python 3.11.6 installed. You can download Python 3.11.6 from the official Python website
2. Ensure you have Poetry installed and setup on your local machine. You can find the instructions on how to set it up on the Poetry website.
git clone https://github.com/dharmik529/OS_FinalProject.gitIn order to see the full web application. There are a few steps you need to complete. First, you have to go into the AMMS folder in order to run the run.py.
cd OS_FinalProject/AMMSpoetry shellpoetry installpython3 run.py- Navigate to the home page.
- Click on "Register" in the top right of the home page.
- Enter the details in the form such as username, email, password
- Once that is done, go to Login and enter the email and password to login.
- There are 2 sections for this. There is a page where you can see all your reminders scheduled, and the form to schedule a new reminder.
- To schedule a new reminder, naviate to the top menu bar in app and click "new reminder"
- Fill out the form accordingly to add the reminder to the database.
- Navigate to the home page.
- There are 2 sections for this. There is a page where you can see all your medications, and the form to add a new medication.
- To add a new medication, naviate to the top menu bar in app and click "new medication"
- Fill out the form accordingly to add the medication to the database.
The Automated Medication Management System is designed to empower elderly individuals to effectively manage their medication schedules. It features a user-friendly interface that provides reminders for prescribed doses and tracks medication consumption to ensure adherence and overall well-being. This system leverages advanced Operating System concepts like process scheduling and interprocess communication, ensuring timely reminders and seamless coordination between its various components.
This Flask project incorporates several Operating System (OS) concepts:
-
Threads: Flask app uses the Werkzeug WSGI server by default which relies on threads to handle incoming HTTP requests. When a request comes in, the server spawns a new thread instead of blocking the main thread or processing sequentially. This allows multiple clients to connect concurrently. The
reminder_handlerfunction likely executes within a dedicated thread spawned by the scheduler. This enables it to run independently and concurrently with the web server threads.In summary, threads promote concurrency for the web server, background jobs, and database access. The GIL and synchronization primitives ensure thread safety.
-
Process Management: The Flask application creates a web server process to handle HTTP requests from users. This allows multiple users to interact with the web app simultaneously through isolated processes per client connection. When a request comes in, a thread is allocated from the process thread pool to handle execution. In addition, the background reminder_handler function runs as a separate continually executing process for scheduling notifications. This allows reminders to run independently from the main web server workload. Python's GIL allows these multi-processed workflows.
-
File Handling: Reading and writing sqlite.db files to store and retrieve reminders, medications, and user data. This gives each user their own unique page that is tailored to their needs, and allows for a more variable usage.
-
Synchronization: Implementing locks to manage access to shared resources (e.g., reminders and medications) to avoid data corruption when multiple threads access them concurrently. This allows for better access to medications and reminders in a time priority manner.
-
Inter-Process Communication (IPC): Using HTTP methods like POST, GET, and DELETE for communication between the client (browser) and the server (Flask application) to perform actions like adding reminders, deleting records, and retrieving health metrics. The web application process coordinates with the independently executing reminder handler process using an in-memory data structure that acts as a shared queue. When new reminders are added via the web UI, they are appended to this queue accessible by both processes. This queue-based signaling allows loose coupling.
-
Memory Management: Python's memory manager implements heap allocation using a private heap space per interpreter process. When objects like medication log entries are created, memory is allocated on the heap. Periodic garbage collection frees up unused memory by releasing objects no longer referenced. This prevents leaks over long-running processes. Flask's stack manages request context data lifecycles.
The goal of this project is to create a software application that enhances the happiness and well-being of elderly individuals by aiding in their medication management. This involves applying knowledge and skills acquired in CMPSC 472 to develop a practical, user-friendly solution.
-
Enhance Medication Management with Secure User Authentication:
- Objective: Implement robust user authentication using Flask-Login to enable elderly users to securely sign up and log in. This ensures a safe and personalized environment for managing medication schedules and reminders.
- Rationale: Empower elderly individuals in medication management, alleviating stress associated with memory challenges and providing a tailored, secure user experience.
-
Facilitate Comprehensive Medication Tracking:
- Objective: Develop a sophisticated system for tracking and recording medication details, encompassing medication name, dose, date, and time. This empowers users to actively monitor and manage their medication history.
- Rationale: Promote proactive health management and assist users in adhering to medication schedules for improved overall well-being.
-
Craft an Intuitive and Accessible User Interface:
- Objective: Design a visually appealing and user-friendly graphical interface (GUI) that caters to the specific needs of elderly users. The goal is to ensure ease of use, accessibility, and inclusivity.
- Rationale: Address varying levels of technological familiarity among elderly individuals, making the application inviting and accommodating.
-
Implement Robust Data Storage for Medication and Reminders:
- Objective: Develop robust mechanisms for persistent storage of medication and reminder data. This enables users to access historical information, ensuring continuity of care.
- Rationale: Guarantee that users can review past medication details and reminders, facilitating long-term health tracking and personalized care.
-
Support Collaborative Caregiver Engagement:
- Objective: Provide features enabling caregivers to remotely view and manage medication-related information. This fosters collaboration and support for elderly individuals in their medication management.
- Rationale: Involve caregivers in the well-being of users, creating a collaborative approach to medication management and health tracking.
-
Promote Mental Health Awareness through Thoughtful Reminders:
- Objective: Implement features that encourage users and caregivers to stay aware of mental health through proactive reminders and insights derived from health data trends.
- Rationale: Contribute to a holistic well-being approach by promoting mental health awareness alongside considerations for physical health.
-
Address Digital Inclusivity for Older Users:
- Objective: Introduce technology in a manner that is accessible and welcoming to older individuals, bridging the digital divide and fostering a sense of inclusivity.
- Rationale: Promote social connection, reduce isolation, and encourage elderly users to engage with modern tools for their benefit.
-
Establish a Collaborative Health Management Ecosystem:
- Objective: Create a platform that encourages collaboration among users, caregivers, and potentially healthcare professionals. This aims to establish a supportive health ecosystem.
- Rationale: Ensure a comprehensive approach to health management, involving multiple stakeholders for the benefit of elderly individuals and fostering a sense of community.
This project is significant as it addresses a real-world problem faced by many elderly individuals - managing complex medication schedules. By providing a tool that assists in this task, the project contributes to the overall health and well-being of its users, ultimately enhancing their quality of life.
-
Empowering Medication Independence:
- The robust user authentication system, implemented using Flask-Login, empowers elderly users to independently manage their medications. The secure sign-up and login process ensures a personalized and private space for users to create and adhere to their medication schedules.
-
Comprehensive Medication Tracking:
- The project's sophisticated system for medication tracking, implemented in the
Medicationmodel, allows users to record and review detailed medication information, including name, dose, date, and time. This feature contributes to a comprehensive approach to health management.
- The project's sophisticated system for medication tracking, implemented in the
-
Accessible User Interface for the Elderly:
- The design of an intuitive graphical user interface (GUI) caters specifically to the needs of elderly users, promoting accessibility and inclusivity. This user-friendly interface ensures that individuals with varying levels of technological familiarity can easily navigate and utilize the application.
-
Persistent Data Storage for Continuity of Care:
- The implementation of persistent data storage mechanisms ensures that users can access historical medication and reminder data. This feature, seen in the usage of SQLAlchemy in the
MedicationandRemindermodels, facilitates continuity of care and supports long-term health tracking.
- The implementation of persistent data storage mechanisms ensures that users can access historical medication and reminder data. This feature, seen in the usage of SQLAlchemy in the
-
Remote Caregiver Collaboration:
- Features enabling caregivers to remotely view and manage medication-related information enhance collaborative care. The implementation allows caregivers to actively participate in the well-being of users, providing support and assistance as needed.
-
Promoting Mental Health Awareness:
- The project's emphasis on mental health awareness is evident through features that encourage users and caregivers to stay aware of mental health. Proactive reminders and insights derived from health data trends contribute to a holistic approach to well-being.
-
Addressing the Digital Divide:
- The introduction of technology in an accessible manner bridges the digital divide for older individuals. This not only facilitates technology adoption but also promotes social connection, reducing feelings of isolation among elderly users.
-
Creating a Supportive Health Ecosystem:
- The collaborative features in the project establish a supportive health ecosystem. Involving caregivers and potentially healthcare professionals ensures a comprehensive and well-rounded approach to health management, benefiting the elderly user community.
In summary, this project is not merely a technical solution but a compassionate and tailored initiative that directly addresses the unique challenges faced by the elderly population. Its significance lies in offering practical solutions that improve overall health, autonomy, and the quality of life for users, making a positive and meaningful impact on the community it serves.
- Manages user-related forms for registration, login, account update, password reset, and reset confirmation.
- Utilizes Flask-WTF for form creation and validation.
- Forms include:
RegistrationForm: Handles user registration.LoginForm: Manages user login.UpdateAccountForm: Allows users to update their account details.RequestResetForm: Manages the request for password reset.ResetPasswordForm: Handles the password reset process.
- Manages user-related routes for registration, login, logout, account management, password reset, and reset confirmation.
- Utilizes Flask routes for defining endpoints.
- Routes include:
/register: Handles user registration./login: Manages user login./logout: Allows users to log out./account: Handles user account management./reset_password: Manages the request for password reset./reset_password/<token>: Handles the password reset confirmation.
- Manages forms related to medication, specifically for adding new medications.
- Utilizes Flask-WTF for form creation and validation.
- Forms include:
NewMedicationForm: Allows users to input details for a new medication.
- Manages medication-related routes for viewing all medications, adding new medications, and deleting medications.
- Utilizes Flask routes for defining endpoints.
- Routes include:
/allMed: Displays a list of all medications./newMed: Handles the addition of a new medication./deleteMed/<int:id>: Manages the deletion of a medication.
- Manages routes related to reminders, including viewing reminders and adding new ones.
- Utilizes Flask routes for defining endpoints.
- Routes include:
/reminderHome: Displays a list of reminders./add_reminder: Manages the addition of a new reminder.
- Initializes the Flask application and connects it with the database, bcrypt, and Flask-Login.
- Registers blueprints for user, main, medication, and reminder functionalities.
- Starts a separate thread for a reminder handler, allowing for asynchronous reminder notifications.
User: Defines the structure of the user database table for storing user information.Medication: Defines the structure of the medication database table for storing medication details.Reminder: Defines the structure of the reminder database table for storing reminder data.
- Utilizes Flask extensions such as Flask-SQLAlchemy, Flask-Bcrypt, and Flask-Login for essential functionalities.
Configclass manages configuration settings for the application.
- Core logic for managing healthcare-related functionalities is distributed across the user, medication, and reminder blueprints.
- Each blueprint encapsulates related functionalities, ensuring a modular and organized code structure.
- With the use of the
templatesand thestylesfolder. This flask application offers a user-friendly front-end interface, which allows for the elderly to navigate through different pages, operating different tasks such as reminders, medications, etc.
-
Blueprints and Routes:
- Blueprints in Flask help modularize the application, allowing for separation of concerns. Each blueprint handles specific functionalities.
- Routes define the endpoints where users can access different features and functionalities.
-
Forms:
- Flask-WTF forms ensure data integrity and security by validating and processing user inputs before interacting with the database.
-
Database Models:
- Models define the structure of database tables, enabling efficient storage and retrieval of data. SQLAlchemy facilitates database interactions.
-
Core Configurations:
- Utilizes Flask extensions to enhance the core functionalities of the application.
-
Threading:
- Implements threading to handle asynchronous tasks, such as the reminder handler running in the background.
-
Code Flow:
- The application follows a logical flow where users can navigate through routes to perform actions such as authentication, medication management, and reminder creation.
This structure ensures a modular, organized, and maintainable codebase, making it easier to extend and enhance the functionality of the healthcare management system. Each component has a well-defined responsibility, contributing to a cohesive and scalable application architecture.
- Objective: Implement user signup and login functionality using Flask-Login.
- Details: Users can register an account, log in, and access personalized features.
Test 1: User Registration
- Steps:
- Navigate to the registration page.
- Fill in valid registration details.
- Click the "Sign Up" button.
- Expected Result: User account is created, and a success message is displayed.
Test 2: User Login
- Steps:
- Navigate to the login page.
- Enter valid login credentials.
- Click the "Login" button.
- Expected Result: User is successfully logged in, and the home page is displayed.
- Objective: Enable users to add, view, and delete medications.
- Details: Users can input medication details, view a list of medications, and delete entries.
Test 3: Add New Medication
- Steps:
- Access the "New Medication" page.
- Fill in medication details.
- Click the "Enter" button.
- Expected Result: The medication is added, and a success message is shown.
Test 4: View Medication List
- Steps:
- Navigate to the "All Medications" page.
- Expected Result: A paginated list of medications is displayed.
Test 5: Delete Medication
- Steps:
- Click on the "Delete" button next to a medication entry.
- Expected Result: The selected medication is deleted, and a success message is shown.
- Objective: Implement a reminder system for medication schedules.
- Details: Users receive reminders at specified times for their medication.
Test 6: Add Reminder
- Steps:
- Access the "Add Reminder" functionality.
- Set a reminder time and message.
- Click the "Add Reminder" button.
- Expected Result: The reminder is added, and the user receives a notification at the specified time.
Test 7: Reminder Notification
- Steps:
- Wait for a scheduled reminder time.
- Expected Result: A system notification is displayed with the reminder message.
- Objective: Enable users to update their account details.
- Details: Users can modify their username and email.
Test 8: Update Account Details
- Steps:
- Access the "Account" page.
- Modify username or email.
- Click the "Update" button.
- Expected Result: The account details are updated, and a success message is displayed.
- While the project implements user authentication, it's crucial to continually monitor and update security measures. Regular security audits and the incorporation of additional layers, such as two-factor authentication, could enhance user account protection.
- The reminder notification system, relying on subprocess calls and periodic checks, may face reliability issues, especially in high-traffic scenarios. Exploring more robust notification mechanisms and handling edge cases could enhance the reliability of reminders.
- The project showcases a solid understanding and application of the Flask web framework, leveraging its features such as blueprints, routes, forms, and database models effectively. This proficiency reflects the successful assimilation of course learnings.
- The use of SQLAlchemy for database management and ORM principles is evident in the well-defined models for users, medications, and reminders. Understanding how to structure and interact with databases aligns with the database design principles covered in the course.
- The implementation of threading for the reminder handler demonstrates the application of concurrent programming concepts. This aligns with the course teachings on handling background tasks asynchronously to maintain a responsive application.
- The incorporation of Flask-Login for user authentication reflects an understanding of secure user management. Utilizing Flask-Login aligns with the course emphasis on implementing secure authentication mechanisms in web applications.
- Introduce more advanced medication tracking features, such as dosage history and adherence statistics. This could provide users with a comprehensive overview of their medication management.
- Extend the application to include the tracking of additional health metrics beyond medication, such as blood pressure, heart rate, and other relevant data. This expansion aligns with the goal of creating a holistic health management system.
- Invest in further refining the user interface to ensure a seamless and intuitive user experience. Incorporate user feedback to enhance usability and accessibility, especially for elderly users.
- Develop a comprehensive testing suite covering unit tests, integration tests, and end-to-end tests. This will help identify and address potential issues early in the development process, contributing to a more reliable and maintainable application.
- Explore features that facilitate collaboration among users, caregivers, and healthcare professionals. This could involve secure data sharing, real-time updates, and communication functionalities to create a collaborative health ecosystem.
- Implement automated testing and continuous integration practices to streamline the development process. This ensures that new code changes are thoroughly tested and integrated seamlessly, reducing the risk of introducing bugs.
- Consider integrating machine learning algorithms to predict medication adherence based on historical data. This predictive capability could provide proactive reminders and insights into potential adherence challenges.
- Place a strong emphasis on accessibility considerations, especially for elderly users. Ensure that the application complies with accessibility standards, making it inclusive and usable for individuals with diverse needs.
In conclusion, while the project demonstrates a solid foundation, future improvements can further elevate its capabilities, user experience, and overall impact on healthcare management. Addressing identified limitations and embracing continuous improvement will contribute to the project's long-term success and relevance.




