-
Notifications
You must be signed in to change notification settings - Fork 26
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
Proposal: external CSV data support #88
Comments
I'd like to expand on this by also providing a way to add translations to external data as follows:
The above "csv" (presented as a table) is transformed into the following XML (children of <root>
<item>
<name>0001</name>
<label lang="English">Johnson</label>
<label lang="Français">Le Johnson</label>
<rooms>2</rooms>
</item>
<item>
<name>0034</name>
<label lang="English">Doe</label>
<label lang="Français">Le Doe</label>
<rooms>5</rooms>
</item>
</root> |
Being able to use full XPath for CSV data we could support very complex CSV data queries, e.g. |
Yes, that would be very good indeed. A priori, the proposed syntax and approach seems good. Is it really necessary to have a different connector? Why not also use @dcbriccetti and @mdudzinski, you've been thinking about external secondary instances in the context of the JR implementation. What do you think about this extension? The proposal to add a |
I haven’t read this issue yet, but I’ll mention now, for what it’s worth, that the preload data sample form linked to from here uses file-csv. |
@dcbriccetti Can you say a little bit more about what you mean? JavaRosa does have a way to query arbitrary side loaded CSVs as described in the page you linked to but it doesn't allow for complex queries and the filename isn't included in the form which isn't very XForm-ish. That's why we're exploring an alternate approach that would be more in line with the rest of the specification. On the JavaRosa side there could possibly be some overlap in the implementation though that will be a separate conversation. I'm not seeing @MartijnR does the Dimagi specification use the |
I'm sorry, @dcbriccetti, I totally forgot that the preload implementation does indeed already use the Now that I see Based on all this, I'm in favor of making this an official part of the specification. I think @MartijnR has made a strong case for it and it does make sense at an ecosystem-level to have a way to interact with CSV external instances that is consistent with XML external instances. I believe this addition only affects clients implementing this spec since the Implementation-wise, XPath querying of external CSV instances won't be available in Collect immediately but that's ok. We can make sure that it is put on a roadmap eventually and clearly document what can and can't be queried through XPath. I think it would be terrific to move to a slightly more consistent process for approving these kinds of changes as we started discussing here. But this has been ongoing for a long time so I propose that we keep this conversation here and ask for a final sanity check from @clint-tseng, @dcbriccetti, @yanokwa and @dorey. Unless they see any show-stopping problems or think of someone else who should be involved, I think we can move ahead. |
Thanks for the feedback. Yes, the |
Is this issue still unresolved? I'm exploring the Collect side of this feature, whose behavior seems to indicate that the corresponding XForms functionality is complete. |
Thank you, @OpenDataNerd. I had asked for some final feedback but that was years ago and client implementations have moved forward. At this point it should just be written up for the spec. |
Now that we have a way to add external XML data, I'd like to propose to extend this by adding a way to add external CSV data. This proposal aims to meet these 2 requirements:
I think we'd end up inventing a CSV query language replacement for XPath if we don't use XPath.
The first part could be met by adding a
jr://file-csv
connector in the same style asjr://file
,jr://image
etc:The second part could be accomplished by defining a fixed transformation from CSV to XML. I'd like to propose to use the transformation that is identical to the one pyxform performs for the choices sheet when it creates a secondary XML instance for an
<itemset>
which is as follows.The above "csv" (presented as a table) is transformed into the following XML (children of
<instance id="..."/>
):P.S. whether these instances are dealt with internally as actual XML Documents or virtually e.g. a database table/document (as CommCare does) is up to the client and not part of the spec.
The text was updated successfully, but these errors were encountered: