vocdoni / interoperability

Private repository to manage the interoperability between protocol, API, SDK, UIs and documentation
1 stars 0 forks source link

Voting process as a decision tree #185

Closed jpaulet closed 1 week ago

jpaulet commented 1 month ago

We need to define and implement a system that allows for generating a voting process with different flows based on the voter's selected option. For example, if a voter selects "Option X," they should then be presented with another question defined in Process Y.

This use case will be generated by script, not through the UI. If possible, we will use metadata to store the information that the frontend will use to properly render the flow.

Proposed Flow:

Proposed Structure for Metadata:

jpaulet commented 1 month ago

Proposed structure:

Root process metadata:

"multiprocess" { 
        "root": "0x125352...",
    "subprocesses": [ 
            1: "0x12345", 
            2: "0x56789", 
            3: "0xabcde" 
    ], 
    "dependencies": [
                       0: "1:1,2:2,3:1"
               2: "1:3,2:3"            
    ] 

Subprocesses metadata:

"multiprocess" { 
        "root": "0x125352..."
}

The "root" will appear only in the subprocesses, and the "subprocesses & dependences" in the root process.

jpaulet commented 1 month ago

Caution: To generate the census, we should use the root for salting the census ("predict" the id of the root) and reuse the root census for the sub-processes.

elboletaire commented 2 weeks ago

There's a first version that takes basic conditions into consideration. The creation of the processes is managed by the new chained package in the projects repo, and the rendering and logic of these is currently only handled by the voting-page (most changes were done in this commit https://github.com/vocdoni/ui-voting-page/commit/e3a6bc5f66ba6d34642548309eedd334737c637a)

The current behavior is only taking into consideration the very first question, and can't handle multiple conditions. Adding multiple clauses should be assessed thoroughly, since it can worse the user and developer experience.

elboletaire commented 1 week ago

Closing as done for now. Consider reopening if there's anything else that should be tracked.

Not adding it to ui-scaffold since we haven't used it at all yet (meaning there are equal chances of removing it or implementing it into ui-scaffold).