Skip to content

Commit 94c3e99

Browse files
:U4X-696:Create a Sync Profile for Mpox (#176)
1 parent 682c89b commit 94c3e99

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.openmrs.module.ugandaemrsync.tasks;
2+
3+
import org.apache.commons.logging.Log;
4+
import org.apache.commons.logging.LogFactory;
5+
import org.openmrs.api.context.Context;
6+
import org.openmrs.module.ugandaemrsync.api.UgandaEMRSyncService;
7+
import org.openmrs.module.ugandaemrsync.model.SyncFhirProfile;
8+
import org.openmrs.module.ugandaemrsync.server.SyncFHIRRecord;
9+
import org.openmrs.scheduler.tasks.AbstractTask;
10+
11+
public class MPOXScreeningTask extends AbstractTask {
12+
13+
Log log = LogFactory.getLog(MPOXScreeningTask.class);
14+
@Override
15+
public void execute() {
16+
UgandaEMRSyncService ugandaEMRSyncService = Context.getService(UgandaEMRSyncService.class);
17+
SyncFhirProfile syncFhirProfile = ugandaEMRSyncService.getSyncFhirProfileByScheduledTaskName("MONKEY POX SCREENING");
18+
SyncFHIRRecord syncFHIRRecord = new SyncFHIRRecord();
19+
20+
if(syncFhirProfile.getProfileEnabled()) {
21+
log.info("Generating Resources and cases for Profile " + syncFhirProfile.getName());
22+
syncFHIRRecord.generateCaseBasedFHIRResourceBundles(syncFhirProfile);
23+
}
24+
}
25+
}

api/src/main/resources/liquibase.xml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,30 @@
17421742
</insert>
17431743
</changeSet>
17441744

1745+
<!-- MPOX Screening task-->
1746+
<changeSet id="20240829-1043" author="solema" dbms="mysql">
1747+
<preConditions onFail="MARK_RAN">
1748+
<sqlCheck expectedResult="0">
1749+
SELECT COUNT(*) FROM scheduler_task_config WHERE uuid = 'cd29850a-6e41-4044-bcf4-6b5deb0c0b63'
1750+
</sqlCheck>
1751+
</preConditions>
1752+
<comment>Inserting Mpox Screening Task into 'schedule_task_config' table</comment>
1753+
<insert tableName="scheduler_task_config">
1754+
<column name="name" value="MONKEY POX SCREENING" />
1755+
<column name="description" value="The Monkye Pox Screening task" />
1756+
<column name="schedulable_class" value="org.openmrs.module.ugandaemrsync.tasks.MPOXScreeningTask" />
1757+
<column name="start_time_pattern" value="MM/dd/yyyy HH:mm:ss" />
1758+
<column name="start_time" valueDate="2024-01-11 23:59:59" />
1759+
<column name="repeat_interval" value="86400" />
1760+
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
1761+
<column name="created_by" value="1" />
1762+
<column name="start_on_startup" value="1"/>
1763+
<column name="started" value="1"/>
1764+
<column name="uuid" value="cd29850a-6e41-4044-bcf4-6b5deb0c0b63" />
1765+
</insert>
1766+
</changeSet>
1767+
1768+
17451769
<!--Mortality surveillance profile-->
17461770
<changeSet id="ugandaemrsync-20240112-0901" author="solema">
17471771
<preConditions onFail="MARK_RAN">
@@ -1769,6 +1793,50 @@
17691793
</insert>
17701794
</changeSet>
17711795

1796+
<!-- MPOX Screening Profile -->
1797+
<changeSet id="ugandaemrsync-20240829-1102" author="solema">
1798+
<preConditions onFail="MARK_RAN">
1799+
<sqlCheck expectedResult="0">
1800+
SELECT COUNT(*) FROM sync_fhir_profile WHERE uuid = 'ef2afcf1-e2f7-4bb4-aa68-b18266e0b35f'
1801+
</sqlCheck>
1802+
</preConditions>
1803+
<comment>Creating Mpox screening </comment>
1804+
<insert tableName="sync_fhir_profile">
1805+
<column name="name" value="MPOX Screening"/>
1806+
<column name="resource_types" value="Patient,Person,EpisodeOfCare,Encounter,Observation"/>
1807+
<column name="patient_identifier_type" value="3"/>
1808+
<column name="number_of_resources_in_bundle" value="100"/>
1809+
<column name="duration_to_keep_synced_resources" value="1"/>
1810+
<column name="generate_bundle" value="1"/>
1811+
<column name="is_case_based_profile" value="1"/>
1812+
<column name="case_based_primary_resource_type" value="Encounter"/>
1813+
<column name="case_based_primary_resource_type_id" value="09478ad9-ccc1-4cbe-9e55-473447984158"/>
1814+
<column name="resource_search_parameter" value='{"observationFilter":{"encounterReference":[],"patientReference":[],"hasMemberReference":[],"valueConcept":"valueConceptUUIDS","valueDateParam":{"lowerBound":"","myUpperBound":""},"valueQuantityParam":[],"valueStringParam":[],"date":{"lowerBound":"","myUpperBound":""},"code":[],"category":[],"id":[],"lastUpdated":{"lowerBound":"","myUpperBound":""}},"patientFilter":{"name":[],"given":[],"family":[],"identifier":[],"gender":[],"birthDate":{"lowerBound":"","myUpperBound":""},"deathDate":{"lowerBound":"","myUpperBound":""},"deceased":[],"city":[],"state":[],"postalCode":[],"country":[],"id":[],"lastUpdated":{"lowerBound":"","myUpperBound":""}},"encounterFilter":{"date":{"lowerBound":"","myUpperBound":""},"location":[],"participant":[],"subject":[],"type":["09478ad9-ccc1-4cbe-9e55-473447984158"],"id":[],"lastUpdated":{"lowerBound":"","myUpperBound":""}},"personFilter":{"name":[],"gender":[],"birthDate":{"lowerBound":"","myUpperBound":""},"deceased":[],"city":[],"state":[],"postalCode":[],"country":[],"id":[],"lastUpdated":{"lowerBound":"","myUpperBound":""}},"practitionerFilter":{"identifier":[],"name":[],"given":[],"family":[],"deceased":[],"city":[],"state":[],"postalCode":[],"country":[],"id":[],"lastUpdated":{"lowerBound":"","myUpperBound":""}},"episodeofcareFilter":{"type":[""],"lastUpdated":{"lowerBound":"","myUpperBound":""}}}'/>
1815+
<column name="url_end_point" value="https://ugisl.mets.or.ug/central-server"/>
1816+
<column name="creator" value="1"/>
1817+
<column name="date_created" value="2024-08-29 10:09:50"/>
1818+
<column name="voided" value="0"/>
1819+
<column name="uuid" value="ef2afcf1-e2f7-4bb4-aa68-b18266e0b35f"/>
1820+
</insert>
1821+
</changeSet>
1822+
1823+
<!-- MPOX Screening insertion-->
1824+
<changeSet id="ugandaemrsync-20240829-1150" author="solema" dbms="mysql">
1825+
<preConditions onFail="MARK_RAN">
1826+
<sqlCheck expectedResult="1">
1827+
SELECT COUNT(*) FROM scheduler_task_config WHERE uuid = 'cd29850a-6e41-4044-bcf4-6b5deb0c0b63'
1828+
</sqlCheck>
1829+
<sqlCheck expectedResult="0">
1830+
SELECT COUNT(*) FROM scheduler_task_config_property WHERE name = 'syncFhirProfileUUID' and value ='ef2afcf1-e2f7-4bb4-aa68-b18266e0b35f';
1831+
</sqlCheck>
1832+
</preConditions>
1833+
<comment>Inserting Mortality Surveillance task syncFhirProfileUUID property into 'scheduler_task_config_property' table</comment>
1834+
<sql>
1835+
INSERT INTO scheduler_task_config_property (name, value, task_config_id) VALUES ('syncFhirProfileUUID', 'ef2afcf1-e2f7-4bb4-aa68-b18266e0b35f', (select task_config_id from scheduler_task_config where uuid="cd29850a-6e41-4044-bcf4-6b5deb0c0b63"));
1836+
</sql>
1837+
</changeSet>
1838+
1839+
<!-- Mortality Surveillance insertion-->
17721840
<changeSet id="ugandaemrsync-20240228-0901" author="slubwama" dbms="mysql">
17731841
<preConditions onFail="MARK_RAN">
17741842
<sqlCheck expectedResult="1">

0 commit comments

Comments
 (0)