opensrp / opensrp-client

Android app for Frontline Health Workers (FHWs).
Other
15 stars 32 forks source link

dynamic register creation using json config files #247

Open raihan-mpower opened 8 years ago

raihan-mpower commented 8 years ago

We need to create views with xml each time we program a new register and tying these views with variables from the forms is a huge hassle. One way of solving this issue might be to be able to create registers with dynamic views which would be created from json config files. I tried to list down some of the common widgets and properties we might need as information in our json config files in the following spreadsheet. Please feel free to add more if required. https://docs.google.com/spreadsheets/d/1lbu7DkVeQXNmkHHmYe3MjNXVw4jgpzaIwwb_zcAW_zg/edit?usp=sharing

To give an idea of how i expect these to work is a simple diagram untitled diagram So here we would have a register maker where we might be able to upload form definitions and tie them up with boxes we can drag and drop to a register view. This might generate a json config file which we can place in the apps asset folder and it can run from there on , read the config files and construct the views. We can start with simplest register widgets and add on more complex ones in the future. I have created a sample json config file as well . People can take a look and give their valuable feedback.

household.txt

mberg commented 8 years ago

Can we setup a call to discuss?

I think some of these widgets can be potentially defined by the data model. That might be a higher level of abstraction then we might want to worry about I realize.

On Thu, Jul 21, 2016 at 4:00 PM, raihan-mpower notifications@github.com wrote:

We need to create views with xml each time we program a new register and tying these views with variables from the forms is a huge hassle. One way of solving this issue might be to be able to create registers with dynamic views which would be created from json config files. I tried to list down some of the common widgets and properties we might need as information in our json config files in the following spreadsheet. Please feel free to add more if required.

https://docs.google.com/spreadsheets/d/1lbu7DkVeQXNmkHHmYe3MjNXVw4jgpzaIwwb_zcAW_zg/edit?usp=sharing

To give an idea of how i expect these to work is a simple diagram [image: untitled diagram] https://cloud.githubusercontent.com/assets/6203919/17023342/c154dffe-4f74-11e6-8186-0ecde52a9282.png So here we would have a register maker where we might be able to upload form definitions and tie them up with boxes we can drag and drop to a register view. This might generate a json config file which we can place in the apps asset folder and it can run from there on , read the config files and construct the views. We can start with simplest register widgets and add on more complex ones in the future. I have created a sample json config file as well . People can take a look and give their valuable {

"total_weight": "10", "bindtype":"household", "titles" :[ {"locale": "en", "titles":[{"title_1"},{"title_2"},{"title_3"},{"title_4"},{"title_5"}], "title_weight":[{"3"},{"2"},{"2"},{"2"},{"1"}] }, {"locale": "bn", "titles":[{"title_1"},{"title_2"},{"title_3"},{"title_4"},{"title_5"}], "title_weight":[{"3"},{"2"},{"2"},{"2"},{"1"}] }

],

"widgets" : [ { "type": "profile", "weight": "3", "contents":[ { "type":"profile_pic", "text" : "variable_name" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"profile_age", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_single_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_single_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_multiple_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" },

    ]
},
{
    "type":"schedule_widget",
    "weight" : "1",
    "contents":[
        {
            "alert_name": "alert_name_var",
            "type":"single_line",
            "text" : "variable_name",
            "typeface":"normal",
            "size":"12"
        }
    ]
}

]

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenSRP/opensrp-client/issues/247, or mute the thread https://github.com/notifications/unsubscribe-auth/AADiQRqp77BfT7YmmqxbMWJqp1YbPnxdks5qX21tgaJpZM4JRxFN .

mberg commented 8 years ago

We might also want to look at REACT and see if there are any android libraries thinking about this

On Thu, Jul 21, 2016 at 4:07 PM, Matt Berg mberg@ona.io wrote:

Can we setup a call to discuss?

I think some of these widgets can be potentially defined by the data model. That might be a higher level of abstraction then we might want to worry about I realize.

On Thu, Jul 21, 2016 at 4:00 PM, raihan-mpower notifications@github.com wrote:

We need to create views with xml each time we program a new register and tying these views with variables from the forms is a huge hassle. One way of solving this issue might be to be able to create registers with dynamic views which would be created from json config files. I tried to list down some of the common widgets and properties we might need as information in our json config files in the following spreadsheet. Please feel free to add more if required.

https://docs.google.com/spreadsheets/d/1lbu7DkVeQXNmkHHmYe3MjNXVw4jgpzaIwwb_zcAW_zg/edit?usp=sharing

To give an idea of how i expect these to work is a simple diagram [image: untitled diagram] https://cloud.githubusercontent.com/assets/6203919/17023342/c154dffe-4f74-11e6-8186-0ecde52a9282.png So here we would have a register maker where we might be able to upload form definitions and tie them up with boxes we can drag and drop to a register view. This might generate a json config file which we can place in the apps asset folder and it can run from there on , read the config files and construct the views. We can start with simplest register widgets and add on more complex ones in the future. I have created a sample json config file as well . People can take a look and give their valuable {

"total_weight": "10", "bindtype":"household", "titles" :[ {"locale": "en", "titles":[{"title_1"},{"title_2"},{"title_3"},{"title_4"},{"title_5"}], "title_weight":[{"3"},{"2"},{"2"},{"2"},{"1"}] }, {"locale": "bn", "titles":[{"title_1"},{"title_2"},{"title_3"},{"title_4"},{"title_5"}], "title_weight":[{"3"},{"2"},{"2"},{"2"},{"1"}] }

],

"widgets" : [ { "type": "profile", "weight": "3", "contents":[ { "type":"profile_pic", "text" : "variable_name" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"profile_age", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_single_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_single_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" } ] }, { "type":"text_multiple_line", "weight" : "2", "contents":[ { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" }, { "type":"single_line", "text" : "variable_name", "typeface":"normal", "size":"12" },

    ]
},
{
    "type":"schedule_widget",
    "weight" : "1",
    "contents":[
        {
            "alert_name": "alert_name_var",
            "type":"single_line",
            "text" : "variable_name",
            "typeface":"normal",
            "size":"12"
        }
    ]
}

]

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenSRP/opensrp-client/issues/247, or mute the thread https://github.com/notifications/unsubscribe-auth/AADiQRqp77BfT7YmmqxbMWJqp1YbPnxdks5qX21tgaJpZM4JRxFN .

raihan-mpower commented 8 years ago

I am looking into REACT to see if it can be applied in here and try out the pros and cons, maybe we can set up a call after the tech call this week , regarding this.