... | @@ -14,7 +14,7 @@ Updated with v1.0. |
... | @@ -14,7 +14,7 @@ Updated with v1.0. |
|
* [8. Updating the table data](#8-updating-the-table-data)
|
|
* [8. Updating the table data](#8-updating-the-table-data)
|
|
|
|
|
|
## 1. Setting your environment
|
|
## 1. Setting your environment
|
|
In this section we'll look at how to get MonetDB working with hotmapper.
|
|
In this section we'll look at how to get MonetDB working with HOTMapper.
|
|
#### Important:
|
|
#### Important:
|
|
The MonetDB Apr2019 (11.33.3) version should be avoided, because it has a bug when inserting into a table with multiple constraints. It's already fixed in their nightly build so you should be fine using any superior version or the August2018 one.
|
|
The MonetDB Apr2019 (11.33.3) version should be avoided, because it has a bug when inserting into a table with multiple constraints. It's already fixed in their nightly build so you should be fine using any superior version or the August2018 one.
|
|
|
|
|
... | @@ -44,7 +44,7 @@ Install python3-venv, if you don't have it, using the command bellow. |
... | @@ -44,7 +44,7 @@ Install python3-venv, if you don't have it, using the command bellow. |
|
$ sudo apt-get install python3-venv
|
|
$ sudo apt-get install python3-venv
|
|
~~~
|
|
~~~
|
|
|
|
|
|
Inside the hotmapper folder execute the following commands:
|
|
Inside the HOTMapper folder execute the following commands:
|
|
~~~Bash
|
|
~~~Bash
|
|
$ python3 -m venv env
|
|
$ python3 -m venv env
|
|
$ source env/bin/activate
|
|
$ source env/bin/activate
|
... | @@ -52,9 +52,9 @@ $ pip install -r requirements.txt |
... | @@ -52,9 +52,9 @@ $ pip install -r requirements.txt |
|
~~~
|
|
~~~
|
|
|
|
|
|
## 2. Adjusting your HOTMapper Settings
|
|
## 2. Adjusting your HOTMapper Settings
|
|
Now that you have a working monetdb database it's needed to verify the HOTMapper settings to be sure it'll work with it.
|
|
Now that you have a working MonetDB database it's needed to verify the HOTMapper settings to be sure it'll work with it.
|
|
|
|
|
|
First, using your favourite editor, open the file settings.py contained inside your HOTMapper folder.
|
|
First, using your favourite editor, open the file `settings.py` contained inside your HOTMapper folder.
|
|
|
|
|
|
Set the DATABASE variable to yours.
|
|
Set the DATABASE variable to yours.
|
|
|
|
|
... | @@ -69,7 +69,7 @@ should already be correct and the folders already exist. |
... | @@ -69,7 +69,7 @@ should already be correct and the folders already exist. |
|
If you want to learn more about all settings of HOTMapper, head to our [Settings page in the wiki](../Settings)
|
|
If you want to learn more about all settings of HOTMapper, head to our [Settings page in the wiki](../Settings)
|
|
|
|
|
|
## 3. Creating your table definition
|
|
## 3. Creating your table definition
|
|
The HOTMapper tool uses two files to create a table, a json inside the table_definitions folder and a csv present on the
|
|
The HOTMapper tool uses two files to create a table, a json inside the table_definitions folder and a CSV present on the
|
|
mapping_protocols folder. Both should have as name of the file: "table name + extension". Ex: table_test.json,
|
|
mapping_protocols folder. Both should have as name of the file: "table name + extension". Ex: table_test.json,
|
|
table_test.csv.
|
|
table_test.csv.
|
|
|
|
|
... | @@ -104,7 +104,7 @@ The map protocol file is used to store the information about the table columns a |
... | @@ -104,7 +104,7 @@ The map protocol file is used to store the information about the table columns a |
|
from the csv and the database. This file is stored inside the mapping_protocols folder and uses as name the "table name
|
|
from the csv and the database. This file is stored inside the mapping_protocols folder and uses as name the "table name
|
|
\+ .csv"
|
|
\+ .csv"
|
|
|
|
|
|
This csv must contain the following columns:
|
|
This CSV must contain the following columns:
|
|
* Var. Lab -- An unique identifier for the column, this represents a specific column for the HOTMapper and shouldn't
|
|
* Var. Lab -- An unique identifier for the column, this represents a specific column for the HOTMapper and shouldn't
|
|
be changed after table creation.
|
|
be changed after table creation.
|
|
* Novo Rótulo -- A description of this column.
|
|
* Novo Rótulo -- A description of this column.
|
... | @@ -148,7 +148,7 @@ If you want to learn more about the Mapping Protocol, click [here.](../Mapping-P |
... | @@ -148,7 +148,7 @@ If you want to learn more about the Mapping Protocol, click [here.](../Mapping-P |
|
|
|
|
|
## 5. Creating the table in the database
|
|
## 5. Creating the table in the database
|
|
|
|
|
|
To create the table in your database we'll execute the hotmapper command 'create'. In the following way:
|
|
To create the table in your database we'll execute the HOTMapper command `create`. In the following way:
|
|
~~~bash
|
|
~~~bash
|
|
$ ./manage.py create <table_name>
|
|
$ ./manage.py create <table_name>
|
|
~~~
|
|
~~~
|
... | @@ -159,7 +159,7 @@ $ ./manage.py create table_test |
... | @@ -159,7 +159,7 @@ $ ./manage.py create table_test |
|
|
|
|
|
## 6. Inserting the data into the table
|
|
## 6. Inserting the data into the table
|
|
|
|
|
|
To insert the csv data into the table, we'll use the hotmapper command 'insert' in the following way:
|
|
To insert the CSV data into the table, we'll use the HOTMapper command `insert` in the following way:
|
|
~~~bash
|
|
~~~bash
|
|
$ ./manage.py insert <file_location> <table_name> <year> --sep=<optional, csv separator>
|
|
$ ./manage.py insert <file_location> <table_name> <year> --sep=<optional, csv separator>
|
|
~~~
|
|
~~~
|
... | @@ -174,7 +174,7 @@ $ ./manage.py insert ~/hotmapper/open_data/EAG_GRAD_RATES_2016.csv table_test 20 |
... | @@ -174,7 +174,7 @@ $ ./manage.py insert ~/hotmapper/open_data/EAG_GRAD_RATES_2016.csv table_test 20 |
|
* To remove a column, first delete it from the protocol.
|
|
* To remove a column, first delete it from the protocol.
|
|
* To rename a column, change the "Nome Banco" (name of the column) in the protocol.
|
|
* To rename a column, change the "Nome Banco" (name of the column) in the protocol.
|
|
|
|
|
|
After that, execute the hotmapper command 'remap' in the following way:
|
|
After that, execute the HOTMapper command `remap` in the following way:
|
|
~~~bash
|
|
~~~bash
|
|
$ ./manage.py remap <table_name>
|
|
$ ./manage.py remap <table_name>
|
|
~~~
|
|
~~~
|
... | @@ -187,8 +187,8 @@ Now you'll have to update the data in the table |
... | @@ -187,8 +187,8 @@ Now you'll have to update the data in the table |
|
|
|
|
|
## 8. Updating the table data
|
|
## 8. Updating the table data
|
|
|
|
|
|
If your data csv suffered any modifications or you changed the table by adding, removing or renaming a column, you'll
|
|
If your data CSV suffered any modifications or you changed the table by adding, removing or renaming a column, you'll
|
|
have to update the data of the table. You'll can do that using the hotmapper command 'update_from_file' in a similar way
|
|
have to update the data of the table. You can do that using the HOTMapper command `update_from_file` in a similar way
|
|
to the insert command:
|
|
to the insert command:
|
|
~~~bash
|
|
~~~bash
|
|
$ ./manage.py update_from_file <file_location> <table_name> <year> --sep=<optional, csv separator>
|
|
$ ./manage.py update_from_file <file_location> <table_name> <year> --sep=<optional, csv separator>
|
... | | ... | |