diff --git a/README.md b/README.md index d6ecce9..0e4f76d 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,23 @@ How to execute the ETL script for the reports 1) Clone this repository in your home directory: git clone https://github.com/IsantePlus/etlscript +Note: Ensure you have mysql client installed locally 2) After cloning the etlscript repository, open the terminal and execute this command in the project root directory. + `./load.sh mysql_host> ` ie - ./load.sh root Admin123 localhost 3306 + ./load.sh root debezium localhost 3306 + + + In case the openmrs database user is not `openmrs_user` ie mysqluser, running the report would give error ie + `SELECT command denied to user 'mysqluser'@'172.28.0.3' for table 'patient'` + + login mysql as root user + + mysql -u root -pdebezium --protocol=tcp + run the command below as mysql root user - Note: Ensure you have mysql client installed locally + GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY 'mysqlpw'; diff --git a/sql_files/isanteplusreportsddlscript.sql b/sql_files/isanteplusreportsddlscript.sql index dfff749..f5a8951 100644 --- a/sql_files/isanteplusreportsddlscript.sql +++ b/sql_files/isanteplusreportsddlscript.sql @@ -42,14 +42,14 @@ CREATE TABLE if not exists `patient` ( CREATE TABLE if not exists `patient_visit` ( `visit_date` date DEFAULT NULL, `visit_id` int(11), - `encounter_id` int(11) DEFAULT NULL, - `location_id` int(11) DEFAULT NULL, + `encounter_id` int(11) , + `location_id` int(11) , `patient_id` int(11), `start_date` date DEFAULT NULL, `stop_date` date DEFAULT NULL, `creator` varchar(20) DEFAULT NULL, `encounter_type` int(11) DEFAULT NULL, - `form_id` int(11) DEFAULT NULL, + `form_id` int(11) , `next_visit_date` date DEFAULT NULL, `last_insert_date` date DEFAULT NULL, last_updated_date DATETIME, diff --git a/sql_files/run_isante_patient_status.sql b/sql_files/run_isante_patient_status.sql index 78ae87b..0923afc 100644 --- a/sql_files/run_isante_patient_status.sql +++ b/sql_files/run_isante_patient_status.sql @@ -1,9 +1,10 @@ - -DELIMITER $$ +/* commented this out because Table itech.patientStatusTemp is not created any where +also see isanteplusreportsdmlscript.sql */ +/*DELIMITER $$ DROP PROCEDURE IF EXISTS isanteplus.isantepatientstatus$$ CREATE PROCEDURE isanteplus.isantepatientstatus() - BEGIN - /*Adding patient_status_arv iSante to iSantePlus*/ + BEGIN + Adding patient_status_arv iSante to iSantePlus INSERT INTO isanteplus.patient_status_arv(patient_id,id_status,start_date,last_updated_date, date_started_status) SELECT p.patient_id, pst.patientStatus as id_status, pst.insertDate @@ -16,6 +17,6 @@ DELIMITER $$ on duplicate key update last_updated_date = values(last_updated_date); END$$ - DELIMITER ; + DELIMITER ;*/ - call isanteplus.isantepatientstatus(); \ No newline at end of file + /*call isanteplus.isantepatientstatus();*/ \ No newline at end of file