← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2303: Added DrillDown Functionility in DataElement Wise Graphical Analysis in dashboard

 

------------------------------------------------------------
revno: 2303
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-12-07 10:37:09 +0530
message:
  Added DrillDown Functionility in DataElement Wise Graphical Analysis in dashboard
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java
  local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.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 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsAction.java	2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/action/GetDataElementsAction.java	2010-12-07 05:07:09 +0000
@@ -164,9 +164,13 @@
         Iterator<DataElement> alldeIterator = dataElements.iterator();
         while ( alldeIterator.hasNext() )
         {
+            
             DataElement de1 = alldeIterator.next();
-            if ( !de1.getType().equals( DataElement.VALUE_TYPE_INT ) && !de1.getType().equals( DataElement.DOMAIN_TYPE_AGGREGATE ) )
+           // de1.getDomainType()
+            //if ( !de1.getType().equals( DataElement.VALUE_TYPE_INT ) || !de1.getType().equals( DataElement.DOMAIN_TYPE_AGGREGATE ) )
+            if ( !de1.getType().equals( DataElement.VALUE_TYPE_INT ) || !de1.getDomainType().equals( DataElement.DOMAIN_TYPE_AGGREGATE ) )    
             {
+                
                 alldeIterator.remove();
             }
         }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java	2010-12-06 05:36:08 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/GenerateGraphicalAnalyserDataElementsFormAction.java	2010-12-07 05:07:09 +0000
@@ -207,7 +207,8 @@
         while ( alldeIterator.hasNext() )
         {
             DataElement de1 = alldeIterator.next();
-            if ( !de1.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) && !de1.getType().equalsIgnoreCase( DataElement.DOMAIN_TYPE_AGGREGATE ) )
+            if ( !de1.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) || !de1.getDomainType().equalsIgnoreCase( DataElement.DOMAIN_TYPE_AGGREGATE ) )
+           // if ( !de1.getType().equalsIgnoreCase( DataElement.VALUE_TYPE_INT ) || !de1.getType().equalsIgnoreCase( DataElement.DOMAIN_TYPE_AGGREGATE ) )
             {
                 alldeIterator.remove();
             }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java	2010-12-06 05:36:08 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartDataElementAction.java	2010-12-07 05:07:09 +0000
@@ -42,6 +42,8 @@
 import org.amplecode.quick.StatementManager;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
 import org.hisp.dhis.dashboard.util.DataElementChartResult;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -144,6 +146,13 @@
     {
         this.periodService = periodService;
     }
