BuddhaNexus / buddhanexus

Backend for the Buddhanexus project
8 stars 2 forks source link

buddhanexus

Backend for the Buddhanexus project.

Includes:

Guide:

0. Frontend

The frontend README can be found inside ./frontend/README.md. The rest of this file concerns the python backend (dataloader+api+db)

1. Setup:

1.1: Install docker and docker-compose:

1.2 Obtain the project files:

Clone the project repository:

git clone ThisRepository && cd buddhanexus

(substitute ThisRepository with the corect filepath)

Also, in order to load the segment data, it is necessary to create the segment docker volume beforehand:

git clone https://github.com/dharmamitra/dharmanexus-data ; cd dharmanexus-data; make build; make init

This will make sure that the database loads segment files that are valid and up to date.

The match data is a lot and cannot be stored on github. It should be placed in a folder outside of the backend repository. The following variable in the .env configuration needs to point to the local folder with the match data (bo, sa, zh, pa):

LOCAL_MATCHES_PATH=/patch/to/matches/

1.3 Install our githooks:

This project uses pre-commit to maintain code style and format it using black.

2. Running:

The API should now be accessible on port 8000.

The API Documentation is also available in the /docs folder. If running on a local machine, the address is [http://localhost:8000/docs].

3. Loading the segment data

So far the database is empty. To populate it, do the following:

Experimental feature:

There is also an additional command called make load-data-async, which speeds up the data loading process by running it in parallel. This might overload the database depending on system resources. The number of threads can be modified in the Makefile.