GSoC 2022 with OpenMRS: Week 08

Kumuditha Karunarathna
2 min readAug 10, 2022

The Week 08 of Google Summer of Code started on 1st of August. In my previous blog post I talked about the mid-term evaluations, updates in the UI design and the progress of the form saving feature. Here is a link for that page. This week my main goal was to finish working on the now saving feature and start working on the interactive builder.

When updating or creating a form there are a series of operations for both of these scenarios. When creating a new form it sends an API call with the form data the user provided. The schema will only be uploaded if there is an edit to the default template in the schema editor. When uploading a schema the clobdata resource in OpenMRS rest web services is used. This will return a reference id for the uploaded schema. Once the response data is received the reference id should be attached to the resources section of the form. To attach the {form-uuid}/resource resource is used.

In the updating scenario it’s similar to the above steps but, it will only update the changed data. And if the schema is edited and there is a schema already linked, then before uploading the schema, first the current schema should be deleted, next the resource should be deleted in the form. Then the new schema should be uploaded and attached to the resources of the form.

When working on the above features I ran into an error when getting the reference id of the uploaded schema from the response data. We use the fetch API to upload the schema and the response body is a locked ReadableStream. I tried accessing the data but it threw more errors, and finally I was able to solve the issue using axios.

Next, I managed to create the form publish/unpublish feature. With this change the save form feature is completed. Currently my previous pull request is on review. Once it’s merged I’m able to send this PR.

These are the tasks that I was able to complete within this week. Next week my plan is to start working on the interactive builder. Thank you for reading, Stay tuned and check back next week for the ninth week’s blog post. Peace ✌️

--

--

Kumuditha Karunarathna

GSoC 22 OpenMRS, Software Engineering Undergraduate at University of Westminster, UK