Integrating the DHIS2 Dashboard: Difference between revisions

From IHRIS Wiki
Line 12: Line 12:
# Set cookies for dashboard and automatic login in dhis application in file ihris-common/modules/DHIS-Dashboard/lib/iHRIS_PageDashboard.php.  Example:  
# Set cookies for dashboard and automatic login in dhis application in file ihris-common/modules/DHIS-Dashboard/lib/iHRIS_PageDashboard.php.  Example:  
#:<source lang='php'>
#:<source lang='php'>
$cookie = explode('=', $cookie);  
$cookie = explode('=', $cookie);  
set_cookie('JSESSIONID', $cookie[1], time() + 6000, '/dhis', 'localhost',0);
set_cookie('JSESSIONID', $cookie[1], time() + 6000, '/dhis', 'localhost',0);
</source>
</source>
#:Note: Need to make it user customizable in future.  
#:Note: Need to make it user customizable in future.  

Revision as of 11:49, 19 June 2013

This document describes the work flow for iHRIS-DHIS Integration that is being developed for iHRIS India. Warning: The code is in development and is subject to change.

Source Code Location

https://code.launchpad.net/~sagarb-4488/indian-ihris/iHRIS-DHIS

  1. Start iHRIS Application and login
  2. Go to: Configure Module -> iHRIS Common -> enable 'DHIS Dashboard' module
  3. Create a Designation (number of health-workers by position) report
  4. Add xslt format in Export option of report view of newly created Designation report. (For different period id like monthly, yearly depends on the format which will be accepted in DHIS dxf2 module) Path to xslt files: (......./ihris-common/modules/DHIS-Dashboard/resource/xsltFiles/*)
  5. Checkout DHIS code from location (https://code.launchpad.net/~dhis2-devs- core/dhis2/DHIS_IHRIS_SYNC_2.12) and build it using india-pom.xml in (.../dhis2/dhis-web/dhis-web-portal/india-pom.xml)
  6. Add link to dhis application to view dashboard in file: (..../ihris-common/modules/DHIS-Dashboard/templates/en_US/dashboard.html) eg - "http://localhost:8080/dhis/dhis-web-dashboard-integration/index.action"
  7. Set cookies for dashboard and automatic login in dhis application in file ihris-common/modules/DHIS-Dashboard/lib/iHRIS_PageDashboard.php. Example:
    <source lang='php'>
$cookie = explode('=', $cookie); 
set_cookie('JSESSIONID', $cookie[1], time() + 6000, '/dhis', 'localhost',0);

</source>

  1. Note: Need to make it user customizable in future.
  2. Set path to store file xml file generated from report and to send to dhis
    • Go to file ihris-common/modules/DHIS- Dashboard/lib/I2CE_CustomReport_Display_DefaultDHISDashboard.php
    • Give path to create file and store xml output of report //enter data into file
    <source lang='php'>

$fp = fopen(".../path/output.xml", "w"); </source>

  1. Enter ihris login username and password in the file ihris-common/modules/DHIS-Dashboard/lib/I2CE_CustomReport_Display_DefaultDHISDashboard.php:
    <source lang='php'>

$login_submission = array( 'username' => "i2ce_admin", 'password' => "root" ); </source>

  1. Note: Need to make it user customizable in future.
  2. Assign Data Elements to Data Set and Data set to organization unit in DHIS application.
  3. Data Elements and Organization units are created in DHIS automatically once we send our first report
  4. After that only updated organization unit’s information is sent to DHIS. 13. To send data element for now we are writing queries in ihris-common/modules/DHIS- Dashboard/lib/I2CE_CustomReport_Display_DefaultDHISDashboard.php.
    Note: Need to make it user customizable in future.
  5. To send Data
    • Click on send report after selecting period
    • Next screen will appear like this
    • The data will then appear in Data entry screen for that month in DHIS application.
  6. Once we have that information in DHIS we can generate reports in DHIS.

Note: Some extra code (not necessary code) is there in DHIS-Dashboard module for DataElement and DataSet (Considering this might be useful in future)