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: byetta insulin music diagram so
|   Patient ID | 1/01/2012   | 15/01/2012   | 29/01/2012   | 12/02/2012   |   26/02/2012 | 11/03/2012   | 25/03/2012   |   8/04/2012 | 22/04/2012   | 6/05/2012   | 20/05/2012   |   3/06/2012 | 17/06/2012   | 1/07/2012   | 15/07/2012   | 29/07/2012   | 12/08/2012   | 26/08/2012   | 9/09/2012   |   23/09/2012 | 7/10/2012   | 21/10/2012   | 4/11/2012   | 18/11/2012   | 2/12/2012   | 16/12/2012   | 30/12/2012   | 13/01/2013   | 27/01/2013   | 10/02/2013   | 24/02/2013   | 10/03/2013   | 24/03/2013   |   7/04/2013 | 21/04/2013   | 5/05/2013   | 19/05/2013   | 2/06/2013   | 16/06/2013   | 30/06/2013   | 14/07/2013   | 28/07/2013   | 11/08/2013   | 25/08/2013   | 8/09/2013   |   22/09/2013 | 6/10/2013   | 20/10/2013   | 3/11/2013   |   17/11/2013 | 1/12/2013   | 15/12/2013   |   29/12/2013 |   12/01/2014 |   26/01/2014 | Column57   | Column58   | Column59   | Column60   |
|-------------:|:------------|:-------------|:-------------|:-------------|-------------:|:-------------|:-------------|------------:|:-------------|:------------|:-------------|------------:|:-------------|:------------|:-------------|:-------------|:-------------|:-------------|:------------|-------------:|:------------|:-------------|:------------|:-------------|:------------|:-------------|:-------------|:-------------|:-------------|:-------------|:-------------|:-------------|:-------------|------------:|:-------------|:------------|:-------------|:------------|:-------------|:-------------|:-------------|:-------------|:-------------|:-------------|:------------|-------------:|:------------|:-------------|:------------|-------------:|:------------|:-------------|-------------:|-------------:|-------------:|:-----------|:-----------|:-----------|:-----------|
|            1 | 0           | 0            | 0            | 0            |            0 | 0            | 0            |           0 | 0            | 0           | 0            |           0 | 0            | 0           | 0            | 0            | By           | 0            | By          |            0 | By          | 0            | 0           | By           | 0           | 0            | 0            | 0            | By           | 0            | 0            | By           | 0            |           0 | 0            | By          | 0            | By          | By           | 0            | 0            | 0            | By           | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            | 1          |
|            1 | 0           | 0            | 0            | 0            |            0 | 0            | In           |           0 | 0            | In          | 0            |           0 | 0            | 0           | 0            | 0            | In           | 0            | 0           |            0 | 0           | 0            | 0           | 0            | 0           | 0            | 0            | 0            | 0            | 0            | 0            | 0            | 0            |           0 | In           | In          | 0            | 0           | 0            | 0            | 0            | In           | In           | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            2 | By          | 0            | By           | 0            |            0 | By           | 0            |           0 | By           | 0           | By           |           0 | By           | 0           | By           | 0            | By           | 0            | 0           |            0 | By          | 0            | 0           | By           | 0           | 0            | By           | 0            | By           | 0            | 0            | By           | 0            |           0 | By           | By          | 0            | 0           | 0            | By           | By           | 0            | By           | 0            | 0           |            0 | 0           | By           | 0           |            0 | 0           | By           |            0 |            0 |            0 |            |            |            |            |
|            2 | 0           | 0            | 0            | In           |            0 | 0            | 0            |           0 | 0            | 0           | 0            |           0 | In           | 0           | 0            | 0            | 0            | 0            | 0           |            0 | 0           | 0            | 0           | 0            | 0           | 0            | 0            | In           | 0            | 0            | 0            | 0            | 0            |           0 | 0            | 0           | In           | 0           | 0            | 0            | In           | 0            | In           | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            3 | 0           | 0            | 0            | 0            |            0 | 0            | 0            |           0 | 0            | 0           | 0            |           0 | 0            | 0           | 0            | 0            | 0            | 0            | By          |            0 | By          | By           | 0           | By           | 0           | By           | By           | 0            | 0            | 0            | 0            | 0            | 0            |           0 | 0            | 0           | 0            | 0           | 0            | 0            | 0            | 0            | 0            | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            3 | 0           | 0            | 0            | 0            |            0 | 0            | 0            |           0 | 0            | 0           | 0            |           0 | 0            | 0           | 0            | 0            | 0            | 0            | 0           |            0 | 0           | 0            | 0           | 0            | 0           | 0            | 0            | In           | 0            | 0            | 0            | 0            | 0            |           0 | 0            | 0           | 0            | 0           | 0            | In           | 0            | 0            | 0            | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            4 | 0           | 0            | 0            | 0            |            0 | 0            | 0            |           0 | 0            | 0           | By           |           0 | By           | 0           | By           | By           | 0            | By           | By          |            0 | 0           | 0            | 0           | 0            | By          | 0            | 0            | 0            | By           | By           | 0            | 0            | 0            |           0 | 0            | 0           | 0            | 0           | 0            | 0            | 0            | 0            | By           | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            4 | 0           | 0            | 0            | 0            |            0 | 0            | 0            |           0 | 0            | In          | In           |           0 | 0            | 0           | 0            | 0            | 0            | 0            | 0           |            0 | 0           | In           | 0           | 0            | In          | 0            | 0            | 0            | 0            | 0            | 0            | 0            | 0            |           0 | 0            | 0           | 0            | 0           | 0            | 0            | 0            | 0            | In           | 0            | 0           |            0 | 0           | 0            | 0           |            0 | 0           | 0            |            0 |            0 |            0 |            |            |            |            |
|            5 | 0           | 0            | 0            | 0            |            0 | 0            | By           |           0 | 0            | By          | By           |           0 | 0            | By          | 0            | By           | 0            | By           | 0           |            0 | By          | 0            | By          | 0            | 0           | By           | 0            | By           | 0            | 0            | By           | 0            | By           |           0 | By           | 0           | 0            | By          | 0            | By           | 0            | By           | 0            | 0            | By          |            0 | By          | 0            | By          |            0 | 0           | By           |            0 |            0 |            0 |            |            |            |            |
|            5 | 0           | In           | 0            | 0            |            0 | 0            | In           |           0 | 0            | 0           | In           |           0 | 0            | In          | 0            | 0            | 0            | In           | 0           |            0 | 0           | In           | 0           | 0            | In          | 0            | 0            | 0            | In           | 0            | 0            | 0            | In           |           0 | 0            | 0           | In           | 0           | 0            | In           | 0            | 0            | 0            | In           | 0           |            0 | In          | 0            | 0           |            0 | In          | 0            |            0 |            0 |            0 |            |            |            |            |


