From 5b430c79d308e5ed66559551bb230208933c2eac Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Thu, 21 Apr 2022 10:03:28 +0300 Subject: [PATCH 1/7] minor clean up to have the scripts run on MySQL 5.7 and also comment out un used scripts --- sql_files/isanteplusreportsddlscript.sql | 6 +++--- sql_files/run_isante_patient_status.sql | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) 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 From a739e86f55cba73758eeecdc2d994579506e2be5 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Thu, 21 Apr 2022 10:31:31 +0300 Subject: [PATCH 2/7] update read me --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6ecce9..fb42f3e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,12 @@ How to execute the ETL script for the reports ./load.sh root Admin123 localhost 3306 - Note: Ensure you have mysql client installed locally + Note: Ensure you have mysql client installed locally . + + There are cases where running the report would give error like `user denied acces to table ...` + run the command below as root user + + GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY 'mysqlpw'; From ac0611b8c875cfbe26cca9031fc8c7153f75e4d6 Mon Sep 17 00:00:00 2001 From: Mutesasira Moses Date: Thu, 21 Apr 2022 10:33:09 +0300 Subject: [PATCH 3/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb42f3e..01cb7e8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ How to execute the ETL script for the reports Note: Ensure you have mysql client installed locally . - There are cases where running the report would give error like `user denied acces to table ...` + There are cases where running the report would give error ie `SELECT command denied to user 'mysqluser'@'172.28.0.3' for table 'patient'` run the command below as root user GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY 'mysqlpw'; From 1329c24768118255b22e52bc5e44c30fbfa99aae Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Thu, 21 Apr 2022 13:12:37 +0300 Subject: [PATCH 4/7] update read me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01cb7e8..c1a2b09 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ How to execute the ETL script for the reports Note: Ensure you have mysql client installed locally . There are cases where running the report would give error ie `SELECT command denied to user 'mysqluser'@'172.28.0.3' for table 'patient'` - run the command below as root user + run the command below as mysql root user GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY 'mysqlpw'; From c82b28a7204f586135108aaacd005367570eb465 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Thu, 21 Apr 2022 13:25:03 +0300 Subject: [PATCH 5/7] update read me --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c1a2b09..a0cca56 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,20 @@ 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 pdebezium localhost 3306 + + + There are cases where running the report would give error ie + `SELECT command denied to user 'mysqluser'@'172.28.0.3' for table 'patient'` - Note: Ensure you have mysql client installed locally . + login mysql as root user - There are cases where running the report would give error ie `SELECT command denied to user 'mysqluser'@'172.28.0.3' for table 'patient'` + mysql -u root -pdebezium --protocol=tcp run the command below as mysql root user GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'@'%' IDENTIFIED BY 'mysqlpw'; From 05f5bcf9b06aed2eb0651ccb1856efca23f65643 Mon Sep 17 00:00:00 2001 From: Mutesasira Moses Date: Fri, 6 May 2022 09:17:29 +0300 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0cca56..cd574d3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Note: Ensure you have mysql client installed locally ./load.sh root pdebezium localhost 3306 - There are cases where running the report would give error ie + 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 From 779f914c5b85f1dbfd1f6f8564b7b0f523f8d89f Mon Sep 17 00:00:00 2001 From: Mutesasira Moses Date: Fri, 6 May 2022 12:33:10 +0300 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd574d3..0e4f76d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Note: Ensure you have mysql client installed locally `./load.sh mysql_host> ` ie - ./load.sh root pdebezium 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