Skip to content

Back-end of the advisor.ai project, an article search and recommendation platform focused on promoting collaboration between researchers using AI.

License

Notifications You must be signed in to change notification settings

William-Fernandes252/advisor.ai-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

advisor.ai Back-end

Back-end of the advisor.ai project, an article search and recommendation platform focused on promoting collaboration between researchers using AI.

Built with Cookiecutter Django GitHub license Ruff

Settings

See the settings specification at settings.

Development

This project uses Docker, both in development and in production, to run all its services inside containers.

Requirements

  • Docker 26.0.1 (installation guide here)
  • Docker Compose 2.24.6

Run locally

In order to run all the back-end services loccaly, execute

docker compose -f local.yml up

Setting up users for testing

  • 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

Type checks

Running type checks with mypy:

mypy apps

Running tests

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.

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report:

coverage run -m pytest
coverage html
open htmlcov/index.html

Training machine learning models

There are management commands to help testing models training and the generation of papers recommendations.

If you want to test the recommendation system locally,

  1. 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
  2. export the papers reviews data with

    docker compose exec -it django python manage.py exportdatasets
  3. train a machine learning model with

    docker compose exec -it django python manage.py trainmodel
  4. 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.

Email Server

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

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.

Deployment

The following details how to deploy this application.

Docker

See detailed cookiecutter-django Docker documentation.

About

Back-end of the advisor.ai project, an article search and recommendation platform focused on promoting collaboration between researchers using AI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published