How would you design a tool to specify deeply nested forms, basically a complex decision tree, eg for medical diagnosis or complex tax stuff etc, where future form elements can dependent on a previously specified one, but statically ie chosen from few option not generated via a function so that all options and branches are known without executing code. The form specification should just be declarative, data. What data structure would you use to represent that form (I think it would basically be a DAG)? What language would you write it in? How would you generate a graphical representation (eg converting to .dot)? How would you generate a fillable form from it?

  • MagicShel@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    I don’t know how many answers you are going to get, but I suspect not many. You’re asking someone to architect a solution without any requirements. Even if that weren’t a massive ask, it’s pretty much impossible because you haven’t provided any information.

    First half: I’d write a guided wizard with a state machine.

    Data structure? You mean schema? Depends on what the data is, how it’s related, and how it will be used. The answer could be anything from 30 SQL tables to a big blob of JSON.

    Best language? The one(s) you know.

    Graphical representation? I’ve been doing this for 25 years and never used a .dot. Is that a Word template? I can tell you I definitely wouldn’t use that but maybe someone else would tell you different. I’ve only had to produce a word document a couple of times and I used Java & POI to do it (C# could probably do it easier I’d hazard a guess) but if that’s not a requirement I’d use a browser interface.

    Generating a fillable form? Like I say I’d make a wizard using some kind of web framework.

    Good luck. Hopefully someone else understands your needs better than I do and can give you a better answer.