Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ETL scripts to support mysql-v8.0 #359

Open
wants to merge 4 commits into
base: openmrs-2.6.x-upgrade
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>kenyaemrCharts</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<artifactId>kenyaemrCharts-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>kenyaemrCharts</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<artifactId>kenyaemrCharts-omod</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions omod/src/main/resources/sql/DDL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ DROP TABLE IF EXISTS kenyaemr_etl.etl_clinical_visit;
DROP TABLE IF EXISTS kenyaemr_etl.etl_peer_calendar;
DROP TABLE IF EXISTS kenyaemr_etl.etl_sti_treatment;
DROP TABLE IF EXISTS kenyaemr_etl.etl_peer_tracking;
--DROP TABLE IF EXISTS kenyaemr_etl.etl_gender_based_violence;
-- DROP TABLE IF EXISTS kenyaemr_etl.etl_gender_based_violence;
DROP TABLE IF EXISTS kenyaemr_etl.etl_treatment_verification;
DROP TABLE IF EXISTS kenyaemr_etl.etl_PrEP_verification;
DROP TABLE IF EXISTS kenyaemr_etl.etl_alcohol_drug_abuse_screening;
Expand Down Expand Up @@ -135,7 +135,7 @@ marital_status VARCHAR(50) DEFAULT NULL,
education_level VARCHAR(50) DEFAULT NULL,
kdod_service_number VARCHAR(50) DEFAULT NULL,
cadre VARCHAR(100) DEFAULT NULL,
rank VARCHAR(100) DEFAULT NULL,
kdod_rank VARCHAR(100) DEFAULT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a migration issue? Has the change cascaded in the reports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, is rank a reserved name in mysql 8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes rank is a reserved word in the new version, that's why I had to rename the column. And yes I will cascade these changes to the reports as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great

unit VARCHAR(100) DEFAULT NULL,
dead INT(11),
death_date DATE DEFAULT NULL,
Expand Down Expand Up @@ -2786,7 +2786,7 @@ INDEX(encounter_id),
INDEX(obs_id)
);

------------- create table etl_pre_hiv_enrollment_art-----------------------
-- ----------- create table etl_pre_hiv_enrollment_art-----------------------

