OpenMRS is a collaborative open-source project to develop software to support the delivery of health care in developing countries. It allows the designing of medical record systems with minimal programming knowledge. Our mission is to improve health care delivery in resource-constrained environments by coordinating a global community to create and support this software.
The purpose of the Android Client is to provide an OpenMRS 2.x client for Android devices. The app is designed to cover most of the functionality currently on the web application. The app communicates with OpenMRS instances using REST. It supports working offline.
The first step to starting to contribute to the Android Client is installing Git Bash. You can also use Github Desktop, but using Bash is recommended. This is because Bash allows the user to perform more commands as compared to the latter. After downloading, you need to log in to Git Bash using your GitHub credentials.
- Download Git Bash for Mac
- Download Git Bash for Windows
- Download Git Bash for Linux/UNIX
- Download Github Desktop
- Fork the repository and clone your fork.
- From the Android Studio menu select
File
>New
>Import Project
. Alternatively, from theWelcome screen
, selectImport project
. - Navigate to the folder where you have cloned this repo and select the
build.gradle
file inside. SelectImport
. - Done! Wait for dependencies to load and download from Maven, then you're ready to go!
- Make sure that you have the latest SDK and build tools downloaded, as we always build against the latest release.
The first actual step in contributing to any open source project is forking and cloning the repository. Just head on to the repository on GitHub and click on the Fork button.
The next step is to clone your fork of the repository. You can do that by running
git clone https://github.com/[username]/openmrs-contrib-android-client
in Git Bash or your terminal.
The coding conventions used by OpenMRS are outlined here. These can be applied to Android Studio by following the steps given below.
- Install Eclipse Code Formatter plugin in Android studio
I. Go to
Settings
>Preferences
>Plugins
II. Select Marketplace and search for the plugin by name. Then install it - Copy the required XML
- Go to
Settings
>Eclipse Code Formatter
and import the XML created in the previous step - Now go to
Editor
>Code Style
in the same window - Select
Java
in the menu on the left and update values inImports
as shown in the below picture - Now select
XML
in the menu on left and update values in theTabs and Indents
tab as shown in the below picture
Please follow the below instructions while contributing:
- When project is opened with Android Studio, go to
File
>Settings
>Editor
>Code Style
- Select Project from the Scheme dropdown
- Make sure that hard wrap is set to 125 for Java and XML language settings.
We are following Google's MVP sample for this application's development.
In order to debug HTTP calls, we have integrated Chuck Library (a GUI-based open-source library) to track network calls. Apps using Chuck will display a notification showing a summary of ongoing HTTP activity. Tapping on the notification launches the full Chuck UI.
Note:
- If you are working behind a proxy, check this to get things working.
- To start development on a local server, type http://10.0.2.2:8080/openmrs (for Android Studio AVD) or http://10.0.3.2:8080/openmrs (for Genymotion) as URL.
Now that you've created a local repository, the next step is to find an issue to work on. You can either choose an existing issue or create an Issue ticket of your own.
All the Issues for the Android Client can be found here.
Please note that to gain access to the Issue Tracker, you would first have to submit a ticket to the helpdesk. For more details, head over to this link
If the issue is tagged Ready for Work
, you may claim it and start working on it.
To create an issue, you would need access to the Issue Tracker. To gain access, head over to this link and follow the instructions.
- Once you have access, Sign in to your account.
- Next, head over to the Android Client Issues Page.
- Click on the Create button to start creating a new issue.
- First, choose the issue type that best describes your issue.
- Provide a short summary of the issue.
- Your Issue description should cover the following points.
- Current Behavior
- Expected Behavior
- If it's a bug, then you need to write the Steps to reproduce the bug
- Also remember to add images to make things more clear.
- Add appropriate labels and Create the Issue.
- Once an org representative tags your issue as Ready for Work, you can claim the issue.
- First, open Git Bash and
cd
into your repository folder. - It is common practice to create a branch for every pull request.
- To create one, type
git checkout -b [AC-<issue-no.>]
- As stated in the OpenMRS Pull Request Guidelines, do not forget to name your branch the same as the issue that you have worked on
- Make the changes to the files that will solve the issue according to you.
It is always advised to run a Gradle check before you create a pull request. You can do this by typing ./gradlew check
in your terminal of Android Studio. If the check is failing, please fix all the errors.
When you're done with the changes, type these commands in the Git Bash.
git add .
git commit -m "commit message"
git push
Please note that the format of your commit message is supposed to be as descriptive as possible. Also, make sure you're in the branch that you created.
When you're done with all the steps above, you're finally ready to make a pull request. A pull request is you requesting the org maintainers to merge your changes to the actual project.
- You can make a pull request by heading over to your repository link, where you'll see your latest commit, and a button with the text
Create Pull Request
on it. - Title your Pull Request as
[AC-<IssueNumber>] <Short Description of what you did>
- Fill in all the details in the Pull Request template and finally post the Pull Request.
It is very common that a PR doesn't get approved on the first try and you are told to do some edits to your code. In a situation like this, your PR is obviously going to have a lot of commits. A large number of commits makes it difficult to manage the commit tree. That's when squashing is going to help you combine all the commits into one single one. You can squash your commits by typing these commands in the Bash:
git rebase -i HEAD~x
Please note that x is the number of commits you want to merge.
For example: git rebase -i HEAD~2
opens rebase for the last two commits.
You'll now see the commits that you've done in the branch with pick
as the prefix.
- Press
i
on your keyboard, and changepick
tos
for every commit except the topmost one. - Once you've done that, you'll need to save that. You can do this by pressing
esc
key and then typing:wq
and pressingenter
key. - Then you'll see a screen which shows the commit messages for the new changes that you've just done. Type
:wq
again.
Now that it's saved, you'll need to again push your changes. You can do this by typing git push --force
in the Bash Terminal.
Often times you'll be told to edit your commit message to the one suggested by the org maintainers. You can do this by typing git commit --amend
.