Skip to content

Commit

Permalink
MK: #5 ; module would create atomfeeds for existing Patients, Encount…
Browse files Browse the repository at this point in the history
…ers, DrugOrders if there is no entry for OpenSRP.* category i.e. module is installed first time
  • Loading branch information
Maimoona Kausar committed Apr 4, 2017
1 parent 5aa4a83 commit e03639d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openmrs-atomfeed-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.opensrp</groupId>
<artifactId>atomfeed</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</parent>

<artifactId>atomfeed-api</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions openmrs-atomfeed-api/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,24 @@
insert into role (role, description, uuid) values ('opensrp-rest-service', 'Default role for OpenSRP REST Service',uuid());
</sql>
</changeSet>
<changeSet id="opensrp-atomfeed-20170404-1" author="maimoonak">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from event_records where category LIKE 'opensrp%';</sqlCheck>
</preConditions>
<comment>Creating feeds for existing Patient, Encounter, DrugOrder data</comment>
<sql>
INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
SELECT UUID(), 'Patient_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/patient/', pr.uuid,'?v=full'), 'OpenSRP_Patient',p.date_created
FROM patient p JOIN person pr ON pr.person_id=p.patient_id;

INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
SELECT UUID(), 'Encounter_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/encounter/', e.uuid,'?v=full'), 'OpenSRP_Encounter',e.date_created
FROM encounter e;

INSERT INTO event_records(uuid, title, timestamp, uri, object, category, date_created)
SELECT UUID(), 'DrugOrder_Migrate', NOW(), null, CONCAT('/openmrs/ws/rest/v1/order/', o.uuid,'?v=full'), 'OpenSRP_DrugOrder',o.date_created
FROM orders o JOIN order_type ot ON o.order_type_id=ot.order_type_id WHERE ot.name IN ('drug order', 'drug_order', 'drug-order', 'drugorder');
</sql>
</changeSet>

</databaseChangeLog>
2 changes: 1 addition & 1 deletion openmrs-atomfeed-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.opensrp</groupId>
<artifactId>atomfeed</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</parent>

<artifactId>atomfeed-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion openmrs-atomfeed-omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.opensrp</groupId>
<artifactId>atomfeed</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</parent>

<scm>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.opensrp</groupId>
<artifactId>atomfeed</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
<packaging>pom</packaging>
<name>OpenSRP AtomFeed Module</name>
<description>Atomfeed publisher and consumer for OpenMRS to be consumed by OpenSRP or any other system.</description>
Expand Down

0 comments on commit e03639d

Please sign in to comment.