dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39965
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20229: Program indicators / analytics. Impl support for event_count and enrollment_count variables. Usef...
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 20229 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-18 14:51:09 +0200
message:
Program indicators / analytics. Impl support for event_count and enrollment_count variables. Useful when you just want to count what matches an indicator filter.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm
--
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-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-09-18 10:16:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-09-18 12:14:44 +0000
@@ -70,6 +70,9 @@
public static final String VAR_CURRENT_DATE = "current_date";
public static final String VAR_VALUE_COUNT = "value_count";
public static final String VAR_ZERO_POS_VALUE_COUNT = "zero_pos_value_count";
+ public static final String VAR_EVENT_COUNT = "event_count";
+ public static final String VAR_ENROLLMENT_COUNT = "enrollment_count";
+ public static final String VAR_TEI_COUNT = "tei_count";
public static final String EXPRESSION_PREFIX_REGEXP = KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT;
public static final String EXPRESSION_REGEXP = "(" + EXPRESSION_PREFIX_REGEXP + ")\\{([\\w\\_]+)" + SEPARATOR_ID + "?(\\w*)\\}";
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-09-11 11:54:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-09-18 12:51:09 +0000
@@ -773,6 +773,18 @@
return TextUtils.removeLast( sql, "+" ).trim() + ") as " + dbl + "),0)";
}
+ else if ( ProgramIndicator.VAR_EVENT_COUNT.equals( var ) )
+ {
+ return "distinct psi";
+ }
+ else if ( ProgramIndicator.VAR_ENROLLMENT_COUNT.equals( var ) )
+ {
+ return "distinct pi";
+ }
+ else if ( ProgramIndicator.VAR_TEI_COUNT.equals( var ) )
+ {
+ return "distinct tei";
+ }
return null;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2015-09-15 17:28:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2015-09-18 12:51:09 +0000
@@ -1029,3 +1029,6 @@
current_date=Current date
value_count=Value count
zero_pos_value_count=Zero or positive value count
+event_count=Event count
+enrollment_count=Enrollment count
+tei_count=Tracked entity instance count
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm 2015-09-18 10:16:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm 2015-09-18 12:14:44 +0000
@@ -35,22 +35,32 @@
<tr>
<td style="width:140px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td><input type="text" id="name" name="name" ></td>
- <td></td>
</tr>
<tr>
<td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td><input type="text" id="shortName" name="shortName" ></td>
- <td></td>
</tr>
<tr>
<td><label for="code">$i18n.getString( "code" ) </label></td>
<td><input type="text" id="code" name="code" ></td>
- <td></td>
</tr>
<tr>
<td><label for="description">$i18n.getString( "description" ) </label></td>
<td><textarea type="text" id="description" name="description" ></textarea></td>
- <td></td>
+ </tr>
+ <tr>
+ <td><label for="decimals">$i18n.getString( "decimals_in_data_output" )</label></td>
+ <td>
+ <select id="decimals" name="decimals">
+ <option>[$i18n.getString( "default" )]</option>
+ <option value="0">0</option>
+ <option value="1">1</option>
+ <option value="2">2</option>
+ <option value="3">3</option>
+ <option value="4">4</option>
+ <option value="5">5</option>
+ </select>
+ </td>
</tr>
<tr>
<td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
@@ -66,26 +76,11 @@
<option value="CUSTOM">$i18n.getString( "custom" )</option>
</select>
</td>
+ <td></td>
</tr>
<tr>
- <td><label for="decimals">$i18n.getString( "decimals_in_data_output" )</label></td>
- <td>
- <select id="decimals" name="decimals">
- <option>[$i18n.getString( "default" )]</option>
- <option value="0">0</option>
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- <option value="5">5</option>
- </select>
- </td>
- <td></td>
- </tr>
- <tr>
<td><label for="displayInForm">$i18n.getString( "display_in_form" )</label></td>
<td><input type="checkbox" id="displayInForm" name="displayInForm" value="true"></td>
- <td></td>
</tr>
</table>
<br>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js 2015-08-07 06:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js 2015-09-18 12:51:09 +0000
@@ -153,3 +153,19 @@
enable('rootDate');
}
}
+
+function setExpressionCount(type) {
+ $('#aggregationType').val('COUNT');
+
+ if ('psi' == type) {
+ $('#expression').val('V{event_count}');
+ }
+ else if ('pi' == type) {
+ $('#expression').val('V{enrollment_count}');
+ }
+ else if ('tei' == type) {
+ $('.#expression').val('V{tei_count}');
+ }
+}
+
+
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-09-08 17:39:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-09-18 12:51:09 +0000
@@ -85,6 +85,9 @@
<option value="current_date">$i18n.getString( "current_date" )</option>
<option value="value_count">$i18n.getString( "value_count" )</option>
<option value="zero_pos_value_count">$i18n.getString( "zero_pos_value_count" )</option>
+ <option value="event_count">$i18n.getString( "event_count" )</option>
+ <option value="enrollment_count">$i18n.getString( "enrollment_count" )</option>
+ <option value="tei_count">$i18n.getString( "tei_count" )</option>
</select>
</td>
</tr>
@@ -130,7 +133,12 @@
<a class="greyButtonLink" href="javascript:insertOperator( 'expression', '*' )" title="$i18n.getString( 'multiply' )">*</a>
<a class="greyButtonLink" href="javascript:insertOperator( 'expression', '/' )" title="$i18n.getString( 'divide' )">/</a>
<a class="greyButtonLink" href="javascript:insertOperator( 'expression', '+' )" title="$i18n.getString( 'plus' )">+</a>
- <a class="greyButtonLink" href="javascript:insertOperator( 'expression', '-' )" title="$i18n.getString( 'minus' )">-</a><br><br>
+ <a class="greyButtonLink" href="javascript:insertOperator( 'expression', '-' )" title="$i18n.getString( 'minus' )">-</a>
+ <span class="tipText" style="margin-left:10px">Count of</span>
+ <a href="javascript:setExpressionCount('psi')" title="Set expression to count of events">events</a> <span class="tipText">|</span>
+ <a href="javascript:setExpressionCount('pi')" title="Set expression to count of enrollments">enrollments</a> <span class="tipText">|</span>
+ <a href="javascript:setExpressionCount('tei')" title="Set expression to count of tracked entity instances">tracked entity instances</a>
+ <br><br>
</td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm 2015-09-18 10:16:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm 2015-09-18 12:14:44 +0000
@@ -35,22 +35,32 @@
<tr>
<td style="width:140px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td><input type="text" id="name" name="name" value='$encoder.htmlEncode($programIndicator.name)'></td>
- <td></td>
</tr>
<tr>
<td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td><input type="text" id="shortName" name="shortName" value='$encoder.htmlEncode($programIndicator.shortName)'></td>
- <td></td>
</tr>
<tr>
<td><label for="code">$i18n.getString( "code" )</label></td>
<td><input type="text" id="code" name="code" value='$!encoder.htmlEncode($programIndicator.code)'></td>
- <td></td>
</tr>
<tr>
<td><label for="description">$i18n.getString( "description" ) </label></td>
<td><textarea type="text" id="description" name="description">$!encoder.htmlEncode($programIndicator.description)</textarea></td>
- <td></td>
+ </tr>
+ <tr>
+ <td><label for="decimals">$i18n.getString( "decimals_in_data_output" )</label></td>
+ <td>
+ <select id="decimals" name="decimals">
+ <option>[$i18n.getString( "default" )]</option>
+ <option value="0"#if( $programIndicator.decimals == 0 ) selected="selected"#end>0</option>
+ <option value="1"#if( $programIndicator.decimals == 1 ) selected="selected"#end>1</option>
+ <option value="2"#if( $programIndicator.decimals == 2 ) selected="selected"#end>2</option>
+ <option value="3"#if( $programIndicator.decimals == 3 ) selected="selected"#end>3</option>
+ <option value="4"#if( $programIndicator.decimals == 4 ) selected="selected"#end>4</option>
+ <option value="5"#if( $programIndicator.decimals == 5 ) selected="selected"#end>5</option>
+ </select>
+ </td>
</tr>
<tr>
<td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
@@ -68,24 +78,8 @@
</td>
</tr>
<tr>
- <td><label for="decimals">$i18n.getString( "decimals_in_data_output" )</label></td>
- <td>
- <select id="decimals" name="decimals">
- <option>[$i18n.getString( "default" )]</option>
- <option value="0"#if( $programIndicator.decimals == 0 ) selected="selected"#end>0</option>
- <option value="1"#if( $programIndicator.decimals == 1 ) selected="selected"#end>1</option>
- <option value="2"#if( $programIndicator.decimals == 2 ) selected="selected"#end>2</option>
- <option value="3"#if( $programIndicator.decimals == 3 ) selected="selected"#end>3</option>
- <option value="4"#if( $programIndicator.decimals == 4 ) selected="selected"#end>4</option>
- <option value="5"#if( $programIndicator.decimals == 5 ) selected="selected"#end>5</option>
- </select>
- </td>
- <td></td>
- </tr>
- <tr>
<td><label for="displayInForm">$i18n.getString( "display_in_form" )</label></td>
<td><input type="checkbox" id="displayInForm" name="displayInForm" value="true"#if( $programIndicator.displayInForm ) checked="checked"#end></td>
- <td></td>
</tr>
</table>
<br>