Hi everyone, so I’ve been working on Bahmni Connect Android app and I’ve noticed that some redundant objects in the json data.
The data I’m referring to is the one that is stored in the resources
column of the forms table in Bahmni Connect Android database. The resources column basically contains all the metadata about the form i.e it will tell us what concepts make up the form, its datatype, its answers etc. This is for forms created using the Form Builder i.e Forms 2.0
Here is a sample data from the resources
column:
In our case we have a form called Treatment Form
and in it is a coded concept called Drug Name
which has various concepts as its answers. Currently we have 240 answers for it.
When I try to open the form on the app I get an error and the form does not open/render. So i reduced the number of answers from 240 to 230 and then the form did open without any problems.
I changed it to 240 again and did some debugging. I noticed that with 240 answers the column size was larger than the sqlite cursor size. Thats what the error stack mentioned.
Next, I went through the json representing the resources
column and found that the answers
object is repeated twice.
In the link provided above, you can observe the 1st instance of answers object at array►0►value►controls►1►concept►setMembers►0►answers►
and the 2nd instance at array►0►value►controls►1►controls►0►concept►answers►
Since its taking up twice the space required what is the reason for these both?
Similarly, we have the name
object and the names
object with names
containing the same data as names
. Also present are the links objects which seem to be totally unnecessary in Bahmni Connect app.
So my doubt is that can a lot of these be dropped like: one of the answers
object , the names
object, links
etc? Will it cause any problems?
Memory is a huge constraint on mobile devices and this is how it can be optimized.