I need a convenient way for an end user to input d...
# present-company
j
I need a convenient way for an end user to input data into arbitrary graphs or tree data structures. Not an interface tied to a single data structure, but an interface generator that generates an interface on the basis of a data structure. I have looked high and low, and every open source tool I find that is for generating interfaces does not allow for an abstraction of the specific data structure. Chatbot platforms, web interview platforms, Content Management Systems, all the same. Why is this so rare?
👍 1
g
is there a schema? there is https://jsonforms.io/. it might have reasonable defaults arbitrary data.
a
That sounds, uh, really hard. Actually I can't even imagine what it would look like. I mean, it's pretty easy to relate a tree-shaped data structure to a tree-shaped form, but once you have a graph a ton of degrees of freedom open up; I think you would have to generate a whole interaction flow, and I don't know how well any one design would generalize. Even if those concerns are illusory (they might well be, I haven't thought much about this), they probably play a role in damping new projects in the area relative to more tractable form generators.
t
j
@George that requires you to specify the UI schema, which is the thing I'm trying to avoid.neesing to do manually, because I need the one solution to work for any schema.
@Tom Larkworthy that's closer, but I don't see a way to implement object relationships, or lists of arbitrary length?
t
Maybe its own demo page is clearer, the example has a nested object and a list https://json-editor.github.io/json-editor/. The backing schema language is JSON schema, which definately supports those concepts.
j
@Andrew F not that hard. You just need a way to create and remove objects, apply them to categories, create and remove relationships between objects and a value that is either a scalar data type or another object. It's a small number of procedures. I've done it once with trees in Docassemble, currently doing it again for graphs in RASA.
t
yeah I guess cross references have no real support as JSON schema is for describing JSON, and JSON has no reference type. So you can use JSON schema to describe your own ad hoc reference schema e.g. a string with a certain pattern for instance, but it can't check that reference actually points to something valid within the document, and let alone have any UI support for that. But the JSON-editor does have custom hooks for custom programmatic validation and UI extension points so maybe you could force something in. You can bound lists with "minItems" and "maxItems" so that is out-of-the-box supported I would imagine.
j
@Tom Larkworthy I think you're right.
a
That's one perspective on "arbitrary graphs and tree structures", but not the only one. Even just mentioning "categories" makes it pretty specific, considering half of literally everything can be modeled as "arbitrary graphs", or even "arbitrary directed graphs" (in the mathematical sense, which doesn't natively include "categories" at all). I mean, given some visual representation of a generalized mathematical graph (force layout maybe), you could build a generic editor for it, but for most applications that actually use graphs it's likely to be inferior to a purpose built UI. Is this even the "abstraction of the specific data structure" you were asking about? I'm really unsure at this point if I understand your question at all.
c
I think your best bet is going to be solving the nested/recursion part yourself, then using something like https://www.autogui.org/ or https://github.com/chriskiehl/Gooey for the general mapping of simple datastructures to GUI elements. If you could provide slightly more detailed examples then people are more likely to recall specific tools/libraries that might help.