Create login locations for Reg INSERT INTO location(name, creator, date_created, uuid) VALUES('Registration', 1, now(), uuid()); INSERT INTO location_tag_map(location_id, location_tag_id) VALUES((Select location_id from location where name ='Registration'), (Select location_tag_id from location_tag where name ='Login Location')); INSERT INTO location_encounter_type_map(location_id, encounter_type_id, creator, date_created, uuid) VALUES((Select location_id from location where name ='Registration'), (Select encounter_type_id from encounter_type where name ='REG'), 1, now(), uuid()); Create login locations and encounter_type for OPD INSERT INTO encounter_type(name, description, creator, date_created, retired, uuid) VALUES('OPD', 'OPD encounter type', 1, now(), 0, uuid()); INSERT INTO location(name, creator, date_created, uuid) VALUES('OPD', 1, now(), uuid()); INSERT INTO location_tag_map(location_id, location_tag_id) VALUES((Select location_id from location where name ='OPD'), (Select location_tag_id from location_tag where name ='Login Location')); INSERT INTO location_encounter_type_map(location_id, encounter_type_id, creator, date_created, uuid) VALUES((Select location_id from location where name ='OPD'), (Select encounter_type_id from encounter_type where name ='OPD'), 1, now(), uuid()); SELECT COUNT(*) FROM location where name in ('Discharge'); Setting Location for discharge INSERT INTO location(name, creator, date_created, uuid) VALUES('Discharge', 1, now(), uuid()); INSERT INTO location_tag_map(location_id, location_tag_id) VALUES((Select location_id from location where name ='DISCHARGE'), (Select location_tag_id from location_tag where name ='Login Location')); INSERT INTO location_encounter_type_map(location_id, encounter_type_id, creator, date_created, uuid) VALUES((Select location_id from location where name ='Discharge'), (Select encounter_type_id from encounter_type where name ='DISCHARGE'), 1, now(), uuid()); SELECT COUNT(*) FROM encounter_type where name = 'Field'; Setting Location for field INSERT INTO encounter_type(name, description, creator, date_created, retired, uuid) VALUES('FIELD', 'Field encounter', 1, now(), 0, uuid()); SELECT COUNT(*) FROM location where name = 'Field'; Setting Location for field INSERT INTO location(name, creator, date_created, uuid) VALUES('Field', 1, now(), uuid()); INSERT INTO location_tag_map(location_id, location_tag_id) VALUES((Select location_id from location where name ='Field'), (Select location_tag_id from location_tag where name ='Login Location')); INSERT INTO location_encounter_type_map(location_id, encounter_type_id, creator, date_created, uuid) VALUES((Select location_id from location where name ='Field'), (Select encounter_type_id from encounter_type where name ='FIELD'), 1, now(), uuid());