I had a really confusing problem in last week , In my mobile application i put loading indicator to notify user about waiting until all data loaded to that page. ( waiting for rendering the component data) So basically i was searching a way to add waiting functionality inside my component. Initially i used setTimeout function for waiting. ( i know it’s really bad ) Then I move to, waiting until data array is not null , or data length is not equals to 0 ( if data coming as an array ).

So this work perfectly until i…

I was stuck in a error which saying “Attempted to assign to readonly property” when i tried to add new element in the clone object of the redux state.I used spread operator , And it work properly in the emulator ( in my case ) . But when it comes to real devices it don’t work.

const userData = {… reduxState.UserData}

So i was searching for the solution. And this spread operator cannot clone “deep objects”. What i meant by the “deep objects”. Here is one example for Deep object.

example for deep Object.

So what we gonna do ?

I found many alternative…

Project — Enhancements of Attachments Module.

Primary mentor : @mksd ( Dimitri R)
Backup mentor : Muhammad Ahmed Memon , chine zoheir
Student: Ridmal Madushanka
Project wiki: Link


OpenMRS is an open source configurable software platform that provides health facilities with the ability to customize their electronic medical records (EMR) system with no programming knowledge. The Attachments Open-MRS add-on module (in short: ‘Attachments’) enables to view and manage file attachments. With it users (with the appropriate privileges) can upload , view and delete attachments associate with a patient record. …

In this week i mainly focus on the mock testing with Mokito for Attachment Resource DoSearch() method. I finish the implementation of the do Search method with some modifications such as create separate context independent search method inside the AttachmentResource which will help to fetch the Attachments using AttachmentService based on the given Parameters. And also this Search method was created for help the mock testing implementation since it is context independent.

So Basically inside the Mock Test class, it test the newly added Search method with the different scenarios ( By changing the parameters ) and verify that relevant…

In this week i did some Modifications to the ATT-24 issue. We mistakenly used includeRetired for includeVoided parameter in the java API implementation. So all the occurrences of includeRetired are modified to the includeVoided.

And I started to research on mock testing for Attachment resource for test the search() method. Because After discussion with my mentor he decided to go for mock Testing which can be used to implement test cases without any dependency.Some existing implementation can be found here ( In Bahmni-core module ). And I did some modifications to the ATT-27 issue and able to close the issue.

In this week I did some modifications in ATT-27 after review of my mentor. I modify separate test cases for upload method ( Attachment upload ) to test attachment upload with encounter , visit and without any encounter or visit.

And most importantly i created my mid term presentation which described the progress of my works in GSOC program. And i continue my research on OWA modification. And I started to implement the doSearch method in Attachment resource which will help to fetch the attachments from the rest services. It fetch the the data using Attachment Java API and user able to fetch ( search) Attachments based on the several parameters such as Patient, encounter , visit etc. And also user will able to fetch the encounter less attachment using rest services.

In this week also i worked with the ATT-27 issue which is modify the Attachment REST end point for file upload to Allow the upload attachments based on the specific encounter. And i do some modifictions to the current implementation and add exception handling inside the upload method.

Since my mentor was busy in last week, i was not able to start a new work ( waiting for his review for my previous work). But i dis some research about OWA ( Open Web App ). Because my next task is to Segerate attachment UI to an OWA. Challenges of this task is that integrate OWA to open MRS main dashborad since attachment module need to be displayed in two places in the Open MRS dashboard. ( Clinician Facing Patient Dashboard and on the Visits & Encounters Patient Dashboard)

In this week i worked with the ATT-27 issue which is modify the Attachment REST end point for file upload to Allow the upload attachments based on the specific encounter.Main tasks of this ticket is

  1. ensure that it would be possible to specify an encounter parameter to choose which encounter to hook the attachment to.

2. If both the visit and encounter parameter are provided together then an IllegalRequestExceptionshould be thrown if the encounter does not belong to the visit.

And i created a required unit test for test the modified attachment REST end point.

After successfully finish the java API my mentor will decide to start the work with Attachment resource and assign some work for me.

  1. First one is to modify the Attachment upload method by adding new part to upload the attachments based on the encounters. ( Existing Web service is required visits to upload the attachments )
  2. Create the do search method for Attachments which will used the developed java API to fetch the attachments based on the parameters given by the user.

In this ween i started to work on this two parts and unable to complete in this week because i was in the hospital for 4 days. And my mentor was very flexible at that time and give me some extra time to complete my tasks.

So in this week i was able to finish the Java API which was a main part of the ATT-24 issue in attachment module and it is merged to master branch of attachment module by my mentor. Mainly in this week i resolved some errors occurred in the unit tests of Attachment API.

There was a major error which was occurred because of the mismatch between actual attachments and expected attachments in the some unit tests.Both two list got same attachments but they are not in correct order. So first i had to found the methods which was occurred that…

Ridmal Madushanka

Software engineer at 99x Technology

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store