Mentors API
├── apps
│ ├── api
│ │ ├── api_v1.py
│ │ ├── __init__.py
│ │ └── views
│ │ ├── mentor.py
│ │ └── ping.py
│ ├── docs
│ │ └── docs.yml
│ └── __init__.py
├── conf
│ ├── config.py
│ └── __init__.py
├── cronfile-dev
├── cronfile-prod
├── data-source
│ ├── sample-2.csv
│ └── sample.csv
├── docker-compose.yml
├── Dockerfile
├── Dockerfile.dev
├── heroku.yml
├── init-dev.sh
├── init-prod.sh
├── jparser
│ ├── __init__.py
│ └── parser.py
├── Makefile
├── manage.py
├── models
│ ├── cme.py
│ ├── drill.py
│ ├── __init__.py
│ ├── mentor.py
│ └── mixin.py
├── pytest.ini
├── README.md
├── requirements.txt
└── tests
├── __init__.py
├── stubs
│ └── output.json
├── test_config.py
├── test_endpoints.py
├── test_models.py
└── test_pasrer.py
METHOD | ENDPOINT | DESCRIPTION |
---|---|---|
GET | /api/v1/ping | Ping to check if API is up |
GET | /api/v1/metorships | Get a list of mentorships |
GET | /apidocs | The swagger documentaion for the api |
The API is hosted on heroku
NOTE: The datbase has data from processing the case on sheet 3 (EXAMPLE OUTPUT FROM A SINGLE CASE)
The swagger docs can be found on https://jparser-api-7097118d0ae3.herokuapp.com/apidocs which can be used for testing the api
NOTE: - The API runs on Free Heroku Dyno with 512MB RAM and sleeps periodically
Ensure the following ports are not in use
- 8003
- 8078 (adminer web interface to manage postgres)
The docker-compose file contains the components needed to the services. In the root project directory, boot up the services in the docker compose file using
docker-compose up
NOTE: The swagger docs can be found on https://jparser-api-7097118d0ae3.herokuapp.com/ which can be used for testing the api
The cron is set up to run every minure for test purposes and can be modified here
Python 3.8 + is required
While still in the root directory of the project. You can create a virtual environment in the folder using
python{PYTHON_VERSION} -m venv mentors
You can activate the environment using
source mentors/bin/activate
To install dependencies.
(venv) make init
To run unit tests
(venv) make unit_tests
To run all tests with coverage report .
(venv) make test_coverage
A web interface(while docker-compose services running) to check the database can be found on
- http://localhost:8078/?pgsql=mentors-db&username=postgres&db=mentors
- password is
postgres
To run cron ensure all the services are running docker-compose up
Set the required environmental variables using
(venv) source .env-cli
Run the cron via
(venv) export FLASK_APP=manage.py && python manage.py read "./data-source/sample-2.csv"
- The file sheet to extracted can be uploaded to the server as csv or the csv will publicly acessible on providers like s3 etc
- Set up cron for on heroku
- Improve code comments and remove code smells
- Improve swagger docs