this post was submitted on 20 Jul 2023
8 points (100.0% liked)

Programming

13373 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

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?

top 8 comments
sorted by: hot top controversial new old
[–] MagicShel 5 points 1 year ago (1 children)

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.

[–] [email protected] 2 points 1 year ago (1 children)
[–] MagicShel 1 points 1 year ago (1 children)

Thank you. Turns out I have seen that before. I played with Graphviz for a couple of months. It was fun but ultimately fruitless for my needs at the time. Thank you for reminding me.

I don't have the vision of how that would apply to this project. Perhaps to visualize the current workflow, but it feels like it would be easier to do it by hand unless it's constantly changing.

[–] [email protected] 2 points 1 year ago

Yeah I had a similar feel.

[–] [email protected] 4 points 1 year ago

Is this a homework assignment?

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Your question is a bit vague but it looks to me that what you want is some sort of expert system of inference engine.

There might be some open source solutions, and there's always the GNU Prolog language that might suit your needs.

I suspect that you won't get a graphviz structure out of it though.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

You're describing what Oracle Intelligent Advisor (OIA) tries to deliver with their interviews. After you write your code, an interview can be automatically generated which collects data and infers which questions need to be asked based on previous answers. For data representation, it is unfortunately either captured in Microsoft Word or within their interview screens as logic, which does not meet your graphical representation needs. It seemed to be close enough that I thought it worth mentioning. It's original use case was for tax purposes but I use it professionally to determine eligibility to public assistance programs.

Similar to @steph's answer ErgoAI is a prolog derivative with a syntax rather similar to .dot (from what I gather). This tool would capture the data in a format you like, but does not generate a fillable form for you, but I believe it could be made to do so in a manner similar to OIA above.

[–] [email protected] 1 points 1 year ago

I would use the language I know the best which provide a library that handles .dot files (Graphviz?) and I would check if the library has an internal data structure for the graphs.

I guess it would be adjacency matrice or adjacency lists.

load more comments
view more: next ›