- You must have the Rust Programming Language Stable Toolchain, read more here
- You may need to install
libmysqlclient
to run the migrations with diesel-cli, read more here and here
- Download de complete dataset here, there are multiple csv files per period, the one you want to download is
Carpetas de Investigación de la FGJ (Completa)
. - Run the program that cleans and splits the dataset into multiple csv files. Be aware, this program places all results at
./results/
, thus creates a directory at your current directory.
cargo run --package clean --release -- ./path/to/the/downloaded/dataset.csv
- Install the
diesel-cli
, you need to make sure you have the necessary dependencies. To install the cli program only for mariadb run:
cargo install diesel_cli --no-default-features --features mysql
-
Create a user named
bdavan
with password1234567890
or change the environment variableDATABASE_URL
at the.env
file to suit your existing setup. Make sure the user has full permissions ondelitos.*
. There is an example at the Arch wiki. -
Create the database. This is an easy step since
diesel-cli
will read the SQL files located atmigrations/
and create the database, plus all tables. For this step to work diesel reads theDATABASE_URL
from the.env
file, hence the credentials on the file must be correct for diesel to access and do the necessary actions on the given databse with the given user/password combination.
diesel database setup
- Insert the data. To do this source the file
./results/insert.sql
from within MySql/MariaDB. You may need to open the database client from inside the./results/
directory.
source insert.sql
- To run the server just execute the following command, now you should be able to open
http://localhost
in your browser.
cargo run --release