Handling XLSForm --> XForm conversion in memory


The current implementation of pyxform requires an on-disk XLSForm to be converted to an on-disk XForm.

This is useful for running pyxform via command line, but if the code is used within a script or other tool, it may be useful to handle this entirely in memory.


For example if pyxform is used within a web API to convert a user-provided XLSForm to an XForm, then continue with further processes.

The XLSForm is sent frontend --> backend API and received as an in memory object.

The code would have the write this to a temp file, convert the file, then output to a temp XForm file.

Possible Solution

Alternatively, the in-memory XLSForm could be converted to an in-memory XForm directly, saving the disk usage for two reasons:

  • Reduce file system clutter and issues if the temp files are not deleted (filling up the space).
  • Performance improvement as no on-disk IO is required and everything is handled in memory.

This approach would possibly provide these benefits to pyxform-http maintained by ODK.


I made a PR for this to XLSForm/pyxform, but thought it would be best to gauge interest from the community here.

At HOT, we have a use case that is very similar to pyxform-http: a web API that received a user provided XLSForm and needs to generate an XForm.

Does any one else have a similar workflow, requiring the XLSForm --> XForm conversion to be handled in memory instead of disk files?

@Ivangayton @Niraj_Adhikari

1 Like