-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwork_allocation.sql
More file actions
296 lines (254 loc) · 12.3 KB
/
work_allocation.sql
File metadata and controls
296 lines (254 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: mysql:3306
-- Generation Time: Nov 19, 2025 at 06:45 PM
-- Server version: 8.0.42
-- PHP Version: 8.3.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `work_allocation`
--
-- --------------------------------------------------------
--
-- Table structure for table `assignment_log`
--
CREATE TABLE `assignment_log` (
`log_id` int NOT NULL,
`work_id` varchar(10) NOT NULL,
`resource_id` varchar(10) NOT NULL,
`assignment_timestamp` datetime NOT NULL,
`match_score` float DEFAULT NULL,
`reasoning` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `assignment_log`
--
INSERT INTO `assignment_log` (`log_id`, `work_id`, `resource_id`, `assignment_timestamp`, `match_score`, `reasoning`) VALUES
(1, 'W023', 'R005', '2025-11-19 18:42:03', 94, 'Dr. Sarah Chen (R005) is the best match for work W023 with a score of 94, demonstrating an exceptional fit based on her specialty as a Neurologist, high skill level, and extensive experience. Her high availability and perfect role match, alongside a reasonable current workload, further solidify this assignment, despite a moderate workload score.'),
(2, 'W024', 'R001', '2025-11-19 18:43:13', 92, 'Dr. John Smith (R001) is the best match for work W024 with a score of 92, driven by a perfect role match as a General Radiologist, high skill level, and extensive experience. His good availability and manageable current workload further solidify this optimal assignment.'),
(3, 'W025', 'R012', '2025-11-19 18:44:06', 86, 'Dr. David Lee (R012) is the best match for work W025 with a score of 86, largely due to his perfect role match as a Musculoskeletal Specialist, high skill level, and extensive experience. Although his availability score is lower, his strong performance in other critical areas makes him the most suitable candidate for this specialized x-ray.');
-- --------------------------------------------------------
--
-- Table structure for table `resources`
--
CREATE TABLE `resources` (
`resource_id` varchar(10) NOT NULL,
`name` varchar(100) NOT NULL,
`specialty` varchar(50) NOT NULL,
`skill_level` int NOT NULL,
`total_cases_handled` int DEFAULT '0'
) ;
--
-- Dumping data for table `resources`
--
INSERT INTO `resources` (`resource_id`, `name`, `specialty`, `skill_level`, `total_cases_handled`) VALUES
('R001', 'Dr. John Smith', 'General_Radiologist', 4, 178),
('R002', 'Dr. Emily Brown', 'General_Radiologist', 3, 100),
('R003', 'Dr. Michael Davis', 'General_Radiologist', 3, 172),
('R004', 'Dr. Alex Johnson', 'General_Radiologist', 4, 217),
('R005', 'Dr. Sarah Chen', 'Neurologist', 5, 345),
('R006', 'Dr. James Wilson', 'Neurologist', 2, 33),
('R007', 'Dr. Maria Garcia', 'Neurologist', 4, 226),
('R008', 'Dr. Kevin Park', 'Neurologist', 4, 279),
('R009', 'Dr. Robert Johnson', 'Cardiologist', 4, 189),
('R010', 'Dr. Lisa Anderson', 'Cardiologist', 3, 100),
('R011', 'Dr. Thomas White', 'Cardiologist', 3, 179),
('R012', 'Dr. David Lee', 'Musculoskeletal_Specialist', 5, 385),
('R013', 'Dr. Jennifer Martinez', 'Musculoskeletal_Specialist', 1, 61),
('R014', 'Dr. Patricia Taylor', 'Breast_Imaging_Specialist', 3, 94),
('R015', 'Dr. William Moore', 'Breast_Imaging_Specialist', 5, 374);
-- --------------------------------------------------------
--
-- Table structure for table `resource_calendar`
--
CREATE TABLE `resource_calendar` (
`calendar_id` varchar(10) NOT NULL,
`resource_id` varchar(10) NOT NULL,
`date` date NOT NULL,
`available_from` time NOT NULL,
`available_to` time NOT NULL,
`current_workload` int DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `resource_calendar`
--
INSERT INTO `resource_calendar` (`calendar_id`, `resource_id`, `date`, `available_from`, `available_to`, `current_workload`) VALUES
('C001', 'R001', '2024-11-10', '07:00:00', '19:00:00', 5),
('C002', 'R001', '2024-11-11', '09:00:00', '17:00:00', 3),
('C003', 'R001', '2024-11-12', '08:00:00', '13:00:00', 4),
('C004', 'R002', '2024-11-10', '13:00:00', '18:00:00', 2),
('C005', 'R002', '2024-11-11', '08:00:00', '13:00:00', 8),
('C006', 'R002', '2024-11-12', '09:00:00', '17:00:00', 8),
('C007', 'R003', '2024-11-10', '13:00:00', '18:00:00', 6),
('C008', 'R003', '2024-11-11', '07:00:00', '19:00:00', 8),
('C009', 'R003', '2024-11-12', '13:00:00', '18:00:00', 3),
('C010', 'R004', '2024-11-10', '08:00:00', '13:00:00', 9),
('C011', 'R004', '2024-11-11', '08:00:00', '13:00:00', 10),
('C012', 'R004', '2024-11-12', '09:00:00', '17:00:00', 4),
('C013', 'R005', '2024-11-10', '09:00:00', '17:00:00', 4),
('C014', 'R005', '2024-11-11', '09:00:00', '17:00:00', 4),
('C015', 'R005', '2024-11-12', '09:00:00', '17:00:00', 1),
('C016', 'R006', '2024-11-10', '09:00:00', '17:00:00', 0),
('C017', 'R006', '2024-11-11', '13:00:00', '18:00:00', 1),
('C018', 'R006', '2024-11-12', '09:00:00', '17:00:00', 4),
('C019', 'R007', '2024-11-10', '08:00:00', '13:00:00', 6),
('C020', 'R007', '2024-11-11', '09:00:00', '17:00:00', 8),
('C021', 'R007', '2024-11-12', '13:00:00', '18:00:00', 7),
('C022', 'R008', '2024-11-10', '09:00:00', '17:00:00', 8),
('C023', 'R008', '2024-11-11', '09:00:00', '17:00:00', 10),
('C024', 'R008', '2024-11-12', '09:00:00', '17:00:00', 2),
('C025', 'R009', '2024-11-10', '09:00:00', '17:00:00', 6),
('C026', 'R009', '2024-11-11', '09:00:00', '17:00:00', 6),
('C027', 'R009', '2024-11-12', '09:00:00', '17:00:00', 7),
('C028', 'R010', '2024-11-10', '09:00:00', '17:00:00', 3),
('C029', 'R010', '2024-11-11', '13:00:00', '18:00:00', 1),
('C030', 'R010', '2024-11-12', '09:00:00', '17:00:00', 8),
('C031', 'R011', '2024-11-10', '09:00:00', '17:00:00', 8),
('C032', 'R011', '2024-11-11', '13:00:00', '18:00:00', 1),
('C033', 'R011', '2024-11-12', '07:00:00', '19:00:00', 3),
('C034', 'R012', '2024-11-10', '09:00:00', '17:00:00', 9),
('C035', 'R012', '2024-11-11', '09:00:00', '17:00:00', 7),
('C036', 'R012', '2024-11-12', '09:00:00', '17:00:00', 3),
('C037', 'R013', '2024-11-10', '09:00:00', '17:00:00', 7),
('C038', 'R013', '2024-11-11', '09:00:00', '17:00:00', 8),
('C039', 'R013', '2024-11-12', '08:00:00', '13:00:00', 7),
('C040', 'R014', '2024-11-10', '09:00:00', '17:00:00', 4),
('C041', 'R014', '2024-11-11', '09:00:00', '17:00:00', 0),
('C042', 'R014', '2024-11-12', '09:00:00', '17:00:00', 8),
('C043', 'R015', '2024-11-10', '09:00:00', '17:00:00', 6),
('C044', 'R015', '2024-11-11', '09:00:00', '17:00:00', 10),
('C045', 'R015', '2024-11-12', '07:00:00', '19:00:00', 9);
-- --------------------------------------------------------
--
-- Table structure for table `specialty_mapping`
--
CREATE TABLE `specialty_mapping` (
`work_type` varchar(50) NOT NULL,
`required_specialty` varchar(50) NOT NULL,
`alternate_specialty` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
-- Dumping data for table `specialty_mapping`
--
INSERT INTO `specialty_mapping` (`work_type`, `required_specialty`, `alternate_specialty`) VALUES
('CT_Scan_Brain', 'Neurologist', 'General_Radiologist'),
('CT_Scan_Chest', 'General_Radiologist', NULL),
('Mammography', 'Breast_Imaging_Specialist', 'General_Radiologist'),
('MRI_Brain', 'Neurologist', 'General_Radiologist'),
('MRI_Cardiac', 'Cardiologist', 'General_Radiologist'),
('Ultrasound_Abdomen', 'General_Radiologist', NULL),
('X_Ray_Bone', 'Musculoskeletal_Specialist', 'General_Radiologist'),
('X_Ray_Chest', 'General_Radiologist', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `work_requests`
--
CREATE TABLE `work_requests` (
`work_id` varchar(10) NOT NULL,
`work_type` varchar(50) NOT NULL,
`description` text,
`priority` int NOT NULL,
`timestamp` datetime NOT NULL,
`status` varchar(20) DEFAULT 'pending',
`assigned_to` varchar(10) DEFAULT NULL
) ;
--
-- Dumping data for table `work_requests`
--
INSERT INTO `work_requests` (`work_id`, `work_type`, `description`, `priority`, `timestamp`, `status`, `assigned_to`) VALUES
('W001', 'CT_Scan_Chest', 'Lung nodule - URGENT', 4, '2024-11-12 07:17:00', 'pending', NULL),
('W002', 'MRI_Brain', 'Acute stroke evaluation - URGENT', 4, '2024-11-12 03:47:00', 'completed', 'R011'),
('W003', 'CT_Scan_Chest', 'Cancer staging', 1, '2024-11-10 13:13:00', 'pending', NULL),
('W004', 'CT_Scan_Brain', 'Head trauma assessment', 3, '2024-11-12 04:34:00', 'pending', NULL),
('W005', 'Mammography', 'Annual screening', 3, '2024-11-10 08:48:00', 'assigned', 'R015'),
('W006', 'Ultrasound_Abdomen', 'Kidney stone suspected', 2, '2024-11-10 21:48:00', 'pending', NULL),
('W007', 'CT_Scan_Chest', 'Cancer staging', 1, '2024-11-11 06:38:00', 'pending', NULL),
('W008', 'CT_Scan_Brain', 'Post-surgery follow-up', 2, '2024-11-11 08:05:00', 'pending', NULL),
('W009', 'X_Ray_Bone', 'Joint pain evaluation', 3, '2024-11-10 10:42:00', 'pending', NULL),
('W010', 'X_Ray_Chest', 'Annual checkup', 3, '2024-11-10 14:24:00', 'pending', NULL),
('W011', 'X_Ray_Bone', 'Joint pain evaluation', 2, '2024-11-10 21:42:00', 'pending', NULL),
('W012', 'CT_Scan_Chest', 'COVID complications', 2, '2024-11-10 23:10:00', 'pending', NULL),
('W013', 'X_Ray_Chest', 'Cough and fever', 3, '2024-11-10 11:14:00', 'assigned', 'R009'),
('W014', 'X_Ray_Bone', 'Arthritis follow-up', 2, '2024-11-10 21:58:00', 'completed', 'R013'),
('W015', 'X_Ray_Bone', 'Joint pain evaluation', 3, '2024-11-11 09:56:00', 'completed', 'R005'),
('W016', 'Mammography', 'Follow-up abnormal mammogram', 2, '2024-11-10 23:47:00', 'pending', NULL),
('W017', 'X_Ray_Chest', 'Follow-up pneumonia', 3, '2024-11-11 09:23:00', 'pending', NULL),
('W018', 'MRI_Brain', 'Neurological symptoms', 1, '2024-11-10 11:55:00', 'pending', NULL),
('W019', 'MRI_Brain', 'Neurological symptoms', 2, '2024-11-11 08:24:00', 'pending', NULL),
('W020', 'Mammography', 'Annual screening', 3, '2024-11-10 08:43:00', 'assigned', 'R013'),
('W021', 'MRI_Brain', 'Stroke protocol - CRITICAL', 5, '2024-11-12 14:30:00', 'pending', NULL),
('W022', 'MRI_Cardiac', 'Post-heart attack - CRITICAL', 5, '2024-11-12 15:45:00', 'pending', NULL),
('W023', 'MRI_Brain', 'Urgent brain MRI for suspected stroke patient', 5, '2024-11-10 09:30:00', 'assigned', 'R005'),
('W024', 'Ultrasound_Abdomen', 'Kidney stone suspected, routine ultrasound required', 2, '2024-11-11 14:00:00', 'assigned', 'R001'),
('W025', 'X_Ray_Bone', 'Specialized x-ray for joint pain evaluation', 3, '2024-11-12 08:15:00', 'assigned', 'R012');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `assignment_log`
--
ALTER TABLE `assignment_log`
ADD PRIMARY KEY (`log_id`),
ADD KEY `work_id` (`work_id`),
ADD KEY `resource_id` (`resource_id`);
--
-- Indexes for table `resources`
--
ALTER TABLE `resources`
ADD PRIMARY KEY (`resource_id`);
--
-- Indexes for table `resource_calendar`
--
ALTER TABLE `resource_calendar`
ADD PRIMARY KEY (`calendar_id`),
ADD KEY `resource_id` (`resource_id`);
--
-- Indexes for table `specialty_mapping`
--
ALTER TABLE `specialty_mapping`
ADD PRIMARY KEY (`work_type`);
--
-- Indexes for table `work_requests`
--
ALTER TABLE `work_requests`
ADD PRIMARY KEY (`work_id`),
ADD KEY `assigned_to` (`assigned_to`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `assignment_log`
--
ALTER TABLE `assignment_log`
MODIFY `log_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `assignment_log`
--
ALTER TABLE `assignment_log`
ADD CONSTRAINT `assignment_log_ibfk_1` FOREIGN KEY (`work_id`) REFERENCES `work_requests` (`work_id`),
ADD CONSTRAINT `assignment_log_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`);
--
-- Constraints for table `resource_calendar`
--
ALTER TABLE `resource_calendar`
ADD CONSTRAINT `resource_calendar_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`);
--
-- Constraints for table `work_requests`
--
ALTER TABLE `work_requests`
ADD CONSTRAINT `work_requests_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `resources` (`resource_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;