+    
+    private CaseAggregationConditionService caseAggregationConditionService;
+    
+    public void setCaseAggregationConditionService( CaseAggregationConditionService caseAggregationConditionService )
+    {
+        this.caseAggregationConditionService = caseAggregationConditionService;
+    }
 /*    
     private DashBoardService dashBoardService;
 
@@ -368,6 +377,21 @@
         return yseriesList;
     }
     
+    private List<String> selectedValues;
+    
+    public List<String> getSelectedValues()
+    {
+        return selectedValues;
+    }
+
+    private List<String> selectedStatus;
+    
+    public List<String> getSelectedStatus()
+    {
+        return selectedStatus;
+    }
+
+   
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -398,6 +422,9 @@
         selEndPeriodList = new ArrayList<Date>();
         
         yseriesList = new ArrayList<String>();
+        
+        selectedValues = new ArrayList<String>();//for DrillDown
+        selectedStatus = new ArrayList<String>();
       //  DataElement dElement = new DataElement();
         
        // DataElementCategoryOptionCombo decoc1 = new DataElementCategoryOptionCombo();
@@ -881,13 +908,40 @@
                decoc = decocList.get( serviceCount );
                    
                series[serviceCount] = dataElement.getName() + " : " + decoc.getName();
+               
+               CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( dataElement, decoc );
+
+               //CaseAggregationMapping caseAggMapping = caseAggregationMappingService.getCaseAggregationMappingByOptionCombo( dElement, decoc1 );
+               
+               if( caseAggregationCondition == null )
+               {
+                   selectedStatus.add( "no" );
+               }
+               else
+               {
+                   selectedStatus.add( "yes" );
+               }
+
+               //System.out.println( "selectedStatus  : " + selectedStatus );
                yseriesList.add( dataElement.getName() + " : " + decoc.getName() );
            }
            else
            {
                decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
                series[serviceCount] = dataElement.getName();
-               
+
+               CaseAggregationCondition caseAggregationCondition = caseAggregationConditionService.getCaseAggregationCondition( dataElement, decoc );
+               
+               if( caseAggregationCondition == null )
+               {
+                   selectedStatus.add( "no" );
+               }
+               else
+               {
+                   selectedStatus.add( "yes" );
+               }
+               
+               //System.out.println( "selectedStatus  : " + selectedStatus );
                yseriesList.add( dataElement.getName() );
            }
            
@@ -895,8 +949,16 @@
            for( Date startDate : selStartPeriodList )
            {
                Date endDate = selEndPeriodList.get( periodCount );
-                              
+               //format.formatDate( date )
+               String tempStartDate = format.formatDate( startDate );
+               String tempEndDate   = format.formatDate( endDate );
+               
                categories[periodCount] = periodNames.get( periodCount );
+               PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+               
+               String values = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":"  + periodType + ":" + tempStartDate + ":" + tempEndDate;
+               selectedValues.add(values);
+             //  System.out.println( "selectedValues Size  : " + selectedValues.size() );
                
                Double aggDataValue = 0.0;
                if( aggDataCB != null )
@@ -908,12 +970,17 @@
                }
                else
                {
-                   PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+                 //  PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
                    Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
                    
                    for( Period period : periods )
                    {
                        DataValue dataValue = dataValueService.getDataValue( orgUnit, dataElement, period, decoc );
+                      
+                      // String values = orgUnit.getId() + ":"+ dataElement.getId() + ":"+ decoc.getId() + ":" + period.getId();
+                      // selectedValues.add(values);
+                       
+                      // System.out.println( "selectedValues  : " + selectedValues );
                        
                        try
                        {
@@ -944,7 +1011,8 @@
            
            serviceCount++;          
        }
-    
+       
+       
        dataElementChartResult = new DataElementChartResult( series, categories, data, chartTitle, xAxis_Title, yAxis_Title );
        return dataElementChartResult;
     }

=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java	2010-11-29 06:47:55 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateDrillDownResultAction.java	2010-12-07 05:07:09 +0000
@@ -7,6 +7,7 @@
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -25,7 +26,6 @@
 import jxl.format.Colour;
 import jxl.format.VerticalAlignment;
 import jxl.write.Label;
-import jxl.write.WritableCell;
 import jxl.write.WritableCellFormat;
 import jxl.write.WritableSheet;
 import jxl.write.WritableWorkbook;
@@ -39,6 +39,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
@@ -54,6 +55,7 @@
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.w3c.dom.Document;
@@ -207,7 +209,7 @@
 
     private String outputReportPath;
 
-    private Period startDate;
+   // private Period startDate;
 
     private OrganisationUnit selectedOrgUnit;
 
@@ -230,7 +232,21 @@
     private String deCodesXMLFileName;
 
     private String reportFileNameTB;
-
+    
+    private I18nFormat format;
+    
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    private Date tempStartDate;
+    
+    private Date tempEndDate;
+    
+    private PeriodType periodTypeName;
+    
+    private Collection<Period> periods;
     // </editor-fold>
 
     public String execute()
@@ -239,15 +255,29 @@
 
         values = selectedValues.split( ":" );
         int orgunit = Integer.parseInt( values[0] );
-        int periodid = Integer.parseInt( values[3] );
+       // int periodid = Integer.parseInt( values[3] );
         int deid = Integer.parseInt( values[1] );
         int cocid = Integer.parseInt( values[2] );
-
-        startDate = periodService.getPeriod( periodid );
+        
+        //06/12/2010
+        String periodType = values[3];
+        //Date  startDate = values[4];
+       // String endDate = values[5];
+        
+        tempStartDate = format.parseDate( values[4] );
+        tempEndDate   = format.parseDate( values[5] );
+        
+        
+        periodTypeName = periodService.getPeriodTypeByName( periodType );
+        periods = periodService.getPeriodsBetweenDates( periodTypeName, tempStartDate, tempEndDate );
+        
+        
+       // startDate = periodService.getPeriod( periodid );
         selectedOrgUnit = organisationUnitService.getOrganisationUnit( orgunit );
         de = dataElementService.getDataElement( deid );
         coc = dataElementCategoryOptionComboService.getDataElementCategoryOptionCombo( cocid );
-        System.out.println( "orgunit is " + orgunit + " de is " + deid + " coc is " + cocid + " period is " + periodid );
+        
+        System.out.println( "orgunit is " + orgunit + " de is " + deid + " coc is " + cocid + " periodType is " + periodType + " tempStartDate is " + tempStartDate + " tempEndDate is  " + tempEndDate );
 
         statementManager.initialise();
         raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
@@ -314,7 +344,12 @@
 
             List<PatientDataValue> patientDataValues = new ArrayList<PatientDataValue>();
             
-            patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, startDate ) );
+            for( Period period : periods )
+            {
+                patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, period ) );
+            }
+            
+           // patientDataValues.addAll( caseAggregationConditionService.getPatientDataValues( caseAggregationCondition, ou, startDate ) );
            // patientDataValues = caseAggregationMappingService.getCaseAggregatePatientDataValue( ou, startDate,
            //     caseAggMapping );
             if ( patientDataValues != null )
@@ -477,7 +512,7 @@
                     int tempColNo = colList.get( rowCount );
                     int sheetNo = sheetList.get( rowCount );
                     sheet0 = outputReportWorkbook.getSheet( sheetNo );
-                    WritableCell cell = sheet0.getWritableCell( tempColNo, rowNo );
+                   // WritableCell cell = sheet0.getWritableCell( tempColNo, rowNo );
                     // System.out.println(
                     // "_______________________ count = "+rowCount
                     // +"tempColNo = " + tempColNo + " rowNo = " + rowNo +

=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-12-02 11:15:31 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml	2010-12-07 05:07:09 +0000
@@ -60,6 +60,8 @@
 		</property>
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService">
 		</property>
+		<property name="caseAggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService">
+        </property>
     </bean>
     
 	<!-- for Chart Display -->	

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2010-11-22 13:02:23 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm	2010-12-07 05:07:09 +0000
@@ -180,8 +180,13 @@
 		                <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownResult( event, '$selectedValues.get($count3)' )" target="_blank">$data</a></td>                                    
 		                #set( $count3 = $count3 + 1 )
 		            #else-->
+		            #if( $categoryLB.equals( "period" ) && !$ougGroupSetCB && $selectedStatus.get($count1).equals("yes") )
+                         <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1"><a href="#" onclick="javascript:drillDownResult( event, '$selectedValues.get($count3)' )" target="_blank">$data</a></td>                                    
+                    #set( $count3 = $count3 + 1 ) 
+                    #else
 		                <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
 		            #end
+		          #end
 		        #end
 		        #set( $count1 = $count1 + 1 )
 		      </tr>