diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-01 15:31:59 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-01 15:31:59 -0700 |
| commit | 39be74192ab60f93973ce1ef06327b84e49247ee (patch) | |
| tree | b0a7c4489ccb922c73c96bd856320faafc1f32f8 /assignments/final | |
| parent | 97d916ca98c8145397eb6444e623a8daa93faa74 (diff) | |
Try to build a ER diagram
Diffstat (limited to 'assignments/final')
| -rw-r--r-- | assignments/final/module-1.png | bin | 71492 -> 31666 bytes | |||
| -rw-r--r-- | assignments/final/module-1.puml | 204 |
2 files changed, 95 insertions, 109 deletions
diff --git a/assignments/final/module-1.png b/assignments/final/module-1.png Binary files differindex 85ea86f..d3b9221 100644 --- a/assignments/final/module-1.png +++ b/assignments/final/module-1.png diff --git a/assignments/final/module-1.puml b/assignments/final/module-1.puml index 95c2ac3..62dc90e 100644 --- a/assignments/final/module-1.puml +++ b/assignments/final/module-1.puml @@ -1,143 +1,129 @@ @startuml -!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >> -!define primary_key(x) <b>x</b> -!define foreign_key(x) <color:purple>x</color> -!define unique(x) <color:green>x</color> -!define not_null(x) <u>x</u> -hide methods -hide stereotypes - -' entities -Table(beds, "beds") { - primary_key(id) - foreign_key(patient_id) - bed_number - room_number - care_centre_id -} - -Table(care_centres, "care_centres") { - primary_key(id) - name - location -} +hide circle +skinparam linetype ortho -Table(care_centres_employees, "care_centres_employees") { - primary_key(care_centre_id) - primary_key(employee_id) - in_charge +entity "Bed" as beds { + id : number << generated >> + -- + bed_number : number + room_number : number + care_centre_id : number <<FK>> + patient_id : number <<FK>> } -Table(consumptions, "consumptions") { - primary_key(id) - foreign_key(item_id) - foreign_key(patient_id) - consumed_at - quantity - total_cost +entity "CareCentre" as care_centres { + id : number << generated >> + -- + name : text + location : text + nurse_in_charge : number <<FK>> } -Table(employees, "employees") { - primary_key(person_id) - type - hired_at +entity "Consumption" as consumptions { + id : number << generated >> + -- + item_id : number <<FK>> + patient_id : number <<FK>> + consumed_at : datetime + quantity : integer + total_cost : decimal } -Table(items, "items") { - primary_key(id) - foreign_key(patient_id) - number - description - unit_cost +entity "Employee" as employees { + id : number << generated >> + -- + type : number + hired_at : datetime } -Table(laboratories, "laboratories") { - primary_key(id) - location +entity "Item" as items { + id : number << generated >> + -- + number : number + description : text + unit_cost : decimal } -Table(laboratories_technicians, "laboratories_technicians") { - foreign_key(technician_id) - foreign_key(laboratory_id) +entity "Laboratory" as laboratories { + id : number << generated >> + -- + location : text } -Table(nurses, "nurses") { - primary_key(employee_id) - certificate +entity "Nurse" as nurses { + employee_id : number + -- + certificate : text } -Table(patients, "patients") { - primary_key(person_id) - contacted_at - foreign_key(referred_by_physician_id) - foreign_key(physician_id) +entity "Patient" as patients { + person_id : number + -- + contacted_at : datetime + referred_by_physician_id : number <<FK>> + physician_id : number <<FK>> } -Table(people, "people") { - primary_key(id) - not_null(name) - address - birth_date - phone_number +entity "People" as people { + id : number << generated >> + -- + name : text + address : text + birth_date : datetime + phone_number : text } -Table(physicians, "physicians") { - primary_key(employee_id) - specialty - pager_number +entity "Physician" as physicians { + employee_id : number + -- + specialty : text + pager_number : text } -Table(staff, "staff") { - primary_key(employee_id) - job_class +entity "Staff" as staff { + employee_id : number + -- + job_class : text } -Table(technicians, "technicians") { - primary_key(employee_id) - skill +entity "Technician" as technicians { + employee_id : number + -- + skill : text } -Table(treatments, "treatments") { - primary_key(id) - number, - name, - foreign_key(patient_id) - foreign_key(physician_id) - occurred_at - results +entity "Treatment" as treatments { + id : number << generated >> + -- + number : number + name : text + patient_id : number <<FK>> + physician_id : number <<FK>> + occurred_at : datetime + results : text } -Table(visits, "visits") { - primary_key(id) - foreign_key(patient_id) - comments - scheduled_at +entity "Visit" as visits { + id : number << generated >> + -- + patient_id : number <<FK>> + comments : text + scheduled_at : datetime } -Table(volunteers, "volunteers") { - primary_key(person_id) - skill +entity "Volunteer" as volunteers { + person_id : number + -- + skill : text } ' relationships -beds --> patients : "belongs to" -care_centres_employees --> care_centres : "belongs to" -care_centres_employees --> employees : "belongs to" -consumptions --> items : "belongs to" -consumptions --> patients : "belongs to" -employees --> people : "is a" -items --> patients : "belongs to" -laboratories_technicians --> laboratories : "belongs to" -laboratories_technicians --> technicians : "belongs to" -nurses --> employees : "is a" -patients --> people : "is a" -patients --> physicians : "belongs to" -physicians --> employees : "is a" -staff --> employees : "is a" -technicians --> employees : "is a" -treatments --> patients : "belongs to" -treatments --> physicians : "belongs to" -visits --> patients : "belongs to" -volunteers --> people : "is a" - +beds ||--o| patients +beds }|--|| care_centres +consumptions }|--|| items +consumptions }|--|| patients +patients }|--|| physicians +treatments }|--|| patients +treatments }|--|| physicians +visits }|--|| patients @enduml |
