Download Source Code for Development

From MoCa Development Wiki

Jump to: navigation, search

For developers: follow these instructions if you are interested in doing development and adding features to Moca. Before you begin, it is recommended that you visit the Installing Tools page. Browse the version 1.0 release of the Moca code is available on Google Code as of February 2010 and released under the BSD License: http://code.google.com/p/moca/

Contents

Moca Android Application

Get Code
  1. Import the “moca” client project code (Android application) into Eclipse from the server
    1. In Eclipse, right click in the left hand side panel (Package Explorer) > Import
    2. Click on SVN folder > Checkout project from SVN
    3. Create new repository location
      1. If you're downloading the code for deployment, use our stable release 1.0.
        Location: https://moca.googlecode.com/svn/clients/android/branches/release-1.0.x/
      2. If you're downloading the code for development, you'll want to take the code from the trunk and make sure you branch the code before making changes (svn copy from the command line or in Eclipse, Right-click on project > Team > Branch/Tag) Once the feature/changes are done, you can merge it back into the trunk.
        Location: https://moca.googlecode.com/svn/clients/android/trunk
    4. Click OK. Select entire contents of the folder. Finish.
    5. If you get compile errors related to the library paths not found or the android-4 device not found, it’s because you haven’t setup the Android Virtual devices (See http://www.mocamobile.org/development/index.php?title=Installing_Tools#Android_Tools section)
Important Code Files
  1. Entry point of application
    moca/src/org/moca/activity/Moca.java
  2. Controls main activity, launches a certain procedure, controls flow from page to page
    moca/src/org/moca/activity/
  3. MDS Interface with Moca Android app
    moca/src/org/moca/net/
  4. Elements on a Page (picture, free text, radio button)
    moca/src/org/moca/procedure/
  5. Code file that must be edited when new procedures are added
    moca/src/org/moca/util/MocaUtil.java
  6. Folder where XML files of new procedures are added
    moca/trunk/clients/moca/res/raw/
Run Android Application
  1. Run Moca in Android emulator on computer
    1. Right click the “MoCa” project > Run As > Android Application and it should automatically start up an Android 1.6 emulator
  2. ..OR.. Run Moca on Android Phone, attach phone to computer via USB cable
    1. In Eclipse, Right click the folder > Run > Android Application
Setup Phone
    1. On Phone, Hit Menu > Reload Database
    2. Menu > Settings
      1. Moca Dispatch Server URL: http://demo.sanamobile.org/mds
      2. Username: admin
      3. Password: Sanamobile1
      4. (or you can use the username: remotedoctor, password: Sanamobile1)
Uninstall Application
  1. Uninstall Moca application on Android Phone
    1. On phone, go to Home > Settings > Applications > Manage Applications > Moca
    2. Uninstall > OK
Create New Procedure
  1. Create new procedure for the phone (Read section on How to Define Your Own Procedures)
    1. Under the code branch, MoCa > res > raw
    2. Right click raw > New > File
    3. Create new xml file (ex: radiology.xml)
    4. To rename, Right click the file > Refactor > Rename
    5. Copy surgery.xml and create procedure and pages according to the doctor’s wishes
    6. Add this procedure to the list of procedures by going to MoCa > src > org.moca.util > MocaUtil.java

OpenMRS Module: Moca

Get Code
  1. Import the “moca-server” project code (OpenMRS Moca module) into Eclipse
    1. In Eclipse, right click in the left hand side panel (Package Explorer) > Import
    2. Click on SVN folder > Checkout project from SVN
    3. Create new repository location
      1. If you're downloading the code for deployment, use our stable release 1.0.
        Location: https://moca.googlecode.com/svn/servers/openmrs-modules/moca/tags/release-1.0
      2. If you're downloading the code for development, you'll want to take the code from the trunk and make sure you branch the code before making changes (svn copy from the command line or in Eclipse, Right-click on project > Team > Branch/Tag) Once the feature/changes are done, you can merge it back into the trunk.
        Location: https://moca.googlecode.com/svn/servers/openmrs-modules/moca/trunk
    4. Click OK. Select the entire contents of the folder. Finish.
Important Code Files
  1. Code for MDS Interface with OpenMRS Moca module
    moca-server/web/src/org/moca/queue/web/
  2. Controller objects for JSP pages
    moca-server/web/src/org/moca/queue/web/controller/
  3. JSP Pages
    moca-server/web/module/
  4. Servlets
    moca-server/web/src/org/moca/queue/web/servlet/
Compile .omod File
  1. To create the .omod file for this OpenMRS modules, open a command prompt.
    1. Change directory until you get to the moca-server folder that contains the build.xml file
    2. Execute
      ant clean package-module
    3. The .omod file will now appear in the moca-server/dist folder
Install Module into OpenMRS
  1. Use this .omod file to upload an updated copy of the module to OpenMRS (see OpenMRS installation instructions on how to install a new module).

OpenMRS Module: Flash Media Viewer

Get Code
  1. Import the “flashmediaviewer” project code (OpenMRS Moca Media Viewer module) into Eclipse
    1. In Eclipse, right click in the left hand side panel (Package Explorer) > Import
    2. Click on SVN folder > Checkout project from SVN
    3. Create new repository location
      1. If you're downloading the code for development, you'll want to take the code from the trunk and make sure you branch the code before making changes (svn copy from the command line or in Eclipse, Right-click on project > Team > Branch/Tag) Once the feature/changes are done, you can merge it back into the trunk.
        Location: https://moca.googlecode.com/svn/servers/openmrs-modules/viewer/trunk
    4. Click OK. Select the entire contents of the folder. Finish.
Compile .omod File
  1. To create the .omod file for these OpenMRS modules, open a command prompt.
    1. Change directory until you get to the flashmediaviewer folder that contains the build.xml file
    2. Execute
      ant clean package-module
    3. The .omod file will now appear in the flashmediaviewer/dist folder
Install Module into OpenMRS
  1. Use this .omod file to upload an updated copy of the module to OpenMRS (see OpenMRS installation instructions on how to install a new module).

OpenMRS Module: REST

Get Code
  1. Import the “rest” project code (OpenMRS REST module) into Eclipse
    1. In Eclipse, right click in the left hand side panel (Package Explorer) > Import
    2. Click on SVN folder > Checkout project from SVN
    3. Create new repository location
      1. If you're downloading the code for development, you'll want to take the code from the trunk and make sure you branch the code before making changes (svn copy from the command line or in Eclipse, Right-click on project > Team > Branch/Tag) Once the feature/changes are done, you can merge it back into the trunk.
        Location: https://moca.googlecode.com/svn/servers/openmrs-modules/rest/trunk
    4. Click OK. Select the entire contents of the folder. Finish.
Compile .omod File
  1. To create the .omod file for these OpenMRS modules, open a command prompt.
    1. Change directory until you get to the rest folder that contains the build.xml file
    2. Execute
      ant clean package-module
    3. The .omod file will now appear in the rest/dist folder
Install Module into OpenMRS
  1. Use this .omod file to upload an updated copy of the module to OpenMRS (see OpenMRS installation instructions on how to install a new module).

Flex Code for Flash Media Viewer

  1. (Optional) To get the Flash/Flex code for the media viewer in OpenMRS, install and open FlexBuilder (see [1])
  2. Check out code from repository location
    Location: https://moca.googlecode.com/svn/servers/openmrs-modules/flashviewer/trunk

MDS: Moca Dispatch Server

If you want to have a test server up or need an MDS instance for a deployment, see these directions on how to obtain the code and set it up. http://www.mocamobile.org/development/index.php?title=Setup_Servers#Install_Moca_Dispatch_Server_.28MDS.29