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

elements-to-maps: separate function to construct a plan #1797

Open
michaelhkay opened this issue Feb 12, 2025 · 0 comments
Open

elements-to-maps: separate function to construct a plan #1797

michaelhkay opened this issue Feb 12, 2025 · 0 comments
Labels
Enhancement A change or improvement to an existing feature PR Pending A PR has been raised to resolve this issue XQFO An issue related to Functions and Operators

Comments

@michaelhkay
Copy link
Contributor

michaelhkay commented Feb 12, 2025

I propose separating out the uniform=true option of elements-to-maps() into a separate function. This function analyses the data and produces a conversion plan, which can be supplied to the "layouts" option (perhaps renamed) of the main function.

The benefits are:

  • The plan can be tweaked after it is created by manual adjustment, for example if the user wants to use "empty-plus" layout wherever the system's choice would be "empty", or to take account of anticipated future changes in the structure.
  • The plan can be used to process documents that did not exist at the time it was created, thus ensuring that future documents are all converted in the same way, and avoiding the overhead of rebuilding the plan each time.
  • The plan can be created from a small sample of the documents to be converted.
  • The plan can be created from a large collection of documents including documents that don't need to be converted but which may contain structural elements that are not revealed by the documents that need converting now.
  • The user can examine the plan to see what it is doing, which is useful for diagnostics.

We should define the format of the plan (a map from element names to layouts) so that it can conveniently be serialized as a JSON document.

@ChristianGruen ChristianGruen added XQFO An issue related to Functions and Operators Enhancement A change or improvement to an existing feature labels Feb 22, 2025
@michaelhkay michaelhkay added the PR Pending A PR has been raised to resolve this issue label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A change or improvement to an existing feature PR Pending A PR has been raised to resolve this issue XQFO An issue related to Functions and Operators
Projects
None yet
Development

No branches or pull requests

2 participants