Sunday, March 2, 2014


Dear all,

I will describe my work on the design and implementation of GSoC project 'Allow data entry from OpenDataKit' here in detail. Thank you for taking time to look at this blog.

Installation:

Created Launchpad account: https://launchpad.net
Added SSH key: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
Installed bzr on ubuntu: apt-get install bzr
Installed maven on ubuntu: apt-get install maven
Installed JDK on ubuntu

Code:
Login bzr: bzr lp-login anumnaveed1989
Download source: bzr branch lp:dhis2
root@ubuntu:/home/anum/dhis2# bzr branch lp:dhis2
The authenticity of host 'bazaar.launchpad.net (91.189.95.84)' can't be established.
RSA key fingerprint is 9d:38:3a:63:b1:d5:6f:c4:44:67:53:49:2e:ee:fc:89.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bazaar.launchpad.net,91.189.95.84' (RSA) to the list of known hosts.

  1197kB   210kB/s / Fetching revisions:Inserting stream:Estimating.. 9983    

cd dhis-2
mvn install 
cd /dhis-2/dhis-web
mvn install   

//////////////////////
Android Xform Development 

Opendatakit ODK

Install Notepad++
Install XML Tools for NOTEPAD++
Download tool from  http://sourceforge.net/projects/npp-plugins/files/XML%20Tools/
Copy ext_libs fils into root repo of Notepad++
Copy XMLTools.dll into plugin directory of Notepad++
Tidy up XMLTools settings like XML syntax auto-check, Tag auto-close etc
Restart Notepad ++

Create a sample xform as:
//////////////////////////////////
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
        <h:head>
<!-- Anum Naveed: This form is my first example of GSoC xform project for Google -->
                <h:title>Anum Naveed GSoC example</h:title>
                <model>
                        <instance>
                                <data id="firstelement">
                                        <StringData/>
                                </data>
                        </instance>
                        <bind nodeset="/data/StringData" type="string" />
                </model>
        </h:head>
        <h:body>

                <input ref="StringData">
                        <label>Enter Full Name of GSoC student</label>
                </input>
        </h:body>
</h:html>
////////////////////////////////////////////
Follow instructions to set up development environment for xforms and validation using javarosa https://bitbucket.org/javarosa/javarosa/wiki/buildxforms
Download javarosa form validater from https://bitbucket.org/javarosa/javarosa/wiki/JavaRosa-XForm-Validator

Download the jar files
 javarosa-xform-validator.jar
JavaRosaFormTest.jad
JavaRosaFormTest.jar

Download and Install JAVA WTK from http://www.oracle.com/technetwork/java/download-135801.html

Test the form:
Install Android SDK Emulator: http://developer.android.com/sdk/index.html
Run the executable to start the installation of packages after selecting the packages

Download ODK Collect tool from: http://opendatakit.org/downloads/download-info/odk-collect-apk/
Install ODK Tool:
Go to: sdk\platform-tools
Run adb.exe install ODK Collect v1.4 rev 1038.apk
That will install the collection tool for opendata kit. Success!

Start the Emulator, Now you will see the ODKCollect application in the emulator.
Copy form from disk to emulator as

adb.exe push anum.xml sdcard/odk/forms
106 KB/s (1363 bytes in 0.012s)

Go to android Menu:

Run ODTCollect as


Open XML Form named Anum.xml as:



Fill up the form with dummy data about my project:



My Anum.xml form looks like the following:

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
  <h:head>
    <!-- This is my first XFORM for GSoC 2014 project for DHIS2. I am excited-->
    <h:title>Anum Naveed - GSoC 2014 DHIS2</h:title>
    <model>
      <instance>
        <data id="myform">
          <meta>
            <instanceID/>
          </meta>
          <Anum/>
        </data>
      </instance>
      <itext>
        <translation lang="eng">
          <text id="/data/Anum:label">
            <value>Anum Naveed - XFORM Success!

</value>
          </text>
        </translation>
      </itext>
      <bind nodeset="/data/meta/instanceID" type="string" readonly="true()" calculate="concat('uuid:', uuid())"/>
      <bind nodeset="/data/Anum" type="string"/>
    </model>
  </h:head>
  <h:body>
    <input ref="/data/Anum">
      <label ref="jr:itext('/data/Anum:label')"/>
    </input>
  </h:body>
</h:html>


I have successfully managed to write a basic xform and deploy it on the emulator. Next step I am working on is to deep down into advanced xforms and work on DHIS codebase.

Really Excited about the project


No comments:

Post a Comment