Changes between Version 5 and Version 6 of ConceptualModel


Ignore:
Timestamp:
09/01/26 16:18:43 (9 days ago)
Author:
236021
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ConceptualModel

    v5 v6  
    1 = Conceptual Model
     1= Data Requirements  =
    22
    33== ER Diagram
    4 
    5 [[Image(Hospital_ER_Diagram2.drawio.png, 1460px)]]
    6 
    7 == Data requirements
    8 
    9 === Entities
    10 
    11 1. **Doctor_Level** – entity that stores doctor levels 
    12 - level_id (PK, bigint) 
    13 - level (text)
    14 
    15 2. **Doctor_Specialization** – entity that stores doctor specializations 
    16 - specialization_id (PK, bigint) 
    17 - specialization_name (text)
    18 
    19 3. **Departments** – entity that stores hospital departments 
    20 - department_id (PK, bigint) 
    21 - department_name (text)
    22 
    23 4. **Doctors** – entity that stores doctors 
    24 - doctor_id (PK, bigint) 
    25 - first_name (text) 
    26 - last_name (text) 
    27 - email_address (text) 
    28 - level_id (FK, bigint) 
    29 - specialization_id (FK, bigint) 
    30 - department_id (FK, bigint)
    31 
    32 5. **Admin** – entity that stores administrator data 
    33 - admin_id (PK, bigint)
    34 - username (text)
    35 - name (text)
    36 - lastname (text)
    37 - email (text)
    38 
    39 6. **Lab_Technician** – entity that stores lab technician data 
    40 - technician_id (PK, bigint)
    41 - username (text)
    42 - name (text)
    43 - lastname (text)
    44 - email (text)
    45 
    46 7. **Patients** – entity that stores patients 
    47 - patient_id (PK, bigint) 
    48 - first_name (text) 
    49 - last_name (text) 
    50 - email_address (text) 
    51 - date_of_birth (date) 
    52 - blood_type (text) 
    53 - gender (text) 
    54 - phone_number (text) 
    55 - EMBG (text)
    56 
    57 8. **Allergies** – entity that stores allergies 
    58 - allergy_id (PK, bigint) 
    59 - name (text) 
    60 - allergy_severity (text)
    61 
    62 9. **Symptoms** – entity that stores symptoms 
    63 - symptom_id (PK, bigint) 
    64 - name (text) 
    65 - description (text)
    66 
    67 10. **Appointments** – entity that stores appointments 
    68 - appointment_id (PK, bigint) 
    69 - appointment_date (date) 
    70 - appointment_time (time) 
    71 - status (text) 
    72 - patient_id (FK, bigint) 
    73 - doctor_id (FK, bigint)
    74 
    75 11. **Diagnosis** – entity that stores diagnoses 
    76 - diagnosis_id (PK, bigint) 
    77 - name (text) 
    78 - description (text) 
    79 - patient_id (FK, bigint) 
    80 - doctor_id (FK, bigint)
    81 
    82 12. **Procedures** – entity that stores medical procedures 
    83 - procedure_id (PK, bigint) 
    84 - procedure_type (text) 
    85 - procedure_date (date) 
    86 - description (text) 
    87 - cost (decimal) 
    88 - doctor_id (FK, bigint) 
    89 - diagnosis_id (FK, bigint)
    90 
    91 13. **Procedure_Results** – entity that stores procedure results 
    92 - result_id (PK, bigint) 
    93 - result_description (text) 
    94 - result_date (date) 
    95 - procedure_id (FK, bigint)
    96 
    97 14. **Prescriptions** – entity that stores prescriptions 
    98 - prescription_id (PK, bigint) 
    99 - medication_name (text) 
    100 - dosage (text) 
    101 - instructions (text) 
    102 - duration (text) 
    103 - price (decimal) 
    104 - doctor_id (FK, bigint) 
    105 - patient_id (FK, bigint)
    106 
    107 15. **Prescription_Restriction** – entity that stores prescription restrictions 
    108 - restriction_id (PK, bigint) 
    109 - allowed (boolean) 
    110 - prescription_id (FK, bigint)
    111 
    112 16. **Lab_Tests** – entity that stores lab tests 
    113 - test_id (PK, bigint) 
    114 - test_name (text) 
    115 - description (text) 
    116 - cost (decimal) 
    117 - patient_id (FK, bigint) 
    118 - technician_id (FK, bigint)
    119 
    120 17. **Lab_Results** – entity that stores lab results 
    121 - result_id (PK, bigint) 
    122 - results (text) 
    123 - result_date (date) 
    124 - test_id (FK, bigint)
    125 
    126 18. **Medical_Records** – entity that stores medical records 
    127 - record_id (PK, bigint) 
    128 - doctor_notes (text) 
    129 - patient_id (FK, bigint) 
    130 - doctor_id (FK, bigint)
    131 
    132 19. **Referrals** – entity that stores referrals 
    133 - referral_id (PK, bigint) 
    134 - reason (text) 
    135 - date (date) 
    136 - doctor_id (FK, bigint) 
    137 - patient_id (FK, bigint)
    138 
    139 20. **Medical_Report** – entity that stores medical reports 
    140 - report_id (PK, bigint) 
    141 - description (text) 
    142 - date (date) 
    143 - patient_id (FK, bigint) 
    144 - doctor_id (FK, bigint)
    145 
    146 21. **Billing** – entity that stores billing information 
    147 - bill_id (PK, bigint) 
    148 - payment_status (text) 
    149 - payment_date (date) 
    150 - patient_id (FK, bigint)
    151 
    152 === Relations
    153 
    154 1. **is** (Doctor_Levels ↔ Doctors, 1:N)
    155 Each doctor is assigned one level, while a level can belong to many doctors.
    156 
    157 2. **has_specialization** (Doctors ↔ Doctor_Specialization, 1:N)
    158 Each doctor has one specialization, while a specialization can apply to many doctors.
    159 
    160 3. **works_in** (Departments ↔ Doctors, 1:N)
    161 Each doctor works in one department, while a department employs many doctors.
    162 
    163 4. **has_allergies** (Patients ↔ Allergies, M:N)
    164 Patients can have multiple allergies, and the same allergy can affect many patients.
    165 
    166 5. **contains_allergies** (Allergies ↔ Medical_Record, M:N)
    167 A medical record can contain multiple allergies, while the same allergy can appear in multiple medical records.
    168 
    169 6. **affects_prescription** (Allergy ↔ Prescription_Restriction, M:N)
    170 An allergy can be associated with multiple prescription restrictions, while the same restriction can apply to multiple allergies.
    171 
    172 7. **has_symptoms** (Patients ↔ Symptoms, M:N)
    173 Patients can report multiple symptoms, and each symptom can be reported by many patients.
    174 
    175 8. **indicates** (Symptoms ↔ Diagnosis, M:N)
    176 A diagnosis can be associated with multiple symptoms, while the same symptom can appear in multiple diagnoses.
    177 
    178 9. **contains_symptoms** (Medical_Record ↔ Symptoms, 1:N)
    179 Each medical record can contain multiple symptoms, while each symptom entry belongs to one medical record.
    180 
    181 10. **books** (Patients ↔ Appointments, 1:N)
    182 A patient can book multiple appointments, while each appointment belongs to one patient.
    183 
    184 11. **attends** (Doctors ↔ Appointments, 1:N)
    185 A doctor can attend multiple appointments, while each appointment is handled by one doctor.
    186 
    187 12. **updates** (Appointment ↔ Medical_Record, 1:N)
    188 An appointment can generate multiple updates in the medical record, while each update is associated with one appointment.
    189 
    190 13. **diagnoses** (Doctors ↔ Diagnosis, 1:N)
    191 A doctor can make multiple diagnoses, while each diagnosis is made by one doctor.
    192 
    193 14. **performs_allowed** (Doctor_Specialization ↔ Procedure, M:N)
    194 A doctor specialization can be associated with multiple procedures it allows, while the same procedure can be associated with multiple doctor specializations.
    195 
    196 15. **requires** (Diagnosis ↔ Procedure, M:N)
    197 A diagnosis can require multiple procedures, while the same procedure can be required by multiple diagnoses.
    198 
    199 16. **produces** (Procedure ↔ Procedure_Result, 1:N)
    200 A procedure can produce multiple results, while each result belongs to one procedure.
    201 
    202 17. **performs** (Department ↔ Procedure, M:N)
    203 A department can perform multiple procedures, while the same procedure can be performed in multiple departments.
    204 
    205 18. **billed_for** (Procedure ↔ Billing, M:N)
    206 A billing record can include multiple procedures, while the same procedure can appear in multiple billing records.
    207 
    208 19. **prescribes** (Doctors ↔ Prescriptions, 1:N)
    209 A doctor can write multiple prescriptions, while each prescription is written by one doctor.
    210 
    211 20. **restricts** (Prescriptions ↔ Prescription_Restriction, 1:N)
    212 A prescription can have multiple restrictions, while each restriction belongs to one prescription.
    213 
    214 21. **does_test** (Patients ↔ Lab_Tests, 1:N)
    215 A patient can take multiple lab tests, while each test belongs to one patient.
    216 
    217 22. **orders_test** (Doctors ↔ Lab_Tests, 1:N)
    218 A doctor can order multiple lab tests, while each lab test is ordered by one doctor.
    219 
    220 23. **conducts** (Lab_Technician ↔ Lab_Tests, 1:N)
    221 A lab technician can conduct multiple tests, while each test is conducted by one technician.
    222 
    223 24. **produces_test** (Lab_Tests ↔ Lab_Results, 1:N)
    224 A lab test can produce multiple results, while each result belongs to one test.
    225 
    226 25. **billed_for_test** (LabTest ↔ Billing, M:N)
    227 A billing record can include multiple lab tests, while the same lab test can appear in multiple billing records.
    228 
    229 26. **has** (Patient ↔ Medical_Record, 1:1)
    230 Each patient has one medical record, and each medical record belongs to one patient.
    231 
    232 27. **updates** (Doctors ↔ Medical_Record, M:N)
    233 Doctors can update multiple medical records, and records can be updated by multiple doctors.
    234 
    235 28. **issues** (Doctors ↔ Referral, 1:N)
    236 A doctor can issue multiple referrals, while each referral is issued by one doctor.
    237 
    238 29. **creates** (Doctors ↔ Medical_Report, 1:N)
    239 A doctor can create multiple medical reports, while each report is created by one doctor.
    240 
    241 30. **has** (Patient ↔ Medical_Report, 1:N)
    242 A patient can have multiple medical reports, while each report belongs to one patient.
    243 
    244 31. **updates** (Medical_Record ↔ Medical_Report, 1:N)
    245 A medical record can generate multiple reports, while each report is based on one record.
    246 
    247 32. **isn’t_allowed** (Medical_Record ↔ Prescription_Restriction, 1:M)
    248 Each medical record can contain multiple prescription restrictions, while each restriction belongs to one medical record.
    249 
    250 33. **processes** (Admin ↔ Billing, 1:N)
    251 An admin can process multiple billing records, while each bill is processed by one admin.
    252 
    253 34. **relates_to** (Diagnosis ↔ Medical_Record, M:N)
    254 Diagnoses can relate to multiple medical records, and records can include multiple diagnoses.
    255 
    256 35. **linked_to** (Prescription ↔ Medical_Record, M:N)
    257 Prescriptions can be linked to multiple medical records, and records can include multiple prescriptions.
    258 
    259 36. **includes_prescription** (Medical_Report ↔ Prescription, M:N)
    260 Medical reports can include multiple prescriptions, and prescriptions can appear in multiple reports.
    261 
    262 37. **includes_lab_results** (Medical_Report ↔ Lab_Results, M:N)
    263 Medical reports can include multiple lab results, and results can appear in multiple reports.
    264 
    265 38. **based_on** (Referral ↔ Appointment, 1:N)
    266 A referral can serve as the basis for multiple appointments, while each appointment is associated with one referral.
    267 
    268 39. **re_visits** (Appointment ↔ Appointment, 1:N)
    269 An appointment can result in multiple follow-up appointments, while each follow-up appointment is associated with one previous appointment.
    270 
    271 40. **documents** (Medical_Report ↔ Billing, 1:N)
    272 A medical report can generate multiple billing records, while each billing record is associated with one medical report.
     4----
     5
     6== Entities ==
     7
     8=== Doctor_Level ===
     9* level_id (PK, bigint)
     10* level (text)
     11
     12=== Doctor_Specialization ===
     13* specialization_id (PK, bigint)
     14* specialization_name (text)
     15
     16=== Departments ===
     17* department_id (PK, bigint)
     18* department_name (text)
     19
     20=== Doctors ===
     21* doctor_id (PK, bigint)
     22* first_name (text)
     23* last_name (text)
     24* email_address (text)
     25* level_id (FK, bigint)
     26* specialization_id (FK, bigint)
     27* department_id (FK, bigint)
     28
     29=== Patients ===
     30* patient_id (PK, bigint)
     31* first_name (text)
     32* last_name (text)
     33* email_address (text)
     34* date_of_birth (date)
     35* blood_type (text)
     36* gender (text)
     37* phone_number (text)
     38* embg (text)
     39
     40=== Admin ===
     41* admin_id (PK, bigint)
     42* username (text)
     43* name (text)
     44* lastname (text)
     45* email (text)
     46
     47=== Lab_Technician ===
     48* technician_id (PK, bigint)
     49* username (text)
     50* name (text)
     51* lastname (text)
     52* email (text)
     53
     54=== Users ===
     55* user_id (PK, serial)
     56* username (text)
     57* password (text)
     58* role (text)
     59* first_name (text)
     60* last_name (text)
     61* patient_id (FK, bigint, nullable)
     62* doctor_id (FK, bigint, nullable)
     63* admin_id (FK, bigint, nullable)
     64* technician_id (FK, bigint, nullable)
     65* is_active (boolean)
     66
     67=== Appointments ===
     68* appointment_id (PK, bigint)
     69* appointment_date (date)
     70* appointment_time (time)
     71* status (text)
     72* patient_id (FK, bigint)
     73* doctor_id (FK, bigint)
     74
     75=== Diagnosis ===
     76* diagnosis_id (PK, bigint)
     77* name (text)
     78* description (text)
     79* patient_id (FK, bigint)
     80* doctor_id (FK, bigint)
     81
     82=== Procedures ===
     83* procedure_id (PK, bigint)
     84* procedure_type (text)
     85* procedure_date (date)
     86* description (text)
     87* cost (decimal)
     88* doctor_id (FK, bigint)
     89* diagnosis_id (FK, bigint)
     90
     91=== Procedure_Results ===
     92* result_id (PK, bigint)
     93* result_description (text)
     94* result_date (date)
     95* procedure_id (FK, bigint)
     96
     97=== Prescriptions ===
     98* prescription_id (PK, bigint)
     99* medication_name (text)
     100
     101=== Prescription_Restriction ===
     102* restriction_id (PK, bigint)
     103* description (text)
     104* prescription_id (FK, bigint)
     105
     106=== Lab_Tests ===
     107* test_id (PK, bigint)
     108* test_name (text)
     109* description (text)
     110* cost (decimal)
     111
     112=== Lab_Results ===
     113* result_id (PK, bigint)
     114* results (text)
     115* result_date (date)
     116* test_id (FK, bigint)
     117
     118=== Medical_Records ===
     119''(simplified)''
     120* record_id (PK, bigint)
     121* patient_id (FK, bigint)
     122
     123=== Allergies ===
     124* allergy_id (PK, bigint)
     125* name (text)
     126* allergy_severity (text)
     127
     128=== Symptoms ===
     129* symptom_id (PK, bigint)
     130* name (text)
     131* description (text)
     132
     133=== Referrals ===
     134* referral_id (PK, bigint)
     135* reason (text)
     136* referral_date (date)
     137* record_id (FK, bigint)
     138* from_doctor_id (FK, bigint)
     139* to_doctor_id (FK, bigint)
     140
     141=== Medical_Report ===
     142* report_id (PK, bigint)
     143* description (text)
     144* report_date (date)
     145* record_id (FK, bigint)
     146* doctor_id (FK, bigint)
     147
     148=== Billing ===
     149* bill_id (PK, bigint)
     150* total_cost (decimal)
     151* payment_status (text)
     152* payment_date (date)
     153* record_id (FK, bigint)
     154* admin_id (FK, bigint)
     155
     156=== Performed_Procedures ===
     157* performed_id (PK, bigint)
     158* procedure_id (FK, bigint)
     159* doctor_id (FK, bigint)
     160* patient_id (FK, bigint)
     161* diagnosis_id (FK, bigint, nullable)
     162* procedure_date (date)
     163* notes (text)
     164
     165=== Performed_Lab_Tests ===
     166
     167* performed_test_id (PK, bigint)
     168* test_id (FK, bigint)
     169* patient_id (FK, bigint)
     170* doctor_id (FK, bigint)
     171* technician_id (FK, bigint)
     172* test_date (date)
     173* notes (text)
     174
     175=== Associative entities (M:N junctions that carry their own attributes) ===
     176
     177==== Prescription_Medical_Records ====
     178* prescription_id (FK, bigint)
     179* record_id (FK, bigint)
     180* dosage (text)
     181* frequency (text)
     182* duration (text)
     183* notes (text)
     184
     185==== Medical_Record_Symptoms ====
     186* record_id (FK, bigint)
     187* symptom_id (FK, bigint)
     188* severity (text)
     189
     190==== Medical_Record_Allergies ====
     191* record_id (FK, bigint)
     192* allergy_id (FK, bigint)
     193* reaction (text)
     194* severity (text)
     195
     196----
     197
     198== Relations ==
     199
     200=== is (Doctor_Level ↔ Doctors, 1:N) ===
     201each doctor has one level, a level applies to many doctors.
     202
     203=== has_specialization (Doctor_Specialization ↔ Doctors, 1:N) ===
     204each doctor has one specialization, a specialization applies to many doctors.
     205
     206=== works_in (Departments ↔ Doctors, 1:N) ===
     207each doctor belongs to one department, a department employs many doctors.
     208
     209=== identifies (Users ↔ Patients / Doctors / Admin / Lab_Technician, 1:1) ===
     210a user account links to exactly one underlying person record, depending on role.
     211
     212=== has_allergies (Patients ↔ Allergies, M:N via Patient_Allergies) ===
     213patients can have multiple allergies, an allergy can affect many patients.
     214
     215=== affects_prescription (Allergies ↔ Prescription_Restriction, M:N via Allergy_Prescription_Restrictions) ===
     216an allergy can be tied to multiple restrictions; a restriction can apply to multiple allergies.
     217
     218=== has_symptoms (Patients ↔ Symptoms, M:N via Patient_Symptoms) ===
     219patients can report multiple symptoms, a symptom can be reported by many patients.
     220
     221=== indicates (Symptoms ↔ Diagnosis, M:N via Diagnosis_Symptoms) ===
     222a diagnosis can involve multiple symptoms, a symptom can appear in multiple diagnoses.
     223
     224=== books (Patients ↔ Appointments, 1:N) ===
     225a patient books many appointments, each appointment belongs to one patient.
     226
     227=== attends (Doctors ↔ Appointments, 1:N) ===
     228a doctor attends many appointments, each appointment is handled by one doctor.
     229
     230=== diagnoses (Doctors ↔ Diagnosis, 1:N) ===
     231a doctor makes many diagnoses, each diagnosis is made by one doctor.
     232
     233=== diagnosed_with (Patients ↔ Diagnosis, 1:N) ===
     234a patient can have many diagnoses; each diagnosis belongs to one patient.
     235
     236=== performs_allowed (Doctor_Specialization ↔ Procedures, M:N via Specialization_Procedures) ===
     237a specialization is linked to the procedures it's allowed to perform.
     238
     239=== requires (Diagnosis ↔ Procedures, M:N via Diagnosis_Procedures) ===
     240a diagnosis can require multiple procedures, and the same procedure can be linked to multiple diagnoses ,in addition to the direct diagnosis_id FK each procedure row already carries.
     241
     242=== produces (Procedures ↔ Procedure_Results, 1:N) ===
     243a procedure can produce multiple results, each result belongs to one procedure.
     244
     245=== performs (Departments ↔ Procedures, M:N via Department_Procedures) ===
     246a department can perform multiple procedures, and a procedure can be performed in multiple departments.
     247
     248=== billed_for (Procedures ↔ Billing, M:N via Billing_Procedures) ===
     249a bill can include multiple procedures, a procedure can appear on multiple bills.
     250
     251=== restricts (Prescriptions ↔ Prescription_Restriction, 1:N) ===
     252a prescription can have multiple restrictions, each restriction belongs to one prescription.
     253
     254=== tested_as (Lab_Tests ↔ Performed_Lab_Tests, 1:N) ===
     255a catalog test can be performed many times; each performed test refers to one catalog test.
     256
     257=== takes_test (Patients ↔ Performed_Lab_Tests, 1:N) ===
     258a patient can undergo many performed tests, each performed test belongs to one patient.
     259
     260=== orders_test (Doctors ↔ Performed_Lab_Tests, 1:N) ===
     261a doctor can order many tests, each performed test is ordered by one doctor.
     262
     263=== conducts (Lab_Technician ↔ Performed_Lab_Tests, 1:N) ===
     264a technician can conduct many tests, each performed test is run by one technician.
     265
     266=== produces_test (Lab_Tests ↔ Lab_Results, 1:N) ===
     267a catalog test can produce multiple results, each result belongs to one test.
     268
     269=== billed_for_test (Lab_Tests ↔ Billing, M:N via Billing_Lab_Tests) ===
     270a bill can include multiple tests, a test can appear on multiple bills.
     271
     272=== performed_as (Procedures ↔ Performed_Procedures, 1:N) ===
     273a catalog procedure can be performed many times.
     274
     275=== performed_on (Patients ↔ Performed_Procedures, 1:N) ===
     276a patient can have many procedures performed, each performed procedure belongs to one patient.
     277
     278=== performed_by (Doctors ↔ Performed_Procedures, 1:N) ===
     279a doctor can perform many procedures, each performed procedure has one doctor.
     280
     281=== has (Patients ↔ Medical_Records, 1:N as constrained) ===
     282each medical record belongs to one patient.
     283
     284=== updates (Doctors ↔ Medical_Records, M:N via Doctor_Medical_Records) ===
     285doctors can update multiple records; a record can be updated by multiple doctors.
     286
     287=== relates_to (Diagnosis ↔ Medical_Records, M:N via Diagnosis_Medical_Records) ===
     288diagnoses can relate to multiple records, a record can include multiple diagnoses.
     289
     290=== linked_to (Prescriptions ↔ Medical_Records, M:N via Prescription_Medical_Records) ===
     291prescriptions can be linked to multiple records, a record can include multiple prescriptions, each with its own dosage/frequency/duration/notes for that record.
     292
     293=== contains_symptoms (Medical_Records ↔ Symptoms, M:N via Medical_Record_Symptoms) ===
     294a record can list multiple symptoms, each with its own severity.
     295
     296=== contains_allergies (Medical_Records ↔ Allergies, M:N via Medical_Record_Allergies) ===
     297a record can list multiple allergies, each with its own reaction and severity.
     298
     299=== includes_procedures (Medical_Records ↔ Procedures, M:N via Medical_Record_Procedures) ===
     300a record can reference multiple procedures.
     301
     302=== includes_lab_results (Medical_Records ↔ Lab_Results, M:N via Medical_Record_Lab_Results) ===
     303a record can reference multiple lab results.
     304
     305=== generates_referral (Medical_Records ↔ Referrals, 1:N) ===
     306a record can generate multiple referrals, each referral is based on one record.
     307
     308=== issues (Doctors ↔ Referrals as from_doctor_id, 1:N) ===
     309a doctor can issue many referrals.
     310
     311=== receives_referral (Doctors ↔ Referrals as to_doctor_id, 1:N) ===
     312a doctor can receive many referrals.
     313
     314=== creates (Doctors ↔ Medical_Report, 1:N) ===
     315a doctor can create multiple reports, each report is created by one doctor.
     316
     317=== generates_report (Medical_Records ↔ Medical_Report, 1:N) ===
     318a record can generate multiple reports, each report is based on one record.
     319
     320=== includes_lab_results_report (Medical_Report ↔ Lab_Results, M:N via Medical_Report_Lab_Results) ===
     321a report can include multiple lab results, a result can appear in multiple reports.
     322
     323=== processes (Admin ↔ Billing, 1:N) ===
     324an admin can process multiple bills, each bill is processed by one admin.
     325
     326=== generates_bill (Medical_Records ↔ Billing, 1:N) ===
     327a record can generate multiple bills, each bill is tied to one record.