A web-based application for managing patient information in clinical trials. This system allows users to add, view, edit, and delete patient records while ensuring a user-friendly interface and robust backend functionality. Built using Flask, SQLAlchemy, and Jinja2, the project seamlessly integrates front-end design and back-end logic for managing clinical data efficiently.
- Add Patients - Input patient details such as name, age, medical condition, and trial status
- Edit Existing Patient Data - Modify existing patient details dynamically
- Delete Patient - Remove patient data with a confirmation prompt to prevent accidental deletion
- View Patient List - Display all patient records in a table format
- Responsive Design - User-friendly interface with a clean and modern design
- Python - Core programming language for backend logic
- Flask - Framework for routing, handling HTTP requests, and managing server-side logic
- SQLite - Lightweight database for storing and managing patient data
- SQLAlchemy - Object-Relational Mapping (ORM) library for interacting with SQLite database
- HTML - Structuring the web pages for displaying patient information and forms
- CSS - Styling the interface to make it visually appealing and user-friendly
- JavaScript - Adding interactivity, such as the confirmation dialog for deleting a patient
- Jinja2 - Template engine for dynamically rendering HTML content based on backend data
- Python 3.10+
- Flask
- Flask-SQLAlchemy
- Clone the Repository
git clone https://github.com/thaokvu/clinical-data-capture.git
cd clinical-data-capture- Install Dependencies
pip install -r requirements.txt
# If you don't have a requirements.txt, manually install the dependencies
pip install flask flask-sqlalchemy- Set up the Database
from main import db, app
with app.app_context():
db.create_all()
# You can manually create the database tables by ensuring the db.create_all() function is executed in the app.py file- Start the Application
python main.py- Access the Application
Open a web browser and go to the following URL -
http://127.0.0.1:5000/
This project follows a simple and organized structure to make the codebase easy to understand and maintain.
static/style.css- Contains custom CSS to style the web pages and improve the user interfacetemplates/- Holds all the HTML templates for the web applicationadd_patient.html- Displays the form for adding a new patientindex_html- The main page that lists all patients in the databaseedit_patient.html- Displays the form for editing patient details
clinical_data.db- The SQLite database file where patient information is stored; it is auto-generated when the application is run for the first timemain.py- The main Flask application file that contains the app routes and logicrequirements.txt- Lists all the Python dependencies required to run the project- README.md - Project documentation that explains how to set up and use the application
- Add a Patient
- Fill in the patient's name, age, medical condition, and trial status
- Click the "Add Patient" button on the homepage to submit the form to add the patient to the database.
- Edit Patient Data
- Click the "Edit" button in the patient's row on the homepage
- Update the details in the form and save changes
- Delete a Patient
- Click the "Delete" button in the patient's row on the homepage
- View All Patient
- The homepage displays a list of all patients in a table format, including their details and actions
http://127.0.0.1:5000/
- The table should display patient details (name, age, condition, trial status) with action buttons for "Edit" and "Delete".
http://127.0.0.1:5000/add_patient
- Users can input details for a new patient.
http://127.0.0.1:5000/edit_patient/1
- Users can update patient information. The form is pre-filled with existing patient details for easy editing.
- Confirmation dialog that appears when the "Delete" button is pressed. The dialog helps prevent accidental deletions by asking the user for confirmation before proceeding.