The Challenge
The organization relied on an obsolete PHP 5 legacy system to manage its legal contracts. This created significant operational friction and technical debt that hindered business growth:
- Rigid Architecture: Workflows were hardcoded at the script level. Any change in the approval chain required a code deployment, making the system unresponsive to business policy changes.
- Manual "Ping-Pong" Processes: The lack of an integrated editor forced legal teams to download, manually edit, and re-upload documents. Coordination with stakeholders happened offline, leading to severe bottlenecks.
- Data Invisibility: Management lacked real-time insights into the legal workload, with no centralized dashboard to identify stalled contracts or monitor staff performance.
The Solution
I led the backend modernization of Digipactum, transforming it into a proactive CLM platform that automates the entire contract lifecycle—from initial drafting to final digital approval.
- Dynamic Workflow Orchestration: Instead of static code, I engineered a database-driven workflow engine. This allows for complex, multi-stage approval paths (Sales & Procurement) that can be reconfigured without downtime. I utilized Celery & Redis to handle asynchronous notifications (Email & MS Teams) and automated task assignments.
- Intelligent Document Templating & Online Editor: To eliminate manual drafting, I implemented a tagging-based templating system. The system automatically injects user data into pre-approved legal templates. I also integrated a web-based WYSIWYG editor to enable in-app document modification, removing the need for external file handling.
- Hybrid Data Strategy: I designed a dual-database architecture. Oracle 11g ensures transactional integrity for core contract data, while MongoDB provides the flexibility needed for unstructured AI-generated summaries and document metadata.
- Enterprise Service Bus Integration: Digipactum serves as a central hub, integrating with Alfresco for secure document storage and various internal services (MIS, Patricia, Grantha) to ensure a unified data ecosystem across the enterprise.
# Conceptual Implementation of the Dynamic Workflow State Machine
class WorkflowEngine:
def __init__(self, contract_id):
self.contract = Contract.objects.get(id=contract_id)
self.config = self._load_workflow_config()
def _load_workflow_config(self):
# Fetching dynamic steps from Database instead of hardcoded logic
return WorkflowMap.objects.filter(category=self.contract.type).order_by('step_order')
def move_to_next_step(self, actor_id, action):
"""
Handles transition logic, permission validation,
and triggers asynchronous notifications.
"""
current_step = self.contract.current_step
if self._validate_action(current_step, actor_id, action):
next_step = self._calculate_next_state(current_step, action)
# Execute background tasks for notifications and logs
trigger_notification.delay(next_step.assignee_group, self.contract.no_lo)
self.contract.status = next_step.status
self.contract.save()
# Example of Template Tagging Replacement Logic
def generate_contract_document(template_id, context_data):
template = ContractTemplate.objects.get(id=template_id)
# Replaces tags like {{client_name}} or {{contract_value}}
# with validated data from the UI
processed_content = template.engine.render(context_data)
return processed_content