Table: Byetta Table (2)
|   Index |   Patient ID | Date                    |   Drug | DateDiffByetta   |
|--------:|-------------:|:------------------------|-------:|:-----------------|
|       0 |            1 | 2012-08-12 00:00:00.000 |      2 |                  |
|       1 |            1 | 2012-09-09 00:00:00.000 |      2 | 28               |
|       2 |            1 | 2012-10-07 00:00:00.000 |      2 | 28               |
|       3 |            1 | 2012-11-18 00:00:00.000 |      2 | 42               |
|       4 |            1 | 2013-01-27 00:00:00.000 |      2 | 70               |
|       5 |            1 | 2013-03-10 00:00:00.000 |      2 | 42               |
|       6 |            1 | 2013-05-05 00:00:00.000 |      2 | 56               |
|       7 |            1 | 2013-06-02 00:00:00.000 |      2 | 28               |
|       8 |            1 | 2013-06-16 00:00:00.000 |      2 | 14               |
|       9 |            1 | 2013-08-11 00:00:00.000 |      2 | 56               |


Table: Calendar
| Date                    | Calendar Year   | Month Name   |   Month Number | Weekday   |   Weekday number | Year Month   |   Year Month Nu  |
|:------------------------|:----------------|:-------------|---------------:|:----------|-----------------:|:-------------|-----------------:|
| 2012-01-01 00:00:00.000 | CY 2012         | January      |              1 | Sunday    |                1 | January 2012 |           201201 |
| 2012-01-02 00:00:00.000 | CY 2012         | January      |              1 | Monday    |                2 | January 2012 |           201201 |
| 2012-01-03 00:00:00.000 | CY 2012         | January      |              1 | Tuesday   |                3 | January 2012 |           201201 |
| 2012-01-04 00:00:00.000 | CY 2012         | January      |              1 | Wednesday |                4 | January 2012 |           201201 |
| 2012-01-05 00:00:00.000 | CY 2012         | January      |              1 | Thursday  |                5 | January 2012 |           201201 |
| 2012-01-06 00:00:00.000 | CY 2012         | January      |              1 | Friday    |                6 | January 2012 |           201201 |
| 2012-01-07 00:00:00.000 | CY 2012         | January      |              1 | Saturday  |                7 | January 2012 |           201201 |
| 2012-01-08 00:00:00.000 | CY 2012         | January      |              1 | Sunday    |                1 | January 2012 |           201201 |
| 2012-01-09 00:00:00.000 | CY 2012         | January      |              1 | Monday    |                2 | January 2012 |           201201 |
| 2012-01-10 00:00:00.000 | CY 2012         | January      |              1 | Tuesday   |                3 | January 2012 |           201201 |


