-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EA-184 - Move reporting module to an aware_of dependency (#229)
- Loading branch information
Showing
38 changed files
with
548 additions
and
896 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>emrapi</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>emrapi-api-reporting</artifactId> | ||
<packaging>jar</packaging> | ||
<name>EMR API Reporting API</name> | ||
|
||
<properties> | ||
<reportingVersion>1.25.0</reportingVersion> | ||
<serialization.xstreamVersion>0.2.16</serialization.xstreamVersion> | ||
<calculationVersion>1.3.0</calculationVersion> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.parent.groupId}</groupId> | ||
<artifactId>${project.parent.artifactId}-api</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.parent.groupId}</groupId> | ||
<artifactId>${project.parent.artifactId}-api</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
<type>test-jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>reporting-api</artifactId> | ||
<version>${reportingVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>reporting-api-1.10</artifactId> | ||
<version>${reportingVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>reporting-api-2.0</artifactId> | ||
<version>${reportingVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>reporting-api-2.2</artifactId> | ||
<version>${reportingVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>serialization.xstream-api</artifactId> | ||
<version>${serialization.xstreamVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>serialization.xstream-api-1.10</artifactId> | ||
<version>${serialization.xstreamVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>serialization.xstream-api-2.0</artifactId> | ||
<version>${serialization.xstreamVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>calculation-api</artifactId> | ||
<version>${calculationVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<includes> | ||
<include>**/*.properties</include> | ||
<include>**/*.xml</include> | ||
</includes> | ||
<filtering>true</filtering> | ||
</testResource> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<excludes> | ||
<exclude>**/*.properties</exclude> | ||
<exclude>**/*.xml</exclude> | ||
</excludes> | ||
<filtering>false</filtering> | ||
</testResource> | ||
</testResources> | ||
</build> | ||
</project> |
File renamed without changes.
49 changes: 49 additions & 0 deletions
49
...g/openmrs/module/emrapi/adt/reporting/evaluator/AwaitingAdmissionVisitQueryEvaluator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.openmrs.module.emrapi.adt.reporting.evaluator; | ||
|
||
import org.openmrs.Location; | ||
import org.openmrs.Visit; | ||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.module.emrapi.adt.AdtService; | ||
import org.openmrs.module.emrapi.adt.reporting.query.AwaitingAdmissionVisitQuery; | ||
import org.openmrs.module.reporting.evaluation.EvaluationContext; | ||
import org.openmrs.module.reporting.evaluation.EvaluationException; | ||
import org.openmrs.module.reporting.evaluation.context.VisitEvaluationContext; | ||
import org.openmrs.module.reporting.query.visit.VisitQueryResult; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
import org.openmrs.module.reporting.query.visit.evaluator.VisitQueryEvaluator; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
@Handler(supports = AwaitingAdmissionVisitQuery.class) | ||
@OpenmrsProfile(modules = { "reporting:*" }) | ||
public class AwaitingAdmissionVisitQueryEvaluator implements VisitQueryEvaluator { | ||
|
||
@Autowired | ||
AdtService adtService; | ||
|
||
@Override | ||
public VisitQueryResult evaluate(VisitQuery visitQuery, EvaluationContext evaluationContext) throws EvaluationException { | ||
AwaitingAdmissionVisitQuery eq = (AwaitingAdmissionVisitQuery) visitQuery; | ||
Location location = eq.getLocation(); | ||
Collection<Integer> patientIds = null; | ||
Collection<Integer> visitIds = null; | ||
if (evaluationContext.getBaseCohort() != null) { | ||
patientIds = evaluationContext.getBaseCohort().getMemberIds(); | ||
} | ||
if (evaluationContext instanceof VisitEvaluationContext) { | ||
VisitEvaluationContext visitEvaluationContext = (VisitEvaluationContext) evaluationContext; | ||
if (visitEvaluationContext.getBaseVisits() != null) { | ||
visitIds = visitEvaluationContext.getBaseVisits().getMemberIds(); | ||
} | ||
} | ||
List<Visit> results = adtService.getVisitsAwaitingAdmission(location, patientIds, visitIds); | ||
VisitQueryResult result = new VisitQueryResult(visitQuery, evaluationContext); | ||
for (Visit v : results) { | ||
result.add(v.getVisitId()); | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
api-reporting/src/test/java/org/openmrs/module/emrapi/BaseReportingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.openmrs.module.emrapi; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.openmrs.module.Module; | ||
import org.openmrs.module.ModuleFactory; | ||
import org.openmrs.test.BaseModuleContextSensitiveTest; | ||
|
||
import java.io.File; | ||
|
||
public abstract class BaseReportingTest extends BaseModuleContextSensitiveTest { | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
Module mod = new Module("", "reporting", "", "", "", "1.25.0"); | ||
mod.setFile(new File("")); | ||
ModuleFactory.getStartedModulesMap().put(mod.getModuleId(), mod); | ||
} | ||
|
||
@AfterClass | ||
public static void afterClass() { | ||
ModuleFactory.getStartedModulesMap().remove("reporting"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
api-reporting/src/test/resources/TestingApplicationContext.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> | ||
|
||
<!-- | ||
From applicationContext-service.xml in openmrs-api | ||
Needed to override and add hibernate mappings to the classpath since omod is not packaged yet | ||
--> | ||
<bean id="sessionFactory" class="org.openmrs.api.db.hibernate.HibernateSessionFactoryBean"> | ||
<property name="configLocations"> | ||
<list> | ||
<value>classpath:hibernate.cfg.xml</value> | ||
<value>classpath:test-hibernate.cfg.xml</value> | ||
</list> | ||
</property> | ||
<property name="mappingJarLocations"> | ||
<ref bean="mappingJarResources"/> | ||
</property> | ||
<property name="packagesToScan"> | ||
<list> | ||
<value>org.openmrs</value> | ||
</list> | ||
</property> | ||
<!-- default properties must be set in the hibernate.default.properties --> | ||
</bean> | ||
</beans> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE hibernate-configuration PUBLIC | ||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" | ||
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> | ||
|
||
<hibernate-configuration> | ||
<session-factory> | ||
<mapping resource="Provider.hbm.xml"/> | ||
<mapping resource="ProviderRole.hbm.xml"/> | ||
<mapping resource="ExportedPackage.hbm.xml" /> | ||
<mapping resource="ImportedPackage.hbm.xml" /> | ||
<mapping resource="ImportedItem.hbm.xml" /> | ||
<mapping resource="ReportDesign.hbm.xml" /> | ||
<mapping resource="MetadataSource.hbm.xml"/> | ||
<mapping resource="MetadataTermMapping.hbm.xml"/> | ||
<mapping resource="MetadataSet.hbm.xml"/> | ||
<mapping resource="MetadataSetMember.hbm.xml"/> | ||
</session-factory> | ||
</hibernate-configuration> |
Oops, something went wrong.