GithubHelp home page GithubHelp logo

wadkar / backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gocorona-org/backend

1.0 1.0 0.0 28.48 MB

License: GNU General Public License v3.0

Python 38.78% HTML 11.98% CSS 0.59% JavaScript 10.95% Dockerfile 1.17% Jupyter Notebook 30.87% C++ 2.91% Shell 2.37% Makefile 0.18% Batchfile 0.21%

backend's Introduction

SpotCorona Backend

1. Installation

1.1. Setup Prerequisites

  1. Install python3 and docker
  2. Install python3 dependencies in one go from root folder : cd ./api && pip3 install --no-cache-dir -r requirements.txt

Manual Installation (In case the previous step fails on your system)

Numpy (pip install numpy)
Pandas (pip install pandas)
Django (pip install django)
Django rest framework (pip install djangorestframework)
Django pandas (pip install django_pandas)
Django rest multiple models (pip install django-rest-multiple-models)
psycopg2 (pip install psycopg2)
Shapely (pip install Shapely)
Geopandas (some of it’s pre-requirements)  (pip install geopandas)

There may arise some problems\errors while installing geopandas, check if versions match the ones in ./api/reqirements.txt

In this case download the latest, compatible GDAL .whl file (Ex. if your OS is windows 64 bit, and if your python version is 3.6, download GDAL-3.0.4-cp36-cp36m-win_amd64.whl) from this website: https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

Run :

pip install /path/to/GDAL-***.whl

Repeat the above steps for Fiona:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona

Now Run:

pip install geopandas

1.2. Setup postgres database

Install in one go : cd ./containers/postgres && ./start_postgres.sh

Perequisites: Should have docker installed in the system, should know/set the db password

Manual Installation (In case docker install fails, or you want to view the database using PgAdmin GUI )

Download the package from this website: https://www.postgresql.org/download/

Click on the download the installer and click on the latest version for your OS to download.

Run the installer. Select all the packages to be installed.

While the installer runs it asks for a password setup for the superuser: postgres

Default we are using spotcorona. Do not use this in a production environment

Complete the installation

Open pgAdmin from start menu.

Once it opens in the web browser, Authorize with your password.

In the browser panel on the left, right click on Databases and create a new database with the name: corona_project.

You would not see any tables yet because they havent been populated from the django project.

Export the password using export DB_PASSWORD=your_password for the next step.

1.3. Setup Django Server

Install in one go : cd ./containers/server && ./start_server.sh

Manual Installation (In case start server fails, or you want to host online)

  1. If hosting, ssh into your machine, eg ssh -i covidkey.pem [email protected] and git clone https://github.com/GoCorona-org/Backend.git. Else skip this step.
  2. In Command terminal
    1. Go to the directory $ ./api
    2. To make the server avaliable globally add your public IP to the ALLOWED_HOSTS field in ./api/corona_project/settings.py
    3. Run: python manage.py makemigrations corona_app
    4. Run: python manage.py sqlmigrate corona_app 0001_initial
    5. Run: python manage.py migrate After this you can check the corona_project database/schemas/tables in the pgAdmin if installed. Right click and refresh. you can see the corona_app_coronaapp and corona_app_medicalmap tables
    6. Run: python manage.py runserver
  3. Open http://127.0.0.1:8000/report in your browser

2. API

The reference doc for the Backend API is https://github.com/GoCorona-org/Backend/blob/master/docs/swagger.yaml ( swagger.yaml in docs folder)

Copy paste the yaml files into https://editor.swagger.io/ to view the api.

3.Release Notes

Release 0.0.1

  1. Refactored the folders
  2. Moved gocorona_api (@wadkar's folder) to experimental, until code maturity.
  3. Moved intersection and medical folders to experimental, to be deprecated in the next release.
  4. Added helpful bash scripts and readmes in order to get started faster.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.