-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add list_name in JSON file #357
Conversation
Codecov Report
@@ Coverage Diff @@
## master #357 +/- ##
==========================================
+ Coverage 82.51% 82.52% +0.01%
==========================================
Files 23 23
Lines 3255 3257 +2
Branches 758 758
==========================================
+ Hits 2686 2688 +2
Misses 433 433
Partials 136 136
Continue to review full report at Codecov.
|
Hi, We looked at the suggestion of @lognaturel to name the list using a hash based on the values. Some context: We are creating a small tool that makes data dictionaries in HTML format out of the JSON output of pyxform. This helps users to navigate though very extensive ODK forms particularly those who use the data but did not created the form. Ideally if a user clicks on a select variable it will take him to a page showing the list of values. The hash option could be used to generate a first version of the dictionary but if in subsequent versions of the same ODK a choice list_name changes it values (form example by adding NA) it would be very difficult to locate the list in HTML dictionary to add NA as an option. Having the list_name in the JSON will help us a lot because we would be able to check if the list_name already exists in the HTML dictionary and if so add those options that are new. |
Would having a {
"name": "yes_no",
"type": "survey",
"title": "yes_no",
"id_string": "yes_no",
"sms_keyword": "yes_no",
"default_language": "default",
"version": "201909180243",
"choices": {
"yes_no": [
{
"name": "1",
"label": "Yes"
},
{
"name": "2",
"label": "No"
}
],
"fruit": [
{
"name": "mango",
"choice": "yes",
"label": "Mango"
},
{
"name": "orange",
"choice": "no",
"label": "Orange"
},
{
"name": "watermelon",
"choice": "no",
"label": "Watermelon"
}
]
},
"children": [
{
"name": "your_choice",
"label": "Your choice is?",
"type": "select one",
"children": [
{
"name": "1",
"label": "Yes"
},
{
"name": "2",
"label": "No"
}
]
},
{
"name": "fruit",
"label": "Fruit",
"type": "select one",
"itemset": "fruit",
"choice_filter": "choice=${your_choice}",
"children": [
{
"name": "mango",
"label": "Mango"
},
{
"name": "orange",
"label": "Orange"
},
{
"name": "watermelon",
"label": "Watermelon"
}
]
},
{
"name": "meta",
"type": "group",
"control": {
"bodyless": true
},
"children": [
{
"name": "instanceID",
"type": "calculate",
"bind": {
"readonly": "true()",
"calculate": "concat('uuid:', uuid())"
}
}
]
}
]
} This is not present when there is no choice filter. {
"name": "yes_no",
"type": "survey",
"title": "yes_no",
"id_string": "yes_no",
"sms_keyword": "yes_no",
"default_language": "default",
"version": "201909172025",
"children": [
{
"name": "your_choice",
"label": "Your choice is?",
"type": "select one",
"children": [
{
"name": "1",
"label": "Yes"
},
{
"name": "2",
"label": "No"
}
]
},
{
"name": "meta",
"type": "group",
"control": {
"bodyless": true
},
"children": [
{
"name": "instanceID",
"type": "calculate",
"bind": {
"readonly": "true()",
"calculate": "concat('uuid:', uuid())"
}
}
]
}
]
} |
Hiving the choices at the top does not solve the issue because you cannot link a simple select_one or multi_select with the items in choices. For example the variable "your_choice" you don't know that is linked to the choices called "yes_no". You might guess it by its values, but we end up with the problem I described before. Exactly, is not present when there is no choice filter. Thus I request to add it with a key called list_name but we can rename it to "itemset" if this does not make conflicts with third-party installations. My guess is that is safer to name it list_name and leave itemset when a choice filter is used. |
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
As of PyXForm v1.0.0 the 'list_name' field has been added to a forms generated JSON. More Info: XLSForm/pyxform#357
Rework of PR #354 because I messed up the code with reverts and such....
We can continue the discussion here :-)