INSERT INTO "tf_actor" (id, name, keyword) VALUES ('1', 'Label Broker', 'LB');
INSERT INTO "tf_actor" (id, name, keyword) VALUES ('2', 'Label Information Provider', 'LIP');

INSERT INTO "tf_transaction" (id, name, keyword) VALUES ('1', 'Label Delivery Request', 'LAB-61');
INSERT INTO "tf_transaction" (id, name, keyword) VALUES ('2', 'Query for Label Deliveyr Instruction', 'LAB-62');

TRUNCATE TABLE "validation_parameters";

INSERT INTO "validation_parameters" (id, hl7_version, message_type,profile_oid,actor_id,transaction_id) VALUES ('1', '2.5', 'OML^O33^OML_O33','1.3.6.1.4.12559.11.1.1.136',2,1);
INSERT INTO "validation_parameters" (id, hl7_version, message_type,profile_oid,actor_id,transaction_id) VALUES ('2', '2.5', 'ORL^O34^ORL_O34','1.3.6.1.4.12559.11.1.1.134',1,1);
INSERT INTO "validation_parameters" (id, hl7_version, message_type,profile_oid,actor_id,transaction_id) VALUES ('3', '2.5', 'QBP^SLI^QBP_Q11','1.3.6.1.4.12559.11.1.1.135',1,2);
INSERT INTO "validation_parameters" (id, hl7_version, message_type,profile_oid,actor_id,transaction_id) VALUES ('4', '2.5', 'RSP^SLI^RSP_K11','1.3.6.1.4.12559.11.1.1.137',2,2);

INSERT INTO "app_configuration" (id, variable, value) VALUES ('72', 'hl7_version', '2.5');

UPDATE "hl7_message" SET simulatedactor_id='1' WHERE simulated_actor='LB';
UPDATE "hl7_message" SET simulatedactor_id='2' WHERE simulated_actor='LIP';

UPDATE "hl7_message" SET transaction_id='1' WHERE transaction_key_word='LAB-61';
UPDATE "hl7_message" SET transaction_id='2' WHERE transaction_key_word='LAB-62';

UPDATE "hl7_message" SET sendingactor_id='1' WHERE (simulated_actor='LB' AND transaction_key_word='LAB-62');
UPDATE "hl7_message" SET sendingactor_id='2' WHERE (simulated_actor='LIP' AND transaction_key_word='LAB-61');
UPDATE "hl7_message" SET sendingactor_id='2' WHERE (simulated_actor='LB' AND transaction_key_word='LAB-61');
UPDATE "hl7_message" SET sendingactor_id='1' WHERE (simulated_actor='LIP' AND transaction_key_word='LAB-62');

UPDATE "hl7_message" SET receivingactor_id='2' WHERE (simulated_actor='LB' AND transaction_key_word='LAB-62');
UPDATE "hl7_message" SET receivingactor_id='1' WHERE (simulated_actor='LIP' AND transaction_key_word='LAB-61');
UPDATE "hl7_message" SET receivingactor_id='1' WHERE (simulated_actor='LB' AND transaction_key_word='LAB-61');
UPDATE "hl7_message" SET receivingactor_id='2' WHERE (simulated_actor='LIP' AND transaction_key_word='LAB-62');

UPDATE "hl7_message" SET sent_message_type='OML^O33^OML_O33' WHERE (sent_message_type='OML_O33');
UPDATE "hl7_message" SET sent_message_type='QBP^SLI^QBP_Q11' WHERE (sent_message_type='QBP_Q11');
UPDATE "hl7_message" SET ack_message_type='RSP^SLI^RSP_K11' WHERE (ack_message_type='RSP_K11');
UPDATE "hl7_message" SET ack_message_type='ORL^O34^ORL_O34' WHERE (ack_message_type='ORL_O34');

ALTER TABLE "hl7_message" DROP COLUMN "simulated_actor";
ALTER TABLE "hl7_message" DROP COLUMN "transaction_key_word";
ALTER TABLE "validation_parameters" DROP COLUMN "hl7_version";


UPDATE "specimen" SET container_type_id = '021';
UPDATE "specimen" SET container_type_text = 'Chemistry';