Development Setup Guide - irinkobela/MEDICARD-HMS GitHub Wiki

๐Ÿ›  Development Setup Guide โ€“ MEDICARD-HMS Welcome to the MEDICARD-HMS project! This guide will walk you through setting up your development environment for both the backend and frontend of this doctor-centered Hospital Management System.

๐Ÿ“ฆ Prerequisites Before you begin, ensure the following tools are installed on your machine:

General Tools Git

Python 3.10+

pip and venv (bundled with Python)

Node.js (v18+)

npm (comes with Node.js)

PostgreSQL (v14+)

Docker (optional, for containerized setups)

๐Ÿš€ Getting Started

  1. Clone the Repository bash Copy Edit git clone https://github.com//MEDICARD-HMS.git cd MEDICARD-HMS ๐Ÿง  Backend Setup (Flask + PostgreSQL)
  2. Set Up Python Environment bash Copy Edit

Create virtual environment

python -m venv venv

Activate virtual environment

source venv/bin/activate # On Windows: venv\Scripts\activate 3. Install Backend Dependencies bash Copy Edit pip install -r requirements.txt Note: Ensure requirements.txt includes Flask, SQLAlchemy, Flask-Migrate, etc.

๐Ÿ›ข Database Setup 4. Create PostgreSQL Database Log in to psql and run:

sql Copy Edit CREATE DATABASE medicard_hms; CREATE USER medicard_user WITH PASSWORD 'your_secure_password'; GRANT ALL PRIVILEGES ON DATABASE medicard_hms TO medicard_user; โš™๏ธ Configuration 5. Create and Configure .env Copy the sample file:

bash Copy Edit cp .env.example .env Edit .env with your credentials:

ini Copy Edit SECRET_KEY=your_very_strong_random_secret_key DATABASE_URL=postgresql://medicard_user:your_secure_password@localhost:5432/medicard_hms FLASK_APP=run.py FLASK_ENV=development 6. Run Database Migrations bash Copy Edit flask db upgrade (Use flask db init and flask db migrate -m "Initial" if setting up Flask-Migrate for the first time)

๐Ÿงช Running the Backend bash Copy Edit

Make sure virtualenv is active

flask run Your backend should now be running on http://127.0.0.1:5000/

๐ŸŒ Frontend Setup (React) 7. Navigate to Frontend Directory bash Copy Edit cd frontend 8. Install Dependencies and Start Dev Server bash Copy Edit npm install npm start Frontend will run on http://localhost:3000/

โœ… Running Tests Backend Tests (using pytest) bash Copy Edit

Ensure test dependencies are installed

pytest Add more test cases in the /tests directory as development progresses.

๐Ÿค Contribution Notes Follow PEP 8 and use type hints where possible.

Use feature branches (git checkout -b feature/your-feature) and submit Pull Requests to main.

Include tests for new features and verify with pytest.

๐Ÿ“Ž Additional Notes You will need to create the .env.example, requirements.txt, and LICENSE files manually if not already present.

Docker support can be added later for easier setup (e.g., Docker Compose for DB + backend).