Skip to content

Commit

Permalink
Add dbml schema of the database
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-borovets committed Aug 25, 2024
1 parent 884195e commit 173deea
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ residents in making informed decisions during the Residency Match process.
```

> Unfortunately, you will need to figure out how to install Python if you don't have it already.
> Alternatively, you can use **an unsafe method**: simply rename `.env.example` to `.env` in the root directory of the project.
> Alternatively, you can use **an unsafe method**: simply rename `.env.example` to `.env` in the root directory of
the project.
## Running the Application (for Windows users)
Expand Down Expand Up @@ -133,6 +134,9 @@ well.
### Database schema

![Database Schema](media/13ERD_Residency.png)
This diagram was created using [dbdiagram.io](https://dbdiagram.io).
The database schema code is available in the `./docs/database_schema.dbml`
file.

### Customization

Expand Down
136 changes: 136 additions & 0 deletions docs/database_schema.dbml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Table programs {
id int [pk, increment]
acgme_id varchar [not null, unique]
major_id int [not null, ref: > majors.id]
title varchar [not null]
city varchar [not null]
state_id int [ref: > states.id, not null]
nrmp_code varchar
contact_info varchar
user_rating int [note: "1-5"]
additional_info varchar

indexes {
acgme_id
state_id
}
}

Table states {
id int [pk, increment]
title varchar [unique, not null]
region_id int [ref: > regions.id, not null]

indexes {
title
}
}

Table regions {
id int [pk, increment]
title varchar [unique, not null]

indexes {
title
}
}


Table directors {
id int [pk, increment]
first_name varchar [not null]
last_name varchar [not null]
contact_info varchar [not null]
program_id int [ref: - programs.id, not null]
specialty varchar
home_country varchar
additional_info varchar

indexes {
first_name
last_name
}
}

Table directors_peers {
director_id int [ref: > directors.id]
peer_id int [ref: > peers.id]

indexes {
(director_id, peer_id) [pk]
}
}

Table peers {
id int [pk, increment]
first_name varchar [not null]
last_name varchar [not null]
contact_info varchar [not null]
position varchar [not null]
additional_info varchar

indexes {
first_name
last_name
}
}

Table directors_alumni {
director_id int [ref: > directors.id]
alumni_id int [ref: > alumni.id]

indexes {
(director_id, alumni_id) [pk]
}
}

Table alumni {
id int [pk, increment]
first_name varchar [not null]
last_name varchar [not null]
contact_info varchar [not null]
work_location varchar
additional_info varchar

indexes {
first_name
last_name
}
}

Table program_statistics {
id int [pk, increment]
program_id int [not null, ref: - programs.id]
percentage_non_us_img decimal [not null, note: "0-100"]
percentage_applicants_interviewed decimal [note: "0-100"]
internship_available boolean
more_than_two_russians_interviewed boolean
additional_info varchar
}

Table stats_tracks {
stat_id int [ref: > program_statistics.id]
track_id int [ref: > further_tracks.id]

indexes {
(stat_id, track_id) [pk]
}
}

Table further_tracks {
id int [pk, increment]
title varchar [unique, not null]

indexes {
title
}
}

Table majors {
id int [pk, increment]
title varchar [unique, not null]

indexes {
title
}
}

0 comments on commit 173deea

Please sign in to comment.