Table: CoAdmin Logic Table
|   Patient ID | Current DispDATE        |   Drug |   Index |   Disp Inrtevals |   Overlap logic | Previous Script date    |
|-------------:|:------------------------|-------:|--------:|-----------------:|----------------:|:------------------------|
|            1 | 2012-09-09 00:00:00.000 |      2 |       4 |               28 |               2 | 2012-08-12 00:00:00.000 |
|            1 | 2012-10-07 00:00:00.000 |      2 |       5 |               28 |               2 | 2012-09-09 00:00:00.000 |
|            1 | 2013-06-02 00:00:00.000 |      2 |      12 |               28 |               2 | 2013-05-05 00:00:00.000 |
|            2 | 2012-01-29 00:00:00.000 |      2 |      18 |               28 |               2 | 2012-01-01 00:00:00.000 |
|            2 | 2012-03-11 00:00:00.000 |      2 |      20 |               28 |               2 | 2012-01-29 00:00:00.000 |
|            2 | 2012-05-20 00:00:00.000 |      2 |      22 |               28 |               2 | 2012-04-22 00:00:00.000 |
|            2 | 2012-06-17 00:00:00.000 |      2 |      23 |               28 |               2 | 2012-05-20 00:00:00.000 |
|            2 | 2012-07-15 00:00:00.000 |      2 |      25 |               28 |               2 | 2012-06-17 00:00:00.000 |
|            2 | 2012-08-12 00:00:00.000 |      2 |      26 |               28 |               2 | 2012-07-15 00:00:00.000 |
|            2 | 2013-08-11 00:00:00.000 |      2 |      40 |               28 |               2 | 2013-07-14 00:00:00.000 |


Table: CoAdmin Logic_Table 2
| Current DispDATE        |   Patient ID |   Drug |   Index |   Disp Inrtevals |   Overlap logic | Previous Script date    |
|:------------------------|-------------:|-------:|--------:|-----------------:|----------------:|:------------------------|
| 2012-09-09 00:00:00.000 |            1 |      2 |       4 |               28 |               2 | 2012-08-12 00:00:00.000 |
| 2012-10-07 00:00:00.000 |            1 |      2 |       5 |               28 |               2 | 2012-09-09 00:00:00.000 |
| 2013-06-02 00:00:00.000 |            1 |      2 |      12 |               28 |               2 | 2013-05-05 00:00:00.000 |
| 2012-01-29 00:00:00.000 |            2 |      2 |      18 |               28 |               2 | 2012-01-01 00:00:00.000 |
| 2012-03-11 00:00:00.000 |            2 |      2 |      20 |               28 |               2 | 2012-01-29 00:00:00.000 |
| 2012-05-20 00:00:00.000 |            2 |      2 |      22 |               28 |               2 | 2012-04-22 00:00:00.000 |
| 2012-06-17 00:00:00.000 |            2 |      2 |      23 |               28 |               2 | 2012-05-20 00:00:00.000 |
| 2012-07-15 00:00:00.000 |            2 |      2 |      25 |               28 |               2 | 2012-06-17 00:00:00.000 |
| 2012-08-12 00:00:00.000 |            2 |      2 |      26 |               28 |               2 | 2012-07-15 00:00:00.000 |
| 2013-08-11 00:00:00.000 |            2 |      2 |      40 |               28 |               2 | 2013-07-14 00:00:00.000 |


