Skip to content

Table Definitions

Henrique Varella Ehrenfried edited this page Oct 8, 2019 · 6 revisions

Table Definitions

Updated with v1.0.

Table definitions is a JSON file used by HOTMapper to set the table's primary key(s) and foreign key(s). It's also used to fill the data of an auxiliary that stores information about the table's source. This source table is automatically created when you make your first table using HOTMapper.

This JSON file needs to have the same name of the table + '.json' (Eg.: table_name.json) and be stored in the TABLE_DEFINITIONS_FOLDER defined in the settings.py file, by default the folder location is hotmapper/table_definitions.

The table_definitions JSON has four attributes in the following format:

{
  "pairing_description": "A string with the description of what this table stores.",
  "data_source": "A string with the source of the data.",
  "pk": ["A list with the primary key columns."],
  "foreign_keys": ["A list with the foreign key columns."]
}
  • "pairing_description": <"string">

    • Represents a brief description of what is stored by the tables.

  • "data_source": <"string">

    • The table's source.

  • "pk": <"list of strings, where each string represents a column of the table"> (Eg.: ["id", "year"])

    • The table's primary key. This field can have zero or more.

  • "foreign_keys": <"list of strings, where each string represents a column of the table">

    • Foreign keys of the table. This field can have zero or more.

The HOTMapper comes with an example of table definitions in the folder hotmapper/table_definitions, named example_table_definition.json and shown bellow.

{
  "pairing_description": "Table with the graduation rates, which represent a percentage of students expected to graduate, used to learn the HOTMapper Tool",
  "data_source": "Open data made by Sustainable Development Solutions Network",
  "pk": ["cod_country", "year", "gender", "isced"],
  "foreign_keys": []
}

Clone this wiki locally