Soil-Carbon-Coalition / atlasbiowork

App framework based on wq for entering georeferenced data about landscape function
4 stars 2 forks source link

support for nested sub-observations #4

Closed sheppard closed 8 years ago

sheppard commented 8 years ago

This would likely involve wq/xlsconv#1 and an array syntax for the field names.

managingwholes commented 8 years ago

The repeated nested observation type did not work on first trial. Maybe I don't understand how to configure things?

Here is the form.json produced by https://atlasbiowork.com/media/forms/soilsample.xls

{"title": "soilsample", "children": [{"field_name": "date", "bind": {"required": "yes"}, "type_info": {"bind": {"type": "date"}, "control": {"tag": "input"}}, "name": "date", "label": "Date", "subtype_is_date": true, "hint": "Date samples were taken", "type": "date", "type_is_date": true, "html5_type": "date"}, {"field_name": "transect", "label": "Transect", "subtype_is_text": true, "name": "transect", "type_info": {"bind": {"type": "string"}, "control": {"tag": "input"}}, "hint": "If on a transect, identify the transect, distance, and side of tape", "type_is_text": true, "type": "text", "html5_type": false}, {"field_name": "top_cm", "bind": {"required": "yes"}, "subtype_is_decimal": true, "type_info": {"bind": {"type": "decimal"}, "control": {"tag": "input"}}, "name": "top_cm", "label": "top, cm", "hint": "Top of sample, cm below soil surface", "type_is_decimal": true, "type": "decimal", "html5_type": "number"}, {"field_name": "bottom_cm", "bind": {"required": "yes"}, "subtype_is_decimal": true, "type_info": {"bind": {"type": "decimal"}, "control": {"tag": "input"}}, "name": "bottom_cm", "label": "bottom, cm", "hint": "Bottom of sample, cm below soil surface", "type_is_decimal": true, "type": "decimal", "html5_type": "number"}, {"field_name": "num_composited", "bind": {"required": "yes"}, "type_info": {"bind": {"type": "int"}, "control": {"tag": "input"}}, "name": "num_composited", "label": "# composited", "type_is_int": true, "hint": "Number of samples composited", "subtype_is_integer": true, "type": "integer", "html5_type": "number"}, {"field_name": "description", "bind": {"required": "yes"}, "subtype_is_text": true, "type_info": {"bind": {"type": "string"}, "control": {"tag": "input"}}, "name": "description", "label": "Description", "hint": "Describe soil cover, moisture, conditions", "type_is_text": true, "type": "text", "html5_type": false}, {"field_name": "items", "bind": {"required": "yes"}, "children": [{"bind": {"required": "yes"}, "hint": "type of analysis", "type": "text", "name": "analysis", "label": "Analysis"}, {"bind": {"required": "yes"}, "hint": "Lab or person doing the analysis", "type": "text", "name": "lab", "label": "Lab or tester"}, {"bind": {"required": "yes"}, "type": "integer", "name": "count", "label": "analysis types"}], "name": "items", "label": "Soil analyses", "type": "repeat"}, {"field_name": "meta", "type": "group", "children": [{"bind": {"readonly": "true()", "calculate": "concat('uuid:', uuid())"}, "type": "calculate", "name": "instanceID"}], "name": "meta", "control": {"bodyless": true}}], "name": "soilsample", "urlpath": "soilsamples", "type": "survey", "sms_keyword": "soilsample", "id_string": "soilsample", "default_language": "default"}

sheppard commented 8 years ago

This looks like the right format. You probably just need to upgrade xlsconv to the latest master version.

managingwholes commented 8 years ago

OK did that, thanks for reminder. After deploying and reloading the form, I was not able to see or enter data into the nested part.

sheppard commented 8 years ago

I need to update the version number on xlsconv - until then be sure to uninstall before reinstalling, or you might still have the older version (since pip cancels an install when the version appears to be the same).

Once everything is working there should be a button to add a nested observation.

managingwholes commented 8 years ago

Uninstalled and installed xlsconv, then tried to deploy but got Import error: no module named 'survey' under the xlsconv stuff

managingwholes commented 8 years ago

With the new xlsconv formats, where do I put the path to the icon for the form?

sheppard commented 8 years ago

It sounds like your pyxform installation was overwritten with an official version during the upgrade. I'm using a custom version until the next release comes out. Try this:

sudo pip3 uninstall pyxform xlsconv
sudo pip3 install https://github.com/sheppard/pyxform/archive/xml.zip
sudo pip3 install https://github.com/wq/xlsform-converter/archive/master.zip
managingwholes commented 8 years ago

Seems to work now. Also I no longer get a server error when adding obs to existing site.