GSoC 2022 with OpenMRS: Week 09
The Week 09 of Google Summer of Code started on 8th of August. In my previous blog post I talked about the progress of the form saving feature and the issues I ran into while working. Here is a link for that post. My main goal for this week was to send the pull request for the form saving feature and begin working on the interactive builder.
In the beginning of this week some changes were requested in the previous pull request. I was able to resolve the requested changes and update the pull request.
While working on the form saving feature, I ran into a problem where the schema needed to be used and edited across multiple components. For example, the form-editor
component contains the fetched schema. I need to use the same schema in the schema-editor
component as well, and when the schema is edited, the schema in the parent component (form-editor
) should be updated, like a global variable. I used a react context hook to solve this problem. React Context is a method for managing state globally.I was able to share the schema variable into specific components by using the react context hook.
In the previous post I mentioned that I that I had an issue on getting the data from the openmrsFetch
API. Therefore I used axios
on every POST request in the application. But it seems that only uploadSchema
request has this issue, all other POST requests doesn't have an issue on getting the response data. Therefore I switched those requests to openmrsFetch
.
Next I started working on the interactive builder. For this the first step was to read and separate the elements in a JSON schema. I was able to separate the pages and sections in a JSON. And also the interactive builder should be able to edit the data on those elements and also add or remove elements, I’m currently working on this.
The active pull request got merged and I was able to sent the save form pull request this week.
These are the things that I was able to complete within this week. Next week my plan make some progress in the interactive builder. Thank you for reading, Stay tuned and check back next week for the tenth week’s blog post. Peace ✌️