Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_user> <mysql_password> mysql_host> <mysql_port>` 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';



6 changes: 3 additions & 3 deletions sql_files/isanteplusreportsddlscript.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions sql_files/run_isante_patient_status.sql
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,6 +17,6 @@ DELIMITER $$
on duplicate key update
last_updated_date = values(last_updated_date);
END$$
DELIMITER ;
DELIMITER ;*/

call isanteplus.isantepatientstatus();
/*call isanteplus.isantepatientstatus();*/