{"id":13367565,"url":"https://github.com/faxad/ActivFlow","last_synced_at":"2025-03-12T20:30:47.832Z","repository":{"id":6123867,"uuid":"54384462","full_name":"faxad/activflow","owner":"faxad","description":"Generic, light-weight \u0026 extensible Workflow Engine for agile automation of Business Processes | Django, Python","archived":false,"fork":false,"pushed_at":"2023-02-15T18:52:37.000Z","size":949,"stargazers_count":564,"open_issues_count":3,"forks_count":94,"subscribers_count":56,"default_branch":"master","last_synced_at":"2024-11-13T07:36:03.069Z","etag":null,"topics":["bpm","django","python","workflow"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faxad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-21T11:49:19.000Z","updated_at":"2024-11-12T01:08:06.000Z","dependencies_parsed_at":"2024-01-15T16:52:29.710Z","dependency_job_id":null,"html_url":"https://github.com/faxad/activflow","commit_stats":{"total_commits":125,"total_committers":6,"mean_commits":"20.833333333333332","dds":"0.30400000000000005","last_synced_commit":"f861598de0067a42bbb52ae3401c08dc88451653"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faxad%2Factivflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faxad%2Factivflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faxad%2Factivflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faxad%2Factivflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faxad","download_url":"https://codeload.github.com/faxad/activflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243290605,"owners_count":20267749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bpm","django","python","workflow"],"created_at":"2024-07-30T00:01:53.527Z","updated_at":"2025-03-12T20:30:47.351Z","avatar_url":"https://github.com/faxad.png","language":"JavaScript","readme":"# activflow\n[![Build Status](https://travis-ci.org/faxad/ActivFlow.svg?branch=master)](https://travis-ci.org/faxad/ActivFlow)\n[![Coverage Status](https://coveralls.io/repos/github/faxad/ActivFlow/badge.svg?branch=master)](https://coveralls.io/github/faxad/ActivFlow?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/f1cb2c6766cb4539ac1c3d4057996047)](https://www.codacy.com/app/fawadhq/ActivFlow)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffaxad%2FActivFlow.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffaxad%2FActivFlow?ref=badge_shield)\n\n### Introduction\n**ActivFlow** is a generic, light-weight and extensible workflow engine for agile development and automation of complex Business Process operations.\n\nDevelopers can emphasize towards mapping the Business Process model as ActivFlow workflow without having to worry about implementing the core workflow processing logic. The generic implementation of the workflow engine manages the automation of the Business Processes from start to finish in accordance with the defined flow.\n\nWhat is an ActivFlow workflow?\n- Business Process flow mapped as ActivFlow configuration\n- Definition of data to be captured for each activity (state)\n- Business Roles mapped to workflow activities\n- Rules applied on transitions between activities\n\n![alt tag](https://user-images.githubusercontent.com/6130967/28086399-5625a4e8-6698-11e7-8a00-ccf3180d70be.png)\n\n### Technology Stack\n- Python 3.6+\n- Django 3.x\n- Bootstrap 3.x\n\n### Usage \u0026 Configuration\n\n#### Step 1: Workflow App Registration\n- A Business Process must be represented in terms of a Django app\n- All apps must be registered to **WORKFLOW_APPS** under **core/constants**\n```python\nWORKFLOW_APPS = ['leave_request']\n```\n\n#### Step 2: Activity Configuration\n- Activities (States/Nodes) are represented as Django models\n- Activity must inherit from **AbstractInitialActivity**/**AbstractActivity** respectively\n- Custom validation logic must be defined under **clean()** on the activity model\n- Custom field specific validation should go under **app/validator** and applied to the field as **validators** attribute\n```python\nfrom activflow.core.models import AbstractActivity, AbstractInitialActivity, AbstractEntity\nfrom activflow.leave_request.validators import validate_initial_cap\n\nclass SampleRequest(AbstractInitialActivity):\n    \"\"\"Sample leave request details\"\"\"\n    employee_name = CharField(\"Employee\", max_length=200, validators=[validate_initial_cap])\n    from = DateField(\"From Date\")\n    to = DateField(\"To Date\")\n    reason = TextField(\"Purpose of Leave\", blank=True)\n\n    def clean(self):\n        \"\"\"Custom validation logic should go here\"\"\"\n        pass\n\nclass Itinerary(AbstractEntity):\n    \"\"\"Itinerary details\"\"\"\n    request = ForeignKey(RequestInitiation, related_name=\"itineraries\")\n    destination = CharField(\"Destination\", max_length=200)\n    date = DateField(\"Visit Date\")\n\n    def clean(self):\n        \"\"\"Custom validation logic should go here\"\"\"\n        pass\n\nclass ManagementReview(AbstractActivity):\n    \"\"\"Management review/approval\"\"\"\n    approval_status = CharField(verbose_name=\"Status\", max_length=3, choices=(\n        ('APP', 'Approved'), ('REJ', 'Rejected')))\n    remarks = TextField(\"Remarks\")\n\n    def clean(self):\n        \"\"\"Custom validation logic should go here\"\"\"\n        pass\n\n```\n#### Step 3: Flow Definition\n- A flow is represented by collection of Activities (States/Nodes) connected using Transitions (Edges)\n- Rules are applied on transitions to allow routing between activities, provided, the condition satisfies\n- Business Process flow must be defined as **FLOW** under **app/flow**\n- As a default behavior, the Role maps OTO with django Group (developers, feel free to customize)\n```python\nfrom activflow.leave_request.models import SampleRequest, ManagementReview\nfrom activflow.leave_request.rules import validate_request\n\nFLOW = {\n    'sample_leave_request': {\n        'name': 'Sample Request',\n        'model': SampleRequest,\n        'role': 'Submitter',\n        'transitions': {\n            'management_review': validate_request,\n        }\n    },\n    'management_review': {\n        'name': 'Management's Review',\n        'model': ManagementReview,\n        'role': 'Approver',\n        'transitions': None\n    }\n}\n\nINITIAL = 'sample_leave_request'\n```\n#### Step 4: Business Rules\n- Transition rules and conditions must be defined under **app/rules**\n```python\ndef validate_request(self):\n    return self.reason == 'Emergency'\n```\n\n#### Step 5: Configure Field Visibility \u0026 Custom Forms (Optional)\n- Include **config.py** in the workflow app and define **ACTIVITY_CONFIG** as Nested Ordered Dictionary to have more control over what gets displayed on the UI.\n- Define for each activity model, the visibility of fields, for display on templates and forms \n    - **create:** field will appear on activity create/initiate form\n    - **update:** field will be available for activity update/revise operation\n    - **display:** available for display in activity detail view\n```python\nfrom collections import OrderedDict\n\n\nACTIVITY_CONFIG = OrderedDict([\n    ('Foo', OrderedDict([\n        ('Fields', OrderedDict([\n            ('subject', ['create', 'update', 'display']),\n            ('employee_name', ['create', 'update', 'display']),\n            ('from', ['create', 'update', 'display']),\n            ('to', ['create', 'update', 'display']),\n            ('reason', ['create', 'update', 'display']),\n            ('creation_date', ['display']),\n            ('last_updated', ['display'])\n        ])),\n        ('Relations', OrderedDict([\n            ('Itinerary', OrderedDict([\n                ('destination', ['create', 'update', 'display']),\n                ('date', ['create', 'update', 'display'])\n            ])),\n            ...\n        ]))\n    ])),\n    ...\n])\n\n# register fields that need WYSIWYG editor\n\nWYSIWYG_CONFIG = {\n    'RequestInitiation': ['reason']\n}\n\n# register custom forms\n\nFORM_CONFIG = {\n    'RequestInitiation': 'CustomRequestForm'\n}\n```\n\n#### Step 6: Access/Permission Configuration (Optional)\nThe core logic to restrict access is defined as **AccessDeniedMixin** under **core/mixins** which developers can customize depending on the requirements\n\n#### Demo Instructions\nExecute the below command to configure ActivFlow for demo purpose\n```\npython demo.py\n```\nAlternatively, launch the docker containers by simply running\n```\ndocker-compose up\n```\n**Submitter:** john.doe/12345, **Reviewer:** jane.smith/12345\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffaxad%2FActivFlow.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffaxad%2FActivFlow?ref=badge_large)","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaxad%2FActivFlow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaxad%2FActivFlow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaxad%2FActivFlow/lists"}