wiki:BluePrint/WorkflowSupport

Version 17 (modified by hardik juneja, 11 years ago) ( diff )

--

BluePrint: WORKFLOW SUPPORT

Introduction

The Blueprint outlines the improvement of Workflow Support for Sahana Eden i.e to develop a engine that can generate workflows for user of Sahana Eden.A workflow consists of a sequence of connected steps which are typically to be accomplished in a certain order. To accomplish this we will need a Workflow Engine,which manages workflow configuration, tracks and restores status of user tasks,provides the "next" options according to pre-defined conditions, and invokes the respective methods.

Target Problem

Currently in Eden we realize if a user has successfully completed a CRUD action, he's forwarded to the next page.

The main problem with that is that the "next page" is hardcoded and doesn't adapt to the actual user-task - it connects always the same steps in always the same way - unconditionally.

So to overcome such problem we need a workflow Engine that can connects the steps, defined in the configuration and then perform different task accordingly.

Stakeholders

  • End Users - Users of Sahana Eden will be benefited the most with Workflow Support as it help them to complete task quickly.
  • Developers - With the help of workflow engine, developers of sahana eden can easily create a workflow for different modules.

User Stories

  • As an end user, I want a workflow to guide me and help me through different resources available in Sahana Eden.
    • To take a Workflow User will click on the Workflow Button
    • Then he will first step and as he will complete his task.
    • He will be then redirected to next step.
    • The workflow will end when he complete all the steps.
    • The User can end the workflow at any time
    • And may be will have a option to save the progress also

  • As a developer, I want a Workflow engine that can easily create Workflow for me by accepting some simple data.
    • Developer will be able to easily define the configuration of the Workflow Engine.
    • Which will be converted into Workflows by the Workflow Engine.

Requirements

Functional

  • Workflow should easy to configure.
  • Workflow thus generated should have the ability to adapt changes as the configuration defined to Engine changes..
  • Workflows should provide full access control to the user, they can go back, skip steps and quit at any point.
  • Workflow should support decision(branches) Ex. they will ask user to choose from option A or option B to proceed further.
  • Workflow should track the audit trails i.e keeping the record of the running processes as they unfold, so that users can come back to the same point where they left off.
  • Allow the user to choose the route, e.g. from a menu of user tasks
  • These workflow should be easily available and accessible to the user after successful login.

Design

Data Model

Holds the workflow current status, data , user id etc. The data model can be found in modules/s3db/workflow.py.
Table name--> workflow_status.

Field NamePurposeDatatype/table
User_id The user id of the user who started the workflowFK referenced from auth.user_id (integer)
Status The current status of the workflow string
DataThe workflow data(these can be json serialised objects)json
NameThe workflow namestring
s3.meta_fields() metadata
uuid (In s3.meta_fields())unique id to identify each workflow string

Flow Diagram

Developer Perspective

User Perspective

Wireframes

This is what user will see during a workflow.
All the action button here will will contain the workflow id (wf_id).
A bar above will track the progress of the user.
There will be a default Exit action button on each page which will quite the workflow.


If user navigates away, he will be shown a return action button and cancel action button.


Further in future we will use the workflow data to show different menus in the workflow nodes.
Here, this menu show the selected items from previous nodes.


Workflows

Configure Workflows

  • Developers will have to configure the workflows
  • All configuration will be placed in private/template/<module-name>/default
  • The configuration pattern is going to be very easy to define a configuration pattern first one need to import S3WorkflowNode class
  • Each node will be defined something like N("status name").handle(next_status = "next status name", controller = "org", function = "organization", args = "create")
  • Here .handle(next_status = "status name",args = "create", controller = "org", function = "organization") will contain the action that will update the current node's status to the next sataus i.e only after clicking on this particular action user will be able to achieve the next node.
  • All option that handle can take for now are -
    • status - current status of the node
    • controller - controller
    • function - function
    • args - node action args
    • http - http method for the action
    • next_status - next status that the node should achieve
  • And full workflow can be defined like
    class S3WorkflowConfig(object):
    
        def orgmanagement(self):
            N = S3Workflow
            Exit = S3WorkflowExitNode
            s3db = current.s3db
            
            return N("new").handle(controller = "org",
                                   function = "organisation",
                                   args = "create",
                                   next_status = "add organisation get",
                                   http = "GET") & \
                   N("add organisation get").handle(controller = "org",
                                                    function = "organisation",
                                                    args = "create",
                                                    next_status = "add organisation post",
                                                    http = "POST") & \
                   N("add organisation post").handle(controller = "org",
                                                     function = "office",
                                                     args = [1,"update"],
                                                     next_status = "add office")\
                                             .handle(controller = "org",
                                                     function = "facility",
                                                     next_status = "add facility",
                                                     postp = postp) & \
                   ( N("add office").handle(controller = "hrm",
                                            function = "staff",
                                            args = "create",
                                            next_status = "add staff") | \
                     N("add facility").handle(controller = "hrm",
                                              function = "staff",
                                              args = "create",
                                              next_status = "add staff") ) & \
                   Exit()
    
    
    
    
                                                             
    
  • Here ‘&’ depict that the next node is a necessary or required node and ‘|’ depict that next node is a optional or a choice node.
  • Exit(..) tells the workflow engine to end workflow here
  • Developer will be free to configure prep and postp for each node.
  • this will be added something like this -
    N().handle(status = "create incident", prep, postp)
    

Technologies

Implementation

Currently the project is under development and we have set following Goals

Goals -

  • Configuration of event handlers (nodes) in a workflow
  • Storing and retrieving of workflow instances
  • Mapping of instance status + current event to a certain node
  • Interface between workflow engine (=event manager) and workflow nodes (=event handler)
  • Interface between nodes and "actions" (=S3Methods?)
  • Workflow widgets (=widgets for users to perform workflow actions), and how to put them into a page

For more detail please follow this page - Workflow Support(Gsoc 2013 )

Attachments (5)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.