Skip to content
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

while trying to load webform, fails to fetch "jr://file-csv/features.csv" and "jr://instance/last-saved" #2201

Open
DanielJDufour opened this issue Feb 16, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@DanielJDufour
Copy link
Collaborator

Describe the bug
Project's Form XML includes <instance id="features" src="jr://file-csv/features.csv"/><instance id="__last-saved" src="jr://instance/last-saved"/>

To Reproduce
Steps to reproduce the behavior:

I reproduced this on my local branch.

Expected behavior
I'd expect web forms to gracefully handle the jr:// protocol

Screenshots

Image

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Macbook
  • OS: [e.g. iOS8.1] MacOS
  • Browser [e.g. stock browser, safari] Chrome
  • Version [e.g. 22] N/A

Additional context
I think @spwoodcock has been discussing this, but just wanted to document this to provide some concrete test cases/scenarios. There's a good chance on repeating what has already been said.

@DanielJDufour DanielJDufour added the bug Something isn't working label Feb 16, 2025
@DanielJDufour
Copy link
Collaborator Author

DanielJDufour commented Feb 16, 2025

I'm mainly creating this issue to encourage any ideas on what a good work-around could be ...

One option could be to add a ?mode=browser param/flag to the "/{project_id}/form-xml" endpoint. In this case, the Python code could return an XML where "jr://file-csv/features.csv" is replaced by a url like "http://api.fmtm.localhost:7050/projects/1/features.csv"

I'm very very new to this, so I know that I'm definitely missing something, please do share your thoughts :-)

@spwoodcock
Copy link
Member

spwoodcock commented Feb 17, 2025

Damn, this could be a tricky one:

  • select_one_from_file features.csv is the ODK XLSForm shorthand to reference the Entity list in ODK Central called features.

  • When loading the (parsed) XForm XML we also need to load the Entity data alongside it somehow (I.e. the building dataset). I'm not sure how ODK Collect handles this to be honest.

  • It looks like none of the wiring is in place for Web Forms to connect to ODK Central yet, but I think its next up on the agenda: https://getodk.notion.site/2cba7220132e49ffb56f8fce96d06bd0?v=9a7f435947a84f7eb10bdaa94d2bef11&p=cfaf1a600b8b472caceeed64e2d818dc&pm=s

  • This doesn't really help us though, as we need a working implementation to prototype in a few weeks 😅

  • We can pass in the Entity data from FMTM (which gets it from the Central API) to the web form. Then override the nodes that reference features.CSV if needed for the XML to parse correctly. We could possibly even remove the reference to features.csv entirely for now, then manually add the required XML selecting the entity ID during submission.

  • Could you possibly push the work so far to a branch? Then I could also pick it up and try to help with the web form development from tomorrow onwards 🙏 I'm sure the solution is there somewhere in the web forms xform-engine package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants