The SHR Adapter module logging system

All requests made on the SHR module by the user will be logged

GET and POST requests will be logged seperately in different tables.

Logging GET requests

GET requests are stored in the rheashradapter_get_encounter_log table. The structure of the table is as follows -


DROP TABLE IF EXISTS `openmrs_test`.`rheashradapter_get_encounter_log`;
CREATE TABLE  `openmrs_test`.`rheashradapter_get_encounter_log` (
  `get_request_id` int(11) NOT NULL AUTO_INCREMENT,
  `patient_id` varchar(40) DEFAULT NULL,
  `encounter_unique_id` varchar(40) DEFAULT NULL,
  `enterprise_location_id` varchar(40) DEFAULT NULL,
  `date_start` varchar(40) DEFAULT NULL,
  `date_end` varchar(40) DEFAULT NULL,
  `log_time` varchar(40) DEFAULT NULL,
  `result` varchar(200) DEFAULT NULL,
  `error` varchar(255) DEFAULT NULL,
  `error_details` longtext,
  PRIMARY KEY (`get_request_id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8;

However, a GET request may resut in one or several encounters being returned to the user in hl7 message format. Therefore, it is importaint to record which encounters were retrived by which user.
Following is the strucutre of the table which records which encounter was retrieved per each request.



DROP TABLE IF EXISTS `openmrs_test`.`rheashradapter_matching_encounters`;
CREATE TABLE  `openmrs_test`.`rheashradapter_matching_encounters` (
`matching_encounters_id` int(11) NOT NULL AUTO_INCREMENT,
`get_request_id` int(11) DEFAULT NULL,
`encounter_id` int(11) DEFAULT NULL,
PRIMARY KEY (`matching_encounters_id`),
KEY `matching_id` (`get_request_id`),
CONSTRAINT `matching_id` FOREIGN KEY (`get_request_id`) REFERENCES `rheashradapter_get_encounter_log` (`get_request_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1148 DEFAULT CHARSET=utf8;

Logging POST requests

POST requests are stored in the rheashradapter_post_encounter_log table. The structure of the table is as follows -



DROP TABLE IF EXISTS `openmrs_test`.`rheashradapter_post_encounter_log`;
CREATE TABLE  `openmrs_test`.`rheashradapter_post_encounter_log` (
`post_request_id` int(11) NOT NULL AUTO_INCREMENT,
`patient_id` varchar(40) DEFAULT NULL,
`hl7_data` mediumtext,
`date_created` varchar(40) DEFAULT NULL,
`valid` smallint(6) NOT NULL DEFAULT '0',
`result` varchar(200) DEFAULT NULL,
`error` mediumtext,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`post_request_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;