 ALTER TABLE possibleLocs
   ADD PRIMARY KEY (`doctor`, `time`);
 
-SET @doctor=(
-	SELECT `hash` FROM drshift WHERE `shift` = @shiftName
-	ORDER BY `hash`
-	LIMIT 1 OFFSET 1		# Change the OFFSET value if a different doctor is desired for the same shift.
-);
-SET @doctorIMEI=(
-	SELECT phones.phone_imei AS 'imei'
-	FROM wayward.drshift LEFT JOIN phones ON  drshift.`tattooNo` = phones.`phone_name`
-	WHERE `hash`= @doctor AND `shift`=@shiftName
-);
-
-
 DROP PROCEDURE IF exists load_dr_data;
 delimiter #
 CREATE PROCEDURE load_dr_data()

DECLARE numShifts INT unsigned default (SELECT COUNT(DISTINCT `shift`) FROM drshift);
DECLARE v_counterShift INT unsigned default 0;
DECLARE v_counterDoctor INT unsigned default 0;
DECLARE shiftName VARCHAR(45) default 0;
DECLARE doctor VARCHAR(45) default 0;
DECLARE doctorIMEI VARCHAR(45) default 0;
DECLARE numSecs INT unsigned default 59;

		);

		INSERT INTO possibleLocs (`doctor`,`time`,`doctorIMEI`,`shiftName`,`rdate`,`rtime`,`numapids`,`numwards`,`wards`,`apids`)
			SELECT DISTINCT doctor, `time`, doctorIMEI, shiftName1, rdate, rtime, numapids,
			count(DISTINCT han.`ward`) as numwards, GROUP_CONCAT(DISTINCT han.`ward` ORDER BY  han.`ward`) AS wards, apids
			FROM accesspointsPerEpoch
			RIGHT JOIN han
