ikarera / DHIS2

DHIS2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DHIS2

DHIS2

DHIS-2 stands for District Health Information System, is the flexible, web-based open-source information system, provides many features for collect, validate, analysis, and present information. DHIS-2 is developed by the Health Information Systems Program (HISP) and globally distributed process with developers in many countries, and released under the BSD license and can be used at no cost. It runs on any platform with a Java Runtime Environment installed. DHIS 2 is the preferred health management information system used in over 30 countries and even more organizations across four continents. The strong points of DHIS-2 system are supporting awesome visualization features such as GIS, charts, and pivot tables. Moreover, with DHIS-2, users can capture data on any type of devices and supported many solutions based on HTML5, SMS, and Java.

EPM4D stands for Educational Profile Management for Doctors. The project is the new service which records the student certifications, candidates, and colleges. Then displaying data in browser, and supporting functionalities to the data.

Objectives of the project

  • Build new module in DHIS-2 System

  • Integrated this module to DHIS-2 System and make this module visual in DHIS-2 system

  • Using built-in services of DHIS-2 to implement the module functionalities

  • Integrating built-in services of DHIS-2 to improve the project more convenient

How to install DHIS2 for development

  1. Download and install these below components: Java SDK 7 (http://www.oracle.com/technetwork/java/javase/downloads/index.html) Bazaar (http://wiki.bazaar.canonical.com/Download) Maven (http://maven.apache.org/download.cgi)

  2. Register an account at LaunchPad (https://login.launchpad.net/BGN599r7tRgKnJ5z/+decide) then upload a SSH key pair (https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair) and finally log in by invoking bzr lp-login

  3. Get a copy of the source code from Launchpad by invoking bzr branch lp:dhis2

  4. To build the source code with Maven navigate to the /dhis-2 directory and invoke mvn install then navigate to the /dhis-2/dhis-web directory and invoke mvn install again.

  5. Each project in the /dhis-2/dhis-web directory is an individual web module. The dhis-web-portal project is an assembly of all the individual web modules. All of these modules can be started by invoking mvn jetty:run-war The web application can then be accessed at http://localhost:8080

  6. Install MySQL (H2 database or PostgreSQL)

Creating EPM4D module in DHIS-2 system

At the first time of building project, we create new module inside the DHIS-2 system in command line.

  • Go to DHIS-2 web folder: cd ../dhis2/dhis-2/dhis-web

  • Create new module by Maven command: mvn archetype:generate -DgroupId=org.dhis.hisp. -DartifactId=dhis-web-epm4d -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

This command will automatically create new module with group id is org.dhis.hisp, and artifactId is dhis-web-epm4d. Because the command is executed under the dhis-web module so in the pom.xml file which generated by run mvn command, will receive dhis-web as the parent module, and in dhis-web pom.xml file will automatically generate new module named dhis-web-epm4d which is the project module.

Build structure directory for the project

  • Open project in Intellij IDE and create directory structure similar to the directory structure of each module in DHIS-2 system.

Hibernate and MySQL

After successfully installing DHIS2 folders for development, you now need to configure hibernate file and install MySQL (in this project, we use MySQL to develop, if you are already committed in H2 or PostgreSQL, feel free to use your own. The configuration can be found at www.dhis2.org/development).

  • DHIS2 has its own hibernate configuration

  • It’s hibernate-default.properties locates in: dhis-2/dhis-support/dhis-support-hibernate/src/main/resources

  • By default dhis2 use h2 database to store databases

➔ Now we need to override this by: o Under our module/src/main/resources (or any safe place in your computer), create hibernate.properties file o Content of this file:

    hibernate.dialect = org.hibernate.dialect.MySQLDialect
    hibernate.connection.driver_class = com.mysql.jdbc.Driver
    hibernate.connection.url = jdbc:mysql://localhost/tutorial
    hibernate.connection.username = root (your MySQL username)
    hibernate.connection.password = dhis (your MySQL password)
    hibernate.hbm2ddl.auto = update
    
o  Create classpath to this file: create new classpath named DHIS2_HOME in 

variable environment points to above hibernate.properties

Integrate new module into DHIS2

  1. Open dhis-2/dhis-web/pom.xml: In tag modules, make sure our module existed like this
dhis-web-commons dhis-web-commons-resources dhis-web-api-mobile dhis-web-api dhis-web-api-fred dhis-web-maintenance dhis-web-dataentry dhis-web-importexport dhis-web-validationrule dhis-web-reporting dhis-web-mapping dhis-web-visualizer dhis-web-pivot dhis-web-dashboard-integration dhis-web-caseentry dhis-web-light dhis-web-mobile dhis-web-sms dhis-web-portal dhis-web-epm4d
  1. Open dhis-2/dhis-web/dhis2-web-portal/pom.xml: Add new dependency (our module) like this:
………….. ………….. org.hisp.dhis dhis-web-maintenance-appmanager ${project.version} war org.hisp.dhis dhis-web-epm4d ${project.version} war
  1. Open dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml Add our module into list of web-portal like this

dhis-web-maintenance-appmanager dhis-web-maintenance-dataadmin dhis-web-maintenance-datadictionary dhis-web-maintenance-dataset dhis-web-maintenance-mobile dhis-web-maintenance-organisationunit dhis-web-maintenance-patient dhis-web-maintenance-settings dhis-web-maintenance-user dhis-web-appmanager dhis-web-dashboard-integration dhis-web-dataentry dhis-web-validationrule dhis-web-visualizer dhis-web-mapping dhis-web-importexport dhis-web-caseentry dhis-web-light dhis-web-mobile dhis-web-pivot dhis-web-reporting dhis-web-sms

dhis-web-epm4d

  1. Dependencies
  • add some necessary dependencies into the project pom.xml file such as dhis-api, dhis-web-commons, dhis-web-commons-resources, dhis-service-core… These dependencies contain other necessary dependencies for our project.
  1. Create web.xml file
EDUCTION PROFILE MANAGEMENT contextConfigLocation classpath*:/META-INF/dhis/beans.xml automaticAccessType ghostAdmin RedirectFilter org.hisp.dhis.servlet.filter.HttpRedirectFilter redirectPath dhis-web-epm4d/index.action OpenSessionInViewFilter org.springframework.orm.hibernate4.support.OpenSessionInViewFilter springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy Struts org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* RedirectFilter / OpenSessionInViewFilter *.action OpenSessionInViewFilter /api/* springSecurityFilterChain /* Struts *.action org.springframework.web.context.ContextLoaderListener org.hisp.dhis.system.startup.StartupListener webapiServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:/META-INF/dhis/servlet.xml 1 webapiServlet /api webapiServlet /api/*

Now our new module is visible in browser when running mvn jetty:run-war in dhis-web-portal

READ REPORT.pdf FOR MORE DETAILS...

About

DHIS2