Task: equi-join-detect (source dataset: Auto-BI)

Your are given a database with related tables used for business intelligence analysis. Your task is to identify all key/foreign-key join relationships between the tables for this database. Recall that a join is a relationship between two tables, that allows rows from one table to be combined with rows from another, based on a set of common join columns.
 
 
No explanation needed. Please return all join relationships in the following JSON format:
{
  "joins": [
    {
      "from_table": "table-1",
      "from_column": "column-1",
      "to_table": "table-2",
      "to_column": "column-3"
    }, 
	...
  ]
}

Tables:

Table: dw_urg dim_causa
|   id_causa | descricao_cau        |
|-----------:|:---------------------|
|          1 | ACIDENTE DE TRABALHO |
|          2 | ACIDENTE DE VIACAO   |
|          3 | ACIDENTE ESCOLAR     |
|          4 | ACIDENTE PESSOAL     |
|          5 | DOENCA               |
|          6 | OUTRAS               |
|          7 | QUEDA                |


Table: dw_urg dim_data
|   id_data | data                    |
|----------:|:------------------------|
|         1 | 2017-01-09 00:00:00.000 |
|         2 | 2017-01-10 00:00:00.000 |
|         3 | 2017-01-11 00:00:00.000 |
|         4 | 2017-01-12 00:00:00.000 |
|         5 | 2017-01-13 00:00:00.000 |
|         6 | 2017-01-14 00:00:00.000 |
|         7 | 2017-01-15 00:00:00.000 |
|         8 | 2017-01-16 00:00:00.000 |
|         9 | 2017-01-17 00:00:00.000 |
|        10 | 2017-01-18 00:00:00.000 |


Table: dw_urg dim_especialidade
|   id_especialidade | descricao_esp   |
|-------------------:|:----------------|
|                  1 | CLINICA GERAL   |


Table: dw_urg dim_genero
|   id_genero | descricao_gen   |
|------------:|:----------------|
|           1 | F               |
|           2 | M               |


Table: dw_urg dim_local
|   id_local | descricao_loc   |
|-----------:|:----------------|
|          1 | URGENCIA GERAL  |


Table: dw_urg dim_proveniencia
|   id_proveniencia | descricao_prov   |
|------------------:|:-----------------|
|                 1 | EXTERIOR         |


Table: dw_urg facts_urg
|       idUrg |   id_especialidade |   id_proveniencia |   id_causa |   id_local |   id_genero |   id_nascimento |   id_admissao |   id_alta |   idade_paciente |   tempo_adm_alta |
|------------:|-------------------:|------------------:|-----------:|-----------:|------------:|----------------:|--------------:|----------:|-----------------:|-----------------:|
| 1.50524e+07 |                  1 |                 1 |          5 |          1 |           1 |             845 |             9 |        10 |               69 |              669 |
| 1.50524e+07 |                  1 |                 1 |          5 |          1 |           1 |             849 |             9 |        10 |               47 |              636 |
| 1.50524e+07 |                  1 |                 1 |          5 |          1 |           1 |             850 |             9 |        10 |               63 |              635 |
| 1.50524e+07 |                  1 |                 1 |          5 |          1 |           1 |             851 |             9 |        10 |                1 |              626 |
| 1.50524e+07 |                  1 |                 1 |          5 |          1 |           1 |             627 |             9 |        10 |                2 |              593 |
| 1.50525e+07 |                  1 |                 1 |          5 |          1 |           1 |             856 |             9 |        10 |               58 |              548 |
| 1.50525e+07 |                  1 |                 1 |          5 |          1 |           1 |             857 |             9 |        10 |               80 |              546 |
| 1.50525e+07 |                  1 |                 1 |          5 |          1 |           1 |             858 |             9 |        10 |               75 |              529 |
| 1.50525e+07 |                  1 |                 1 |          5 |          1 |           1 |             861 |             9 |        10 |               34 |              503 |
| 1.50525e+07 |                  1 |                 1 |          5 |          1 |           1 |             862 |             9 |        10 |               20 |              496 |

 


tables: name: dw_urg dim_causa
data: dw_urg dim_causa.csv
name: dw_urg dim_data
data: dw_urg dim_data.csv
name: dw_urg dim_especialidade
data: dw_urg dim_especialidade.csv
name: dw_urg dim_genero
data: dw_urg dim_genero.csv
name: dw_urg dim_local
data: dw_urg dim_local.csv
name: dw_urg dim_proveniencia
data: dw_urg dim_proveniencia.csv
name: dw_urg facts_urg
data: dw_urg facts_urg.csv
label: dw_urg facts_urg
id_causa
dw_urg dim_causa
id_causa
dw_urg facts_urg
id_admissao
dw_urg dim_data
id_data
dw_urg facts_urg
id_especialidade
dw_urg dim_especialidade
id_especialidade
dw_urg facts_urg
id_genero
dw_urg dim_genero
id_genero
dw_urg facts_urg
id_local
dw_urg dim_local
id_local
dw_urg facts_urg
id_proveniencia
dw_urg dim_proveniencia
id_proveniencia
output: {
    "joins": [
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_causa",
            "to_table": "dw_urg dim_causa",
            "to_column": "id_causa"
        },
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_admissao",
            "to_table": "dw_urg dim_data",
            "to_column": "id_data"
        },
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_especialidade",
            "to_table": "dw_urg dim_especialidade",
            "to_column": "id_especialidade"
        },
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_genero",
            "to_table": "dw_urg dim_genero",
            "to_column": "id_genero"
        },
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_local",
            "to_table": "dw_urg dim_local",
            "to_column": "id_local"
        },
        {
            "from_table": "dw_urg facts_urg",
            "from_column": "id_proveniencia",
            "to_table": "dw_urg dim_proveniencia",
            "to_column": "id_proveniencia"
        }
    ]
}