README.md

February 2, 2022 ยท View on GitHub

HIDTCOPHospitalApi

10 bed hospital backend.

With Docker Compose

For setting up with docker compose for local deployment, see DOCKER.md.

File and Folder Structure

/alembic # Migration files
/apis # Routes
    /base.py # Where all the routes are grouped
    /routes # Routes
/config # Main configuration
    /config.py # configurations
/core
    /entity # entity
    /protocol # abstract of repository
    /services # services
/decorators # Decorators
/exceptions # Custom exceptions
/infrastructure
    /models # Database table models
    /repository # All database related operations/functions
    /session.py # Database session
    /base_class.py # Base Class for table models
    /base_mixin.py # Base Mixin for timestamp and created by
    /base_repo.py # Base Class for repository with basic CRUD features
    /base.py # Where all table models are grouped
/schemas # Request and response models
/utils # Services
    /hashing.py # Hashing
    /JWTtoken.py # JWTtoken
    /oauth2.py # Oauth2
main.py # App Entry Point
.env.example # Example for ".env"

Development setup

First create a directory then create a virtual environment in it (PLEASE USE VIRTUAL ENVIRONMENT).

python3 -m venv <your-env-name>

To activate your virtual environment go to

On Window :

<your-env-name>\Scripts\activate.bat

On Unix or MacOs :

source <your-env-name>/bin/activate

Finally git clone the repository.

git clone https://github.com/thamardaw/HIDTCOPHospitalApi.git

Then go into the cloned folder and install requirements (we will be continue working on this directory). While installing setup the ".env" file.

pip install -r requirements.txt

Migrate your models into database.

# to create or update the models to database
alembic upgrade head

Now let's start your server.

uvicorn main:app --reload

Useful commands

if you installed new packages during development, don't forget to update the requirement.

pip freeze > requirements.txt

This command is for auto generating the migration files if you add new models or make changes to your existing model. Then don't forget to mirgrate the changes.

alembic revision --autogenerate -m "init"