Health Care Backend API
A REST API for managing patient records and authentication in a Health Care project.
📑 Table of Contents
- Features
- Requirements
- Installation
- Project Structure
- Configuration
- API Documentation
- Development
- Contact
Features ✨
- Patient record management: create, update, delete, and retrieve records
- File processing: securely process and validate healthcare data from Excel files
- Authentication: secure JWT-based user authentication and role-based access control
- Database operations: efficient handling of MySQL operations
- Data security: secure handling of personal health information
Requirements 🛠
Core Dependencies
- Python 3.10+
- MySQL Server
- pip package manager
Python Packages
python-multipart==0.0.6
fastapi[standard]==0.100.0
uvicorn==0.23.0
pydantic==2.0
python-dotenv==1.0.0
requests==2.31.0
pandas==2.0.3
openpyxl==3.1.2
mysql-connector-python==8.1.0
Installation 🚀
- Clone the repository
git clone <repository-url> cd healthcare-backend
- Create and activate virtual environment
python -m venv venv venv\Scripts\activate source venv/bin/activate source venv/Scripts/Activate
- Install dependencies
pip install -r requirements.txt
Project Structure 📦
healthcare-backend/
├── database/ # Database related files
│ ├── MySQLConnection.py # Database connection handler
│ ├── PatientService.py # Patient data services
│ ├── script_sql.sql # Database schema
│ └── temp/ # Temporary files
├── models/ # Data models
│ ├── ErrorMsg.py # Error message definitions
│ ├── Patient.py # Patient model
│ ├── ResultResponse.py # API response models
│ └── Token.py # Authentication token model
├── Dockerfile # Container configuration
├── healthcare.py # Main application file
└── requirements.txt # Project dependencies
Configuration ⚙
Database Setup
- Create a MySQL database named
db_healthcare
- Configure your database connection:
DB_CONFIG = { "host": "localhost", "user": "root", "password": "2802", "database": "db_healthcare" }
Environment Variables
Create a .env
file in the root directory:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=2802
DB_NAME=db_healthcare
JWT_SECRET=your_jwt_secret
API Documentation 🔌
Authentication Endpoints
Method | Endpoint | Description |
---|---|---|
POST | /login | User authentication |
POST | /logout | User logout |
POST | /validate_token | Validate authentication token |
Patient Management
Method | Endpoint | Description |
---|---|---|
GET | /patient-record | Retrieve patient records |
POST | /process-file | Process patient data file |
Sample Request
curl -X POST http://localhost:8000/login \
-H "Content-Type: application/json" \
-d '{"username": "user", "password": "pass"}'
Development 💻
Running the Application
# Development mode
uvicorn healthcare:app --reload
# Production mode
uvicorn healthcare:app --host 0.0.0.0 --port 8000
Using Docker
# Build image
docker build -t healthcare-backend .
# Run container
docker run -p 8000:8000 healthcare-backend
Health Care Front-End API
This project is the front-end of a healthcare web application. It includes a page to upload an Excel file with patient information to the database and has another page to register users. The application consists of two pages, each designed for a specific function within the user’s workflow.
Index
🛠️ Frontend Prerequisites
- Visual Studio Code
- node_modules == 22.11.0
- vite
- Git
- SSH key (for repository cloning)
- Live Server extension for VS Code
- Web browser
🚀 Frontend Setup and Development
- Clone the repository
git clone <repository-url> cd healthcare_frontend
- Open the project in Visual Studio Code:
code .
- Install the Live Server extension:
- Open the Extensions view in VS Code (Ctrl+Shift+X)
- Search for “Live Server”
- Click “Install” on the extension by Ritwick Dey
-
Install dependencies:
npm install npm install vite --save-dev
- Run the project:
npm run dev
- The application will open in your default web browser using a local server (usually ` http://localhost:5173/` or similar)
- Development:
- Make changes to your HTML, CSS, or JavaScript files
- Save the files
- The browser will automatically refresh to show your changes
📋 Frontend Functionalities
🏠 Home (Home.jsx)
The Landing Page section provides users with an interface where they can upload xlsx files to save the information they contain in the database.
✏️ Patient Records (PatientRecords.jsx)
The Landing Page section provides users with an interface where they can search for specific patient information in the database.
Contact 📌
If you have any questions or suggestions, feel free to open an issue or contact me at [felixdavidsuarezbonilla@gmail.com].