Table: DateBy
| Date                    | Calendar Year   | Month Name   |   Month Number | Weekday   |   Weekday number | Year Month   |   Year Month Nu  |
|:------------------------|:----------------|:-------------|---------------:|:----------|-----------------:|:-------------|-----------------:|
| 2012-01-01 00:00:00.000 | CY 2012         | January      |              1 | Sunday    |                1 | January 2012 |           201201 |
| 2012-01-02 00:00:00.000 | CY 2012         | January      |              1 | Monday    |                2 | January 2012 |           201201 |
| 2012-01-03 00:00:00.000 | CY 2012         | January      |              1 | Tuesday   |                3 | January 2012 |           201201 |
| 2012-01-04 00:00:00.000 | CY 2012         | January      |              1 | Wednesday |                4 | January 2012 |           201201 |
| 2012-01-05 00:00:00.000 | CY 2012         | January      |              1 | Thursday  |                5 | January 2012 |           201201 |
| 2012-01-06 00:00:00.000 | CY 2012         | January      |              1 | Friday    |                6 | January 2012 |           201201 |
| 2012-01-07 00:00:00.000 | CY 2012         | January      |              1 | Saturday  |                7 | January 2012 |           201201 |
| 2012-01-08 00:00:00.000 | CY 2012         | January      |              1 | Sunday    |                1 | January 2012 |           201201 |
| 2012-01-09 00:00:00.000 | CY 2012         | January      |              1 | Monday    |                2 | January 2012 |           201201 |
| 2012-01-10 00:00:00.000 | CY 2012         | January      |              1 | Tuesday   |                3 | January 2012 |           201201 |


Table: DateIn
| Date                    | Calendar Year   | Month Name   |   Month Number | Weekday   |   Weekday number | Quarter   |
|:------------------------|:----------------|:-------------|---------------:|:----------|-----------------:|:----------|
| 2012-07-01 00:00:00.000 | CY 2012         | July         |              7 | Sunday    |                1 | Q3        |
| 2012-07-02 00:00:00.000 | CY 2012         | July         |              7 | Monday    |                2 | Q3        |
| 2012-07-03 00:00:00.000 | CY 2012         | July         |              7 | Tuesday   |                3 | Q3        |
| 2012-07-04 00:00:00.000 | CY 2012         | July         |              7 | Wednesday |                4 | Q3        |
| 2012-07-05 00:00:00.000 | CY 2012         | July         |              7 | Thursday  |                5 | Q3        |
| 2012-07-06 00:00:00.000 | CY 2012         | July         |              7 | Friday    |                6 | Q3        |
| 2012-07-07 00:00:00.000 | CY 2012         | July         |              7 | Saturday  |                7 | Q3        |
| 2012-07-08 00:00:00.000 | CY 2012         | July         |              7 | Sunday    |                1 | Q3        |
| 2012-07-09 00:00:00.000 | CY 2012         | July         |              7 | Monday    |                2 | Q3        |
| 2012-07-10 00:00:00.000 | CY 2012         | July         |              7 | Tuesday   |                3 | Q3        |


Table: Drug
|   DID | Name    |
|------:|:--------|
|     1 | Insulin |
|     2 | Byetta  |


Table: History Profiles
|   Profile ID | Profile Description      |
|-------------:|:-------------------------|
|            1 | 1: In "2: In+By" "3: By" |
|            2 | 1: By "2: In+By"         |
|            3 | 1: By "2: In"            |
|            4 | 1: In+By "2: By"         |
|            5 | 1: In "2: In+By"         |
|            6 | 1: In "2: By" "3: In+By" |
|            7 | 1: By "2: In" "3: In+By" |
|            8 | 1: In+By "2: By" "3: In" |
|            9 | 1: In "2: By"            |
|           10 | 1: By "2: In+By" "3: In" |


Table: InsulinTable (2)
|   Index |   Patient ID | Date                    |   Drug | DateDiffInsulin   |
|--------:|-------------:|:------------------------|-------:|:------------------|
|       0 |            1 | 2012-03-25 00:00:00.000 |      1 |                   |
|       1 |            1 | 2012-05-06 00:00:00.000 |      1 | 42                |
|       2 |            1 | 2012-08-12 00:00:00.000 |      1 | 98                |
|       3 |            1 | 2013-04-21 00:00:00.000 |      1 | 252               |
|       4 |            1 | 2013-05-05 00:00:00.000 |      1 | 14                |
|       5 |            1 | 2013-07-28 00:00:00.000 |      1 | 84                |
|       6 |            1 | 2013-08-11 00:00:00.000 |      1 | 14                |
|       7 |            2 | 2012-02-12 00:00:00.000 |      1 |                   |
|       8 |            2 | 2012-06-17 00:00:00.000 |      1 | 126               |
|       9 |            2 | 2013-01-13 00:00:00.000 |      1 | 210               |


