{"action":"created","issue":{"url":"https://api.github.com/repos/XLSForm/pyxform/issues/176","repository_url":"https://api.github.com/repos/XLSForm/pyxform","labels_url":"https://api.github.com/repos/XLSForm/pyxform/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/XLSForm/pyxform/issues/176/comments","events_url":"https://api.github.com/repos/XLSForm/pyxform/issues/176/events","html_url":"https://github.com/XLSForm/pyxform/issues/176","id":300437116,"number":176,"title":"Add type=xml-internal and generate instance XML from choices sheet","user":{"login":"lognaturel","id":967540,"avatar_url":"https://avatars3.githubusercontent.com/u/967540?v=4","gravatar_id":"","url":"https://api.github.com/users/lognaturel","html_url":"https://github.com/lognaturel","followers_url":"https://api.github.com/users/lognaturel/followers","following_url":"https://api.github.com/users/lognaturel/following{/other_user}","gists_url":"https://api.github.com/users/lognaturel/gists{/gist_id}","starred_url":"https://api.github.com/users/lognaturel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lognaturel/subscriptions","organizations_url":"https://api.github.com/users/lognaturel/orgs","repos_url":"https://api.github.com/users/lognaturel/repos","events_url":"https://api.github.com/users/lognaturel/events{/privacy}","received_events_url":"https://api.github.com/users/lognaturel/received_events","type":"User","site_admin":false},"labels":[{"id":846598065,"url":"https://api.github.com/repos/XLSForm/pyxform/labels/needs%20discussion","name":"needs discussion","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-26T23:32:02Z","updated_at":"2018-02-27T18:18:12Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"As a form designer, I want to be able to specify static data sets that can be queried from the form. Currently this can be hacked with `selects` and `choice-filter` but it's not elegant (e.g. https://docs.google.com/spreadsheets/d/1mQGVWaJA4QQp3jtddMdcRSDjc1O-j_bB79GUnlj5k10/edit#gid=0 where we want to specify a lookup table without needing an external file). \r\n\r\n#107 added type `xlm-external` to specify an external XML instance that can be queried from within the primary instance.\r\n\r\n`xml-internal` would work the same way but create an internal secondary instance. This is useful for specifying additional settings as described in #66 or including small, static data sets that are useful to do XPath queries on. \r\n\r\ntype         | name |\r\n----------|-------|\r\nxml-internal  | mydata |\r\n\r\nFor this to be useful, pyxform should also generate the instance. This could be done from the existing choices sheet which has very similar behavior currently. If going this route, it might be necessary to change the rules that govern whether or not a column's values are included in an instance. Currently columns other than name/value and label are only included if there's a choice-filter that uses it. For more generic data sets `choice-filter` doesn't make sense. For example, the rule could be changed to something like if any row in this list specifies a value in the column, include it.\r\n\r\nAlternately, another sheet with name something like `datasets` could be introduced. The benefit there is that `name` and `label` wouldn't need to be required and a different rule for including columns could easily be introduced.\r\n\r\nInstance generation should be possible for `xml-external` as well (much like the itemsets.csv file is generated). "},"comment":{"url":"https://api.github.com/repos/XLSForm/pyxform/issues/comments/368974872","html_url":"https://github.com/XLSForm/pyxform/issues/176#issuecomment-368974872","issue_url":"https://api.github.com/repos/XLSForm/pyxform/issues/176","id":368974872,"user":{"login":"MartijnR","id":627350,"avatar_url":"https://avatars1.githubusercontent.com/u/627350?v=4","gravatar_id":"","url":"https://api.github.com/users/MartijnR","html_url":"https://github.com/MartijnR","followers_url":"https://api.github.com/users/MartijnR/followers","following_url":"https://api.github.com/users/MartijnR/following{/other_user}","gists_url":"https://api.github.com/users/MartijnR/gists{/gist_id}","starred_url":"https://api.github.com/users/MartijnR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartijnR/subscriptions","organizations_url":"https://api.github.com/users/MartijnR/orgs","repos_url":"https://api.github.com/users/MartijnR/repos","events_url":"https://api.github.com/users/MartijnR/events{/privacy}","received_events_url":"https://api.github.com/users/MartijnR/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T18:18:12Z","updated_at":"2018-02-27T18:18:12Z","author_association":"CONTRIBUTOR","body":"Thanks for this. I think the use cases (vs. external data) are situations where the data is not used across forms, or where the user prefers an easier-to-understand (all-in-one xls file) method.\r\n\r\nDo you think the XML structure should be the same `<root><item>...</item></root>` as is currently used for selects and choice_filters, and equal to what's proposed [here](https://github.com/opendatakit/xforms-spec/issues/88)(excluding the proposed `lang` attribute addition I guess, as that's only solving a problem for external data)? That makes sense to me and puts us right on the path towards explicitly/properly adding external CSV data in the future.\r\n\r\nI don't have a strong preference for using the existing `choices` sheet vs a new `datasets` sheet. I agree the latter is a little more flexible because of bypassing the name/label column requirement, but it's mostly about what would be easier for users I think. At first glance, there seems to be a semantic difference between choices and the data added with new feature. However, it is possible to use the data in the new feature to generate a dynamic choice list for select questions as well and vice versa choices can currently be used for calculations (which might be confusing?)."}}
{"actor":{"display_login":"MartijnR"}}