OpenMRS resources: Difference between revisions

imported>Chrishay7
imported>Chrishay7
Line 108:
 
We'll be walking you through fixing [https://issues.openmrs.org/browse/TRUNK-3780 this bug], testing changes in the webapp, writing tests, and submitting a pull request!
 
= Your First OpenMRS Ticket =
In this workshop, you will work through the full development process involved in contributing to OpenMRS. To contribute to the project, one first needs to pick a sub-project to work on. In the open source community, this means claiming a ticket to work on. A ticket provides an overview of an issue that needs to be fixed or a new feature to be added, and is how work is divided up among contributors. In this workshop, you will pick a ticket to work on and hopefully fix the issue or create the new feature. Below is a list of starter tickets that will allow you to make a real contribution to the project. If you'd like to ease your way into this process, we also have a sample ticket that you can work on. The sample ticket is a real ticket, but is one that has already been completed. This allows you to work through a ticket similar to the starter tickets provided, but with a guide and provided solution there to assist you when needed.
 
You can choose from a list of starter tickets here:
 
If you're working on one of these, please edit the wiki and put your name next to it!
 
* [https://issues.openmrs.org/browse/TRUNK-3895 TRUNK-3895] Filter daemon user from user-related API methods
* [https://issues.openmrs.org/browse/TRUNK-3479 TRUNK-3479] Concept Validator should ignore short names
* [https://issues.openmrs.org/browse/TRUNK-3274 TRUNK-3274] Voided person addresses and names should be ignored by the short patient form validator
* [https://issues.openmrs.org/browse/TRUNK-2660 TRUNK-2660] Validate field lengths of domain objects in management pages
* [https://issues.openmrs.org/browse/TRUNK-4539 TRUNK-4539] Support validation in the UI for the database characters set for a field or column
* [https://issues.openmrs.org/browse/TRUNK-3849 TRUNK-3849] Move Address and Name layout support classes from web layer to api layer
* [https://issues.openmrs.org/browse/TRUNK-2941 TRUNK-2941] Find+Move mediawiki archive pages in confluence
* [https://issues.openmrs.org/browse/TRUNK-3709 TRUNK-3709] Secret answer should be encrypted
 
Or, you can choose to work on the sample ticket here: https://issues.openmrs.org/browse/TRUNK-3780
 
= Analyzing a Ticket =
After clicking on one of the links above, you'll come to a page that lists the details for an issue/feature that needs work. Ideally, it'll provide descriptions of the current behavior, the desired behavior, and areas of interest that might help fix the issue. Make sure to read through the comments section to get feel for the progress that's already been made.
 
 
For the sample ticket, please initially only read below the line saying "###DEPRECATED (this was the previous description)". This is what was originally provided when the ticket was created and was all that was given to work off of. Everything above the line was added by Chris and Katherine while they were in the process of fixing the issue, so only read this after analyzing the ticket yourself.
 
The issues at hand: patient search doesn't do prefix search for 2 character searches but does work for 3+ character searches. So it seems that somewhere it must be manually defined to only do prefix search with 3+ characters. How could this be used to create the desired behavior and fix the bug?
 
= Replicate the Issue =
After familiarizing yourself with the ticket, you then need to replicate the error. This will help provide additional context/error logs about the issue and will also ensure that you will be able to test whatever changes you make.
 
Sample ticket: Start the server and go to the webapp. Login using admin/Admin123 (try admin/test if that doesn't work). Navigate to the patient search and try searching for the name's described in the ticket.
 
= Looking Through the Code Base =
Once you can replicate the error, try to find and open the files related to the areas of interest (if provided). One way you can do this by opening up the OpenMRS project's folder in Sublime and clicking on Find->Find in Files. Then simply search for whatever might seem relevant to the issue.
 
Sample ticker: Search for PatientSearchCriteria, PatientServiceImpl, HibernatePatientDAO, and DWRPatientService. Ctrl-f through these to try to find something that might specify a minimum search requirement. Afterwards, look for similar variables via the Find in Files method. In this case, the same change was needed to be done in 2 files (since the java backend and javascript front end are separate).
 
= Testing Your Changes =
After making your changes, test them by trying to replicate the original issue once more. If your compilation fails because of failed tests, check to see if those tests are still necessary. If the desired behavior ''should'' cause them to fail, comment them out temporarily or make them work for the new code and try to compile again. If you now get the desired behavior, then you're almost done! Now you just need to add more unit tests.
 
Sample Project: If you get stuck and would like additional help finding the changes that need to be made, take a look at the commit summary for the accepted solution: https://github.com/openmrs/openmrs-core/pull/865/files
 
= Making Unit Tests =
Once you've fixed the bug or added the new feature, you want to make sure that others don't break it. To do this, find existing tests in the code base that relate to your ticket. Modify existing tests so that they properly test for the new behavior. Then add any additional tests you find necessary to ensure that your changes are kept when future contributors start messing with the code. Once this is done, re-compile and re-test your changes to make sure everything works.
 
= Submitting the Pull Request =
Ask Chris or Katherine to help you submit your changes.
 
= New beginner tasks =
Anonymous user