Table: Patient Profiles
|   PtID | Profile Concat           |
|-------:|:-------------------------|
|      1 | 1: In "2: In+By" "3: By" |
|      2 | 1: By "2: In+By"         |
|      3 | 1: By "2: In"            |
|      4 | 1: In+By "2: By"         |
|      5 | 1: In "2: In+By"         |
|      6 | 1: In "2: In+By" "3: By" |
|      7 | 1: By "2: In+By"         |
|      9 | 1: In "2: By" "3: In+By" |
|     11 | 1: By "2: In+By"         |
|     13 | 1: By "2: In" "3: In+By" |


Table: Transformed Table
|   Patient ID | Current DispDATE        |   Drug |   Index |   Disp Inrtevals |   Overlap logic | Previous Script date    |
|-------------:|:------------------------|-------:|--------:|-----------------:|----------------:|:------------------------|
|            1 | 2012-08-12 00:00:00.000 |      2 |       2 |               98 |               4 |                         |
|            1 | 2012-09-09 00:00:00.000 |      2 |       4 |               28 |               2 | 2012-08-12 00:00:00.000 |
|            1 | 2012-10-07 00:00:00.000 |      2 |       5 |               28 |               2 | 2012-09-09 00:00:00.000 |
|            1 | 2012-11-18 00:00:00.000 |      2 |       6 |               42 |               4 | 2012-10-07 00:00:00.000 |
|            1 | 2013-01-27 00:00:00.000 |      2 |       7 |               70 |               4 | 2012-11-18 00:00:00.000 |
|            1 | 2013-03-10 00:00:00.000 |      2 |       8 |               42 |               4 | 2013-01-27 00:00:00.000 |
|            1 | 2013-05-05 00:00:00.000 |      2 |      10 |               14 |               2 | 2013-03-10 00:00:00.000 |
|            1 | 2013-06-02 00:00:00.000 |      2 |      12 |               28 |               2 | 2013-05-05 00:00:00.000 |
|            1 | 2013-06-16 00:00:00.000 |      2 |      13 |               14 |               2 | 2013-06-02 00:00:00.000 |
|            1 | 2013-08-11 00:00:00.000 |      2 |      15 |               14 |               2 | 2013-06-16 00:00:00.000 |

 


tables: name: byetta insulin music diagram so
data: byetta insulin music diagram so.csv
name: Byetta Table (2)
data: Byetta Table (2).csv
name: Calendar
data: Calendar.csv
name: CoAdmin Logic Table
data: CoAdmin Logic Table.csv
name: CoAdmin Logic_Table 2
data: CoAdmin Logic_Table 2.csv
name: DateBy
data: DateBy.csv
name: DateIn
data: DateIn.csv
name: Drug
data: Drug.csv
name: History Profiles
data: History Profiles.csv
name: InsulinTable (2)
data: InsulinTable (2).csv
name: Patient Profiles
data: Patient Profiles.csv
name: Transformed Table
data: Transformed Table.csv
label: InsulinTable (2)
Patient ID
Patient Profiles
PtID
Byetta Table (2)
Patient ID
Patient Profiles
PtID
Patient Profiles
Profile Concat
History Profiles
Profile Description
Transformed Table
Drug
Drug
DID
output: {
    "joins": [
        {
            "from_table": "InsulinTable (2)",
            "from_column": "Patient ID",
            "to_table": "Patient Profiles",
            "to_column": "PtID"
        },
        {
            "from_table": "Byetta Table (2)",
            "from_column": "Patient ID",
            "to_table": "Patient Profiles",
            "to_column": "PtID"
        },
        {
            "from_table": "Patient Profiles",
            "from_column": "Profile Concat",
            "to_table": "History Profiles",
            "to_column": "Profile Description"
        },
        {
            "from_table": "Transformed Table",
            "from_column": "Drug",
            "to_table": "Drug",
            "to_column": "DID"
        }
    ]
}