Back-end of the advisor.ai project, an article search and recommendation platform focused on promoting collaboration between researchers using AI.
See the settings specification at settings.
This project uses Docker, both in development and in production, to run all its services inside containers.
- Docker
26.0.1
(installation guide here) - Docker Compose
2.24.6
In order to run all the back-end services loccaly, execute
docker compose -f local.yml up
- To create normal user accounts for testing, use the command:
python manage.py createfakeusers
- To create a superuser account, use this command:
python manage.py createsuperuser
Running type checks with mypy:
mypy apps
For automation of unit and integration tests in the back-end, pytest is being used.
To just run all the test suites, execute
pytest
or
docker compose -f local.yml exec django pytest
to run inside the container.
To run the tests, check your test coverage, and generate an HTML coverage report:
coverage run -m pytest
coverage html
open htmlcov/index.html
There are management commands to help testing models training and the generation of papers recommendations.
If you want to test the recommendation system locally,
-
create some fake users (between 50k and 100k should be enough) to hold the reviews with
docker compose exec -it django python manage.py createfakeusers 50000
-
export the papers reviews data with
docker compose exec -it django python manage.py exportdatasets
-
train a machine learning model with
docker compose exec -it django python manage.py trainmodel
-
and finally, create suggestions using the trained model by running
docker compose exec -it django python manage.py createpaperssuggestions --offset=25 --max=250
Note that this process can take some time to complete and may fail in machines with slower CPUs and little memory. If that is your case, I recommend you to try to limit the number of users covered by the
batch_create_papers_suggestions
method here
Now, you should be able see the suggestions for your user on GET /papers/suggestions
.
A local SMTP server Mailpit, with a web interface, is available as a docker container to allow the visualization of the emails that are being set from the application by the developers.
Container mailpit will start automatically when you will run all docker containers. Please check cookiecutter-django Docker documentation for more details how to start all containers.
With Mailpit running, to view messages that are sent by your application, open your browser and go to http://127.0.0.1:8025
Sentry is an error logging aggregator service. You can sign up for a free account at https://sentry.io/signup/?code=cookiecutter or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
The following details how to deploy this application.
See detailed cookiecutter-django Docker documentation.