CREATE TABLE kenyaemr_etl.etl_pre_hiv_enrollment_art (
uuid char(38),
Expand Down
16 changes: 8 additions & 8 deletions omod/src/main/resources/sql/DML.sql
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ select
max(if(pat.uuid='b8d0b331-1d2d-4a9a-b741-1816f498bdb6', pa.value, null)) as email_address,
max(if(pat.uuid='848f5688-41c6-464c-b078-ea6524a3e971', pa.value, null)) as unit,
max(if(pat.uuid='96a99acd-2f11-45bb-89f7-648dbcac5ddf', pa.value, null)) as cadre,
max(if(pat.uuid='9f1f8254-20ea-4be4-a14d-19201fe217bf', pa.value, null)) as rank,
max(if(pat.uuid='9f1f8254-20ea-4be4-a14d-19201fe217bf', pa.value, null)) as kdod_rank,
greatest(ifnull(pa.date_changed,'0000-00-00'),pa.date_created) as latest_date
from person_attribute pa
inner join
Expand Down Expand Up @@ -110,7 +110,7 @@ set d.phone_number=att.phone_number,
d.email_address=att.email_address,
d.unit=att.unit,
d.cadre=att.cadre,
d.rank=att.rank,
d.kdod_rank=att.kdod_rank,
d.date_last_modified=if(att.latest_date > ifnull(d.date_last_modified,'0000-00-00'),att.latest_date,d.date_last_modified)
;

Expand Down Expand Up @@ -735,7 +735,7 @@ END $$
DROP PROCEDURE IF EXISTS sp_populate_etl_program_discontinuation $$
CREATE PROCEDURE sp_populate_etl_program_discontinuation()
BEGIN
SELECT "Processing Program (HIV, TB, MCH,TPT,OTZ,OVC ...) discontinuations ", CONCAT("Time: ", NOW());
SELECT "Processing Program HIV, TB, MCH,TPT,OTZ,OVC ... discontinuations", CONCAT("Time: ", NOW());
insert into kenyaemr_etl.etl_patient_program_discontinuation(
patient_id,
uuid,
Expand Down Expand Up @@ -2854,7 +2854,7 @@ INSERT INTO kenyaemr_etl.etl_patients_booked_today(patient_id, last_visit_date)
SELECT patient_id, visit_date FROM kenyaemr_etl.etl_patient_hiv_followup
GROUP BY patient_id HAVING max(date(next_appointment_date)) = CURDATE();

--Viral load tracker
-- Viral load tracker
DROP TABLE IF EXISTS kenyaemr_etl.etl_viral_load_tracker;

CREATE TABLE kenyaemr_etl.etl_viral_load_tracker (
Expand Down Expand Up @@ -2908,7 +2908,7 @@ date_sub(curdate() , interval 12 MONTH) and date(curdate())
)vl
on t.patient_id = vl.patient_id;

--Tested contacts
-- Tested contacts
DROP TABLE IF EXISTS kenyaemr_etl.etl_hts_contacts;

CREATE TABLE kenyaemr_etl.etl_hts_contacts AS
Expand All @@ -2919,7 +2919,7 @@ ALTER TABLE kenyaemr_etl.etl_hts_contacts ADD INDEX(id);
ALTER TABLE kenyaemr_etl.etl_hts_contacts ADD INDEX(patient_id);
ALTER TABLE kenyaemr_etl.etl_hts_contacts ADD INDEX(visit_date);

--Linked contacts
-- Linked contacts
DROP TABLE IF EXISTS kenyaemr_etl.etl_contacts_linked;

CREATE TABLE kenyaemr_etl.etl_contacts_linked AS
Expand Down Expand Up @@ -5878,7 +5878,7 @@ where e.voided=0
group by o1.obs_id;

SELECT "Completed processing pre hiv enrollment ART data ", CONCAT("Time: ", NOW());
END$$
END $$

-- ------------- populate etl_covid_19_assessment-------------------------
DROP PROCEDURE IF EXISTS sp_populate_etl_covid_19_assessment $$
Expand Down Expand Up @@ -6988,7 +6988,7 @@ CALL sp_populate_etl_kp_sti_treatment();
CALL sp_populate_etl_kp_peer_calendar();
CALL sp_populate_etl_kp_peer_tracking();
CALL sp_populate_etl_kp_treatment_verification();
--CALL sp_populate_etl_gender_based_violence();
-- CALL sp_populate_etl_gender_based_violence();
CALL sp_populate_etl_PrEP_verification();
CALL sp_populate_etl_alcohol_drug_abuse_screening();
CALL sp_populate_etl_gbv_screening();
Expand Down
4 changes: 2 additions & 2 deletions omod/src/main/resources/sql/Scheduled_Updates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ max(if(pat.uuid='830bef6d-b01f-449d-9f8d-ac0fede8dbd3', pa.value, null)) as next
max(if(pat.uuid='b8d0b331-1d2d-4a9a-b741-1816f498bdb6', pa.value, null)) as email_address,
max(if(pat.uuid='848f5688-41c6-464c-b078-ea6524a3e971', pa.value, null)) as unit,
max(if(pat.uuid='96a99acd-2f11-45bb-89f7-648dbcac5ddf', pa.value, null)) as cadre,
max(if(pat.uuid='9f1f8254-20ea-4be4-a14d-19201fe217bf', pa.value, null)) as rank,
max(if(pat.uuid='9f1f8254-20ea-4be4-a14d-19201fe217bf', pa.value, null)) as kdod_rank,
greatest(ifnull(pa.date_changed,'0000-00-00'),pa.date_created) as latest_date
from person_attribute pa
inner join
Expand Down Expand Up @@ -119,7 +119,7 @@ set d.phone_number=att.phone_number,
d.email_address=att.email_address,
d.unit=att.unit,
d.cadre=att.cadre,
d.rank=att.rank,
d.kdod_rank=att.kdod_rank,
d.date_last_modified=if(att.latest_date > ifnull(d.date_last_modified,'0000-00-00'),att.latest_date,d.date_last_modified);


Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
</modules>

<properties>
<openMRSVersion>2.3.3</openMRSVersion>
<openMRSVersion>2.6.1</openMRSVersion>
<appframeworkVersion>2.13.0</appframeworkVersion>
<calculationVersion>1.2</calculationVersion>
<htmlformentryVersion>3.9.2</htmlformentryVersion>
<htmlformentryVersion>5.1.0</htmlformentryVersion>
<htmlwidgetsVersion>1.10.0</htmlwidgetsVersion>
<idgenVersion>4.5.0</idgenVersion>
<kenyaemrVersion>18.4.2</kenyaemrVersion>
<kenyacoreVersion>3.0.1</kenyacoreVersion>
<kenyaemrVersion>18.6.0</kenyaemrVersion>
<kenyacoreVersion>3.0.0</kenyacoreVersion>
<kenyauiVersion>3.0.0</kenyauiVersion>
<metadatadeployVersion>1.11.0</metadatadeployVersion>
<metadatasharingVersion>1.5.0</metadatasharingVersion>
<reportingVersion>1.18.0</reportingVersion>
<reportingVersion>1.25.0</reportingVersion>
<serializationxstreamVersion>0.2.14</serializationxstreamVersion>
<uiframeworkVersion>3.15.0</uiframeworkVersion>
<legacyUiVersion>1.5.0</legacyUiVersion>
<uiframeworkVersion>3.23.0</uiframeworkVersion>
<legacyUiVersion>1.15.0</legacyUiVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -249,15 +249,15 @@
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
Expand Down