dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24274
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11866: Event analytics, including gender and isdead fixed attributes support
------------------------------------------------------------
revno: 11866
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-02 20:12:51 +0200
message:
Event analytics, including gender and isdead fixed attributes support
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-09-02 17:38:21 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-09-02 18:12:51 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.analytics.event.EventAnalyticsService;
import org.hisp.dhis.analytics.event.EventQueryParams;
import org.hisp.dhis.analytics.event.QueryItem;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
import org.hisp.dhis.common.IdentifiableObject;
@@ -72,6 +73,8 @@
private static final String ITEM_EXECUTION_DATE = "executiondate";
private static final String ITEM_ORG_UNIT = "ou";
private static final String ITEM_ORG_UNIT_NAME = "ouname";
+ private static final String ITEM_GENDER = "gender";
+ private static final String ITEM_ISDEAD = "isdead";
@Autowired
private ProgramService programService;
@@ -303,6 +306,16 @@
private IdentifiableObject getItem( String item, Program program )
{
+ if ( ITEM_GENDER.equalsIgnoreCase( item ) )
+ {
+ return new BaseIdentifiableObject( ITEM_GENDER, ITEM_GENDER, ITEM_GENDER );
+ }
+
+ if ( ITEM_ISDEAD.equalsIgnoreCase( item ) )
+ {
+ return new BaseIdentifiableObject( ITEM_ISDEAD, ITEM_ISDEAD, ITEM_ISDEAD );
+ }
+
DataElement de = dataElementService.getDataElement( item );
if ( de != null && program.getAllDataElements().contains( de ) )
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-08-27 11:53:08 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-09-02 18:12:51 +0000
@@ -157,6 +157,7 @@
"left join programinstance pi on psi.programinstanceid=pi.programinstanceid " +
"left join programstage ps on psi.programstageid=ps.programstageid " +
"left join program pr on pi.programid=pr.programid " +
+ "left join patient pa on pi.patientid=pa.patientid " +
"left join organisationunit ou on psi.organisationunitid=ou.organisationunitid " +
"left join _orgunitstructure ous on psi.organisationunitid=ous.organisationunitid " +
"where psi.executiondate >= '" + start + "' " +
@@ -212,13 +213,15 @@
columns.add( col );
}
+ String[] gender = { "gender", "character varying(5)", "pa.gender" };
+ String[] isdead = { "isdead", "boolean", "pa.isdead" };
String[] psi = { "psi", "character(11) not null", "psi.uid" };
String[] ps = { "ps", "character(11) not null", "ps.uid" };
String[] ed = { "executiondate", "date", "psi.executiondate" };
String[] ou = { "ou", "character(11) not null", "ou.uid" };
String[] oun = { "ouname", "character varying(160) not null", "ou.name" };
- columns.addAll( Arrays.asList( psi, ps, ed, ou, oun ) );
+ columns.addAll( Arrays.asList( gender, isdead, psi, ps, ed, ou, oun ) );
return columns;
}