This application is a web-based health management system with two primary user roles: User (patients) and Doctor. The system allows users to register, log in, track their health data, book appointments, and manage account settings. Doctors can manage patient health records, view and manage schedules, and update appointment statuses.
-
User Account
Username: kerwin Password: 123456
-
Doctor Account
Username: doctor Password: 123456
-
Python: Ensure Python 3.x is installed. Check the installation with:
python3 --version
-
Install required libraries: Run the following command to install necessary dependencies:
pip install flask bcrypt cryptography matplotlib sqlite
To keep dependencies isolated, create a virtual environment:
python3 -m venv venvActivate the virtual environment:
Windows:
venv\Scripts\activateLinux:
source venv/bin/activate-
Start the Flask Server: Run the following command in your terminal:
python app_nosql.py
-
Access the Application: Open a web browser and navigate to:
http://127.0.0.1:5000
The secret key in app.py secures sessions and flash messages:
app.secret_key = ‘your_secret_key’Replace 'your_secret_key' with a unique secure key, e.g., generated by Python:
import secrets
secrets.token_hex(16)Update the generated key in app.py:
Copy code
app.secret_key = 'generated_secret_key'Application Port and Debug Mode By default, the application runs on port 5000 with debug mode enabled:
app.run(debug=True)Debug mode is useful during development but should be disabled in production for security:
app.run(debug=False)-
User Registration:
- On the main page, click Register to create an account.
- Complete the registration form with:
- Username
- Password (encrypted and stored securely)
- Phone Number
- Address
- Click Submit to create the account. On successful registration, you’ll be redirected to the login page. If an error occurs (e.g., duplicate username), a message will be displayed.
-
Login:
- On the main page, enter your Username and Password.
- Click Login to access the appropriate dashboard (User or Doctor).
- Incorrect credentials will display a login failure message.
-
User Dashboard:
- As a regular user, the User Dashboard provides health data tracking and visualizations.
- Features include:
- Health Data Visualization: View blood pressure and blood sugar levels over time as bar charts (images saved in the static/images folder).
- Health Data Submission: Users can submit new blood pressure and blood sugar data.
-
Doctor Dashboard:
- Doctors have access to the Doctor Dashboard, which allows them to manage patient health records and schedules.
- Key Features:
- Patient Data Access: View patient health history, such as blood pressure, blood sugar, and prescribed medications.
- Appointment Schedule: Access upcoming appointments and manage clinic schedules.
-
Appointment Management:
- Users can view available appointment slots and book a convenient time.
- Booking:
- Go to the Appointments page.
- Select an available date and time slot and confirm.
- Cancelling and Editing:
- Users can cancel or edit existing appointments from their dashboard.
-
User Health Data Submission:
- To log health metrics:
- Go to the User Health section.
- Enter Blood Pressure and Blood Sugar values.
- Click Submit to save the data. The data is timestamped and stored in the
user_healthtable.
- To log health metrics:
-
Account Management:
- Update account details, including Email, Phone Number, and Address in Settings.
- Change Password: Enter a new password and confirm it to update securely.
- Delete Account: Users can delete their accounts, which will remove all associated data.
-
Logout:
- Click Logout to securely end your session.
-
Debugging Mode: Debug mode (
app.run(debug=True)) provides detailed error messages and line-by-line issues in the console, helping identify specific errors during development. -
Session Issues: If encountering session errors (e.g., login problems), check that the
secret_keyinapp.pyis set securely. -
Matplotlib Visualization Issues: Ensure
matplotlibis installed and correctly imported. If visualizations don’t display correctly, verify the path to saved images (e.g.,static/images/bpchart.pngandstatic/images/bschart.png) inuser_dashboard.html.
By following these steps, you should be able to resolve most common issues encountered during setup and usage of the application.