| | 1 | = UseCase16 - Lab Technician Login/Authentication = |
| | 2 | |
| | 3 | == Initiating Actor - `Lab Technician` == |
| | 4 | |
| | 5 | == Description == |
| | 6 | A lab technician logs into the Medora system using their username and password. The system verifies the credentials, checks the account is active, and grants access to the lab overview. |
| | 7 | |
| | 8 | == Scenario == |
| | 9 | |
| | 10 | 1. Lab technician navigates to the Medora login page. |
| | 11 | |
| | 12 | 2. Lab technician enters their username and password and submits the login form. |
| | 13 | |
| | 14 | {{{ |
| | 15 | #!sql |
| | 16 | SELECT |
| | 17 | u.user_id, |
| | 18 | u.username, |
| | 19 | u.password, |
| | 20 | u.role, |
| | 21 | u.first_name, |
| | 22 | u.last_name, |
| | 23 | u.is_active |
| | 24 | FROM users u |
| | 25 | WHERE u.username = 'darko.milosev'; |
| | 26 | }}} |
| | 27 | |
| | 28 | 3. System verifies the account is active and the password matches. |
| | 29 | |
| | 30 | {{{ |
| | 31 | #!sql |
| | 32 | SELECT u.user_id |
| | 33 | FROM users u |
| | 34 | WHERE u.username = 'darko.milosev' |
| | 35 | AND u.is_active = TRUE; |
| | 36 | }}} |
| | 37 | |
| | 38 | 4. System retrieves the linked lab technician profile. |
| | 39 | |
| | 40 | {{{ |
| | 41 | #!sql |
| | 42 | SELECT |
| | 43 | lt.technician_id, |
| | 44 | lt.user_id, |
| | 45 | lt.certification |
| | 46 | FROM lab_technician lt |
| | 47 | WHERE lt.user_id = (SELECT user_id FROM users WHERE username = 'darko.milosev'); |
| | 48 | }}} |
| | 49 | |
| | 50 | 5. Lab technician is authenticated and redirected to the lab dashboard. |
| | 51 | |
| | 52 | ''(No database operation — session/token is application-level)'' |
| | 53 | |
| | 54 | 6. System displays all pending lab tests for the technician to process. |
| | 55 | |
| | 56 | {{{ |
| | 57 | #!sql |
| | 58 | SELECT |
| | 59 | plt.performed_test_id, |
| | 60 | lt.test_name, |
| | 61 | u_p.first_name AS patient_first_name, |
| | 62 | u_p.last_name AS patient_last_name, |
| | 63 | u_d.first_name AS doctor_first_name, |
| | 64 | u_d.last_name AS doctor_last_name, |
| | 65 | plt.test_date, |
| | 66 | plt.notes |
| | 67 | FROM performed_lab_tests plt |
| | 68 | JOIN lab_tests lt ON plt.test_id = lt.test_id |
| | 69 | JOIN patients p ON plt.patient_id = p.patient_id |
| | 70 | JOIN users u_p ON p.patient_id = u_p.patient_id |
| | 71 | JOIN doctors d ON plt.doctor_id = d.doctor_id |
| | 72 | JOIN users u_d ON d.doctor_id = u_d.doctor_id |
| | 73 | ORDER BY plt.test_date; |
| | 74 | }}} |