tech-hub-skills 1.2.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/.claude/README.md +291 -0
  2. package/.claude/bin/cli.js +266 -0
  3. package/.claude/package.json +46 -0
  4. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_ab_tester.py +356 -0
  5. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_template_manager.py +274 -0
  6. package/.claude/roles/ai-engineer/skills/01-prompt-engineering/token_cost_estimator.py +324 -0
  7. package/.claude/roles/ai-engineer/skills/02-rag-pipeline/document_chunker.py +336 -0
  8. package/.claude/roles/ai-engineer/skills/02-rag-pipeline/rag_pipeline.sql +213 -0
  9. package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/bronze_ingestion.py +337 -0
  10. package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/medallion_queries.sql +300 -0
  11. package/.claude/roles/data-scientist/skills/01-eda-automation/eda_generator.py +446 -0
  12. package/.claude/roles/system-design/skills/08-process-automation/ai_prompt_generator.py +744 -0
  13. package/.claude/roles/system-design/skills/08-process-automation/automation_recommender.py +688 -0
  14. package/.claude/roles/system-design/skills/08-process-automation/plan_generator.py +679 -0
  15. package/.claude/roles/system-design/skills/08-process-automation/process_analyzer.py +528 -0
  16. package/.claude/roles/system-design/skills/08-process-automation/process_parser.py +684 -0
  17. package/.claude/roles/system-design/skills/08-process-automation/role_matcher.py +615 -0
  18. package/.claude/skills/README.md +336 -0
  19. package/.claude/skills/ai-engineer.md +104 -0
  20. package/.claude/skills/aws.md +143 -0
  21. package/.claude/skills/azure.md +149 -0
  22. package/.claude/skills/backend-developer.md +108 -0
  23. package/.claude/skills/code-review.md +399 -0
  24. package/.claude/skills/compliance-automation.md +747 -0
  25. package/.claude/skills/compliance-officer.md +108 -0
  26. package/.claude/skills/data-engineer.md +113 -0
  27. package/.claude/skills/data-governance.md +102 -0
  28. package/.claude/skills/data-scientist.md +123 -0
  29. package/.claude/skills/database-admin.md +109 -0
  30. package/.claude/skills/devops.md +160 -0
  31. package/.claude/skills/docker.md +160 -0
  32. package/.claude/skills/enterprise-dashboard.md +613 -0
  33. package/.claude/skills/finops.md +184 -0
  34. package/.claude/skills/frontend-developer.md +108 -0
  35. package/.claude/skills/gcp.md +143 -0
  36. package/.claude/skills/ml-engineer.md +115 -0
  37. package/.claude/skills/mlops.md +187 -0
  38. package/.claude/skills/network-engineer.md +109 -0
  39. package/.claude/skills/optimization-advisor.md +329 -0
  40. package/.claude/skills/orchestrator.md +623 -0
  41. package/.claude/skills/platform-engineer.md +102 -0
  42. package/.claude/skills/process-automation.md +226 -0
  43. package/.claude/skills/process-changelog.md +184 -0
  44. package/.claude/skills/process-documentation.md +484 -0
  45. package/.claude/skills/process-kanban.md +324 -0
  46. package/.claude/skills/process-versioning.md +214 -0
  47. package/.claude/skills/product-designer.md +104 -0
  48. package/.claude/skills/project-starter.md +443 -0
  49. package/.claude/skills/qa-engineer.md +109 -0
  50. package/.claude/skills/security-architect.md +135 -0
  51. package/.claude/skills/sre.md +109 -0
  52. package/.claude/skills/system-design.md +126 -0
  53. package/.claude/skills/technical-writer.md +101 -0
  54. package/.gitattributes +2 -0
  55. package/GITHUB_COPILOT.md +106 -0
  56. package/README.md +117 -224
  57. package/package.json +4 -42
  58. package/bin/cli.js +0 -241
  59. /package/{LICENSE → .claude/LICENSE} +0 -0
  60. /package/{bin → .claude/bin}/copilot.js +0 -0
  61. /package/{bin → .claude/bin}/postinstall.js +0 -0
  62. /package/{tech_hub_skills/skills → .claude/commands}/README.md +0 -0
  63. /package/{tech_hub_skills/skills → .claude/commands}/ai-engineer.md +0 -0
  64. /package/{tech_hub_skills/skills → .claude/commands}/aws.md +0 -0
  65. /package/{tech_hub_skills/skills → .claude/commands}/azure.md +0 -0
  66. /package/{tech_hub_skills/skills → .claude/commands}/backend-developer.md +0 -0
  67. /package/{tech_hub_skills/skills → .claude/commands}/code-review.md +0 -0
  68. /package/{tech_hub_skills/skills → .claude/commands}/compliance-automation.md +0 -0
  69. /package/{tech_hub_skills/skills → .claude/commands}/compliance-officer.md +0 -0
  70. /package/{tech_hub_skills/skills → .claude/commands}/data-engineer.md +0 -0
  71. /package/{tech_hub_skills/skills → .claude/commands}/data-governance.md +0 -0
  72. /package/{tech_hub_skills/skills → .claude/commands}/data-scientist.md +0 -0
  73. /package/{tech_hub_skills/skills → .claude/commands}/database-admin.md +0 -0
  74. /package/{tech_hub_skills/skills → .claude/commands}/devops.md +0 -0
  75. /package/{tech_hub_skills/skills → .claude/commands}/docker.md +0 -0
  76. /package/{tech_hub_skills/skills → .claude/commands}/enterprise-dashboard.md +0 -0
  77. /package/{tech_hub_skills/skills → .claude/commands}/finops.md +0 -0
  78. /package/{tech_hub_skills/skills → .claude/commands}/frontend-developer.md +0 -0
  79. /package/{tech_hub_skills/skills → .claude/commands}/gcp.md +0 -0
  80. /package/{tech_hub_skills/skills → .claude/commands}/ml-engineer.md +0 -0
  81. /package/{tech_hub_skills/skills → .claude/commands}/mlops.md +0 -0
  82. /package/{tech_hub_skills/skills → .claude/commands}/network-engineer.md +0 -0
  83. /package/{tech_hub_skills/skills → .claude/commands}/optimization-advisor.md +0 -0
  84. /package/{tech_hub_skills/skills → .claude/commands}/orchestrator.md +0 -0
  85. /package/{tech_hub_skills/skills → .claude/commands}/platform-engineer.md +0 -0
  86. /package/{tech_hub_skills/skills → .claude/commands}/process-automation.md +0 -0
  87. /package/{tech_hub_skills/skills → .claude/commands}/process-changelog.md +0 -0
  88. /package/{tech_hub_skills/skills → .claude/commands}/process-documentation.md +0 -0
  89. /package/{tech_hub_skills/skills → .claude/commands}/process-kanban.md +0 -0
  90. /package/{tech_hub_skills/skills → .claude/commands}/process-versioning.md +0 -0
  91. /package/{tech_hub_skills/skills → .claude/commands}/product-designer.md +0 -0
  92. /package/{tech_hub_skills/skills → .claude/commands}/project-starter.md +0 -0
  93. /package/{tech_hub_skills/skills → .claude/commands}/qa-engineer.md +0 -0
  94. /package/{tech_hub_skills/skills → .claude/commands}/security-architect.md +0 -0
  95. /package/{tech_hub_skills/skills → .claude/commands}/sre.md +0 -0
  96. /package/{tech_hub_skills/skills → .claude/commands}/system-design.md +0 -0
  97. /package/{tech_hub_skills/skills → .claude/commands}/technical-writer.md +0 -0
  98. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/01-prompt-engineering/README.md +0 -0
  99. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/02-rag-pipeline/README.md +0 -0
  100. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/03-agent-orchestration/README.md +0 -0
  101. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/04-llm-guardrails/README.md +0 -0
  102. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/05-vector-embeddings/README.md +0 -0
  103. /package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/06-llm-evaluation/README.md +0 -0
  104. /package/{tech_hub_skills → .claude}/roles/azure/skills/01-infrastructure-fundamentals/README.md +0 -0
  105. /package/{tech_hub_skills → .claude}/roles/azure/skills/02-data-factory/README.md +0 -0
  106. /package/{tech_hub_skills → .claude}/roles/azure/skills/03-synapse-analytics/README.md +0 -0
  107. /package/{tech_hub_skills → .claude}/roles/azure/skills/04-databricks/README.md +0 -0
  108. /package/{tech_hub_skills → .claude}/roles/azure/skills/05-functions/README.md +0 -0
  109. /package/{tech_hub_skills → .claude}/roles/azure/skills/06-kubernetes-service/README.md +0 -0
  110. /package/{tech_hub_skills → .claude}/roles/azure/skills/07-openai-service/README.md +0 -0
  111. /package/{tech_hub_skills → .claude}/roles/azure/skills/08-machine-learning/README.md +0 -0
  112. /package/{tech_hub_skills → .claude}/roles/azure/skills/09-storage-adls/README.md +0 -0
  113. /package/{tech_hub_skills → .claude}/roles/azure/skills/10-networking/README.md +0 -0
  114. /package/{tech_hub_skills → .claude}/roles/azure/skills/11-sql-cosmos/README.md +0 -0
  115. /package/{tech_hub_skills → .claude}/roles/azure/skills/12-event-hubs/README.md +0 -0
  116. /package/{tech_hub_skills → .claude}/roles/code-review/skills/01-automated-code-review/README.md +0 -0
  117. /package/{tech_hub_skills → .claude}/roles/code-review/skills/02-pr-review-workflow/README.md +0 -0
  118. /package/{tech_hub_skills → .claude}/roles/code-review/skills/03-code-quality-gates/README.md +0 -0
  119. /package/{tech_hub_skills → .claude}/roles/code-review/skills/04-reviewer-assignment/README.md +0 -0
  120. /package/{tech_hub_skills → .claude}/roles/code-review/skills/05-review-analytics/README.md +0 -0
  121. /package/{tech_hub_skills → .claude}/roles/data-engineer/skills/01-lakehouse-architecture/README.md +0 -0
  122. /package/{tech_hub_skills → .claude}/roles/data-engineer/skills/02-etl-pipeline/README.md +0 -0
  123. /package/{tech_hub_skills → .claude}/roles/data-engineer/skills/03-data-quality/README.md +0 -0
  124. /package/{tech_hub_skills → .claude}/roles/data-engineer/skills/04-streaming-pipelines/README.md +0 -0
  125. /package/{tech_hub_skills → .claude}/roles/data-engineer/skills/05-performance-optimization/README.md +0 -0
  126. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/01-data-catalog/README.md +0 -0
  127. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/02-data-lineage/README.md +0 -0
  128. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/03-data-quality-framework/README.md +0 -0
  129. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/04-access-control/README.md +0 -0
  130. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/05-master-data-management/README.md +0 -0
  131. /package/{tech_hub_skills → .claude}/roles/data-governance/skills/06-compliance-privacy/README.md +0 -0
  132. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/01-eda-automation/README.md +0 -0
  133. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/02-statistical-modeling/README.md +0 -0
  134. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/03-feature-engineering/README.md +0 -0
  135. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/04-predictive-modeling/README.md +0 -0
  136. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/05-customer-analytics/README.md +0 -0
  137. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/06-campaign-analysis/README.md +0 -0
  138. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/07-experimentation/README.md +0 -0
  139. /package/{tech_hub_skills → .claude}/roles/data-scientist/skills/08-data-visualization/README.md +0 -0
  140. /package/{tech_hub_skills → .claude}/roles/devops/skills/01-cicd-pipeline/README.md +0 -0
  141. /package/{tech_hub_skills → .claude}/roles/devops/skills/02-container-orchestration/README.md +0 -0
  142. /package/{tech_hub_skills → .claude}/roles/devops/skills/03-infrastructure-as-code/README.md +0 -0
  143. /package/{tech_hub_skills → .claude}/roles/devops/skills/04-gitops/README.md +0 -0
  144. /package/{tech_hub_skills → .claude}/roles/devops/skills/05-environment-management/README.md +0 -0
  145. /package/{tech_hub_skills → .claude}/roles/devops/skills/06-automated-testing/README.md +0 -0
  146. /package/{tech_hub_skills → .claude}/roles/devops/skills/07-release-management/README.md +0 -0
  147. /package/{tech_hub_skills → .claude}/roles/devops/skills/08-monitoring-alerting/README.md +0 -0
  148. /package/{tech_hub_skills → .claude}/roles/devops/skills/09-devsecops/README.md +0 -0
  149. /package/{tech_hub_skills → .claude}/roles/finops/skills/01-cost-visibility/README.md +0 -0
  150. /package/{tech_hub_skills → .claude}/roles/finops/skills/02-resource-tagging/README.md +0 -0
  151. /package/{tech_hub_skills → .claude}/roles/finops/skills/03-budget-management/README.md +0 -0
  152. /package/{tech_hub_skills → .claude}/roles/finops/skills/04-reserved-instances/README.md +0 -0
  153. /package/{tech_hub_skills → .claude}/roles/finops/skills/05-spot-optimization/README.md +0 -0
  154. /package/{tech_hub_skills → .claude}/roles/finops/skills/06-storage-tiering/README.md +0 -0
  155. /package/{tech_hub_skills → .claude}/roles/finops/skills/07-compute-rightsizing/README.md +0 -0
  156. /package/{tech_hub_skills → .claude}/roles/finops/skills/08-chargeback/README.md +0 -0
  157. /package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/01-mlops-pipeline/README.md +0 -0
  158. /package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/02-feature-engineering/README.md +0 -0
  159. /package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/03-model-training/README.md +0 -0
  160. /package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/04-model-serving/README.md +0 -0
  161. /package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/05-model-monitoring/README.md +0 -0
  162. /package/{tech_hub_skills → .claude}/roles/mlops/skills/01-ml-pipeline-orchestration/README.md +0 -0
  163. /package/{tech_hub_skills → .claude}/roles/mlops/skills/02-experiment-tracking/README.md +0 -0
  164. /package/{tech_hub_skills → .claude}/roles/mlops/skills/03-model-registry/README.md +0 -0
  165. /package/{tech_hub_skills → .claude}/roles/mlops/skills/04-feature-store/README.md +0 -0
  166. /package/{tech_hub_skills → .claude}/roles/mlops/skills/05-model-deployment/README.md +0 -0
  167. /package/{tech_hub_skills → .claude}/roles/mlops/skills/06-model-observability/README.md +0 -0
  168. /package/{tech_hub_skills → .claude}/roles/mlops/skills/07-data-versioning/README.md +0 -0
  169. /package/{tech_hub_skills → .claude}/roles/mlops/skills/08-ab-testing/README.md +0 -0
  170. /package/{tech_hub_skills → .claude}/roles/mlops/skills/09-automated-retraining/README.md +0 -0
  171. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/01-internal-developer-platform/README.md +0 -0
  172. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/02-self-service-infrastructure/README.md +0 -0
  173. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/03-slo-sli-management/README.md +0 -0
  174. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/04-developer-experience/README.md +0 -0
  175. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/05-incident-management/README.md +0 -0
  176. /package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/06-capacity-management/README.md +0 -0
  177. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/01-requirements-discovery/README.md +0 -0
  178. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/02-user-research/README.md +0 -0
  179. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/03-brainstorming-ideation/README.md +0 -0
  180. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/04-ux-design/README.md +0 -0
  181. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/05-product-market-fit/README.md +0 -0
  182. /package/{tech_hub_skills → .claude}/roles/product-designer/skills/06-stakeholder-management/README.md +0 -0
  183. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/01-pii-detection/README.md +0 -0
  184. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/02-threat-modeling/README.md +0 -0
  185. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/03-infrastructure-security/README.md +0 -0
  186. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/04-iam/README.md +0 -0
  187. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/05-application-security/README.md +0 -0
  188. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/06-secrets-management/README.md +0 -0
  189. /package/{tech_hub_skills → .claude}/roles/security-architect/skills/07-security-monitoring/README.md +0 -0
  190. /package/{tech_hub_skills → .claude}/roles/system-design/skills/01-architecture-patterns/README.md +0 -0
  191. /package/{tech_hub_skills → .claude}/roles/system-design/skills/02-requirements-engineering/README.md +0 -0
  192. /package/{tech_hub_skills → .claude}/roles/system-design/skills/03-scalability/README.md +0 -0
  193. /package/{tech_hub_skills → .claude}/roles/system-design/skills/04-high-availability/README.md +0 -0
  194. /package/{tech_hub_skills → .claude}/roles/system-design/skills/05-cost-optimization-design/README.md +0 -0
  195. /package/{tech_hub_skills → .claude}/roles/system-design/skills/06-api-design/README.md +0 -0
  196. /package/{tech_hub_skills → .claude}/roles/system-design/skills/07-observability-architecture/README.md +0 -0
  197. /package/{tech_hub_skills → .claude}/roles/system-design/skills/08-process-automation/PROCESS_TEMPLATE.md +0 -0
  198. /package/{tech_hub_skills → .claude}/roles/system-design/skills/08-process-automation/README.md +0 -0
@@ -0,0 +1,528 @@
1
+ """
2
+ Process Analyzer - Analyzes work processes for automation opportunities.
3
+
4
+ Part of the Tech Hub Skills Library (sd-08: Process Automation).
5
+ """
6
+
7
+ from dataclasses import dataclass, field
8
+ from typing import List, Dict, Optional, Tuple
9
+ from enum import Enum
10
+ import json
11
+
12
+
13
+ class ProcessComplexity(Enum):
14
+ """Process complexity classification."""
15
+ SIMPLE = "simple" # Linear, few decisions, single system
16
+ MODERATE = "moderate" # Some branching, multiple sources
17
+ COMPLEX = "complex" # Many decisions, unstructured data, ML needed
18
+ ENTERPRISE = "enterprise" # Cross-departmental, compliance, legacy
19
+
20
+
21
+ class AutomationType(Enum):
22
+ """Types of automation approaches."""
23
+ RPA = "rpa" # Robotic Process Automation
24
+ WORKFLOW = "workflow" # Workflow/orchestration
25
+ DATA_PIPELINE = "data_pipeline" # ETL/ELT automation
26
+ ML_BASED = "ml_based" # Machine learning automation
27
+ AI_POWERED = "ai_powered" # LLM/GenAI automation
28
+ INFRASTRUCTURE = "infrastructure" # IaC/DevOps automation
29
+ SECURITY = "security" # Security/compliance automation
30
+ HYBRID = "hybrid" # Multiple approaches combined
31
+
32
+
33
+ @dataclass
34
+ class ProcessStep:
35
+ """Represents a single step in a process."""
36
+ name: str
37
+ description: str = ""
38
+ time_minutes: float = 0.0
39
+ is_manual: bool = True
40
+ requires_decision: bool = False
41
+ requires_expertise: bool = False
42
+ error_prone: bool = False
43
+ data_sources: List[str] = field(default_factory=list)
44
+ tools_used: List[str] = field(default_factory=list)
45
+ dependencies: List[str] = field(default_factory=list)
46
+
47
+ @property
48
+ def automation_difficulty(self) -> float:
49
+ """Calculate automation difficulty score (0-1, higher = harder)."""
50
+ difficulty = 0.0
51
+ if self.requires_decision:
52
+ difficulty += 0.3
53
+ if self.requires_expertise:
54
+ difficulty += 0.3
55
+ if len(self.data_sources) > 2:
56
+ difficulty += 0.2
57
+ if len(self.dependencies) > 2:
58
+ difficulty += 0.2
59
+ return min(difficulty, 1.0)
60
+
61
+
62
+ @dataclass
63
+ class ProcessAnalysis:
64
+ """Complete analysis of a work process."""
65
+ name: str
66
+ description: str
67
+ steps: List[ProcessStep]
68
+ frequency: str # daily, weekly, monthly, quarterly, ad-hoc
69
+ stakeholders: List[str]
70
+
71
+ # Calculated fields
72
+ total_time_minutes: float = 0.0
73
+ automation_score: float = 0.0
74
+ complexity: ProcessComplexity = ProcessComplexity.SIMPLE
75
+ bottlenecks: List[str] = field(default_factory=list)
76
+ automation_types: List[AutomationType] = field(default_factory=list)
77
+
78
+ # Metadata
79
+ data_sources_involved: List[str] = field(default_factory=list)
80
+ systems_involved: List[str] = field(default_factory=list)
81
+ compliance_requirements: List[str] = field(default_factory=list)
82
+
83
+ def to_dict(self) -> Dict:
84
+ """Convert analysis to dictionary."""
85
+ return {
86
+ "name": self.name,
87
+ "description": self.description,
88
+ "frequency": self.frequency,
89
+ "stakeholders": self.stakeholders,
90
+ "total_time_minutes": self.total_time_minutes,
91
+ "automation_score": self.automation_score,
92
+ "complexity": self.complexity.value,
93
+ "bottlenecks": self.bottlenecks,
94
+ "automation_types": [t.value for t in self.automation_types],
95
+ "steps": [
96
+ {
97
+ "name": s.name,
98
+ "time_minutes": s.time_minutes,
99
+ "is_manual": s.is_manual,
100
+ "automation_difficulty": s.automation_difficulty
101
+ }
102
+ for s in self.steps
103
+ ]
104
+ }
105
+
106
+ def to_json(self) -> str:
107
+ """Convert analysis to JSON string."""
108
+ return json.dumps(self.to_dict(), indent=2)
109
+
110
+
111
+ class ProcessAnalyzer:
112
+ """
113
+ Analyzes work processes to identify automation opportunities.
114
+
115
+ This is the core analysis engine that examines process characteristics,
116
+ calculates automation potential, and identifies bottlenecks.
117
+ """
118
+
119
+ # Frequency multipliers for ROI calculation
120
+ FREQUENCY_MULTIPLIERS = {
121
+ "hourly": 2080, # Per year
122
+ "daily": 260,
123
+ "weekly": 52,
124
+ "bi-weekly": 26,
125
+ "monthly": 12,
126
+ "quarterly": 4,
127
+ "annually": 1,
128
+ "ad-hoc": 10 # Estimated
129
+ }
130
+
131
+ def __init__(self):
132
+ """Initialize the process analyzer."""
133
+ self.analysis_history: List[ProcessAnalysis] = []
134
+
135
+ def analyze_process(
136
+ self,
137
+ name: str,
138
+ description: str,
139
+ steps: List[Dict],
140
+ frequency: str = "weekly",
141
+ stakeholders: Optional[List[str]] = None,
142
+ compliance_requirements: Optional[List[str]] = None
143
+ ) -> ProcessAnalysis:
144
+ """
145
+ Analyze a work process for automation opportunities.
146
+
147
+ Args:
148
+ name: Process name
149
+ description: Process description
150
+ steps: List of process steps with properties
151
+ frequency: How often the process runs
152
+ stakeholders: List of stakeholders
153
+ compliance_requirements: Any compliance needs
154
+
155
+ Returns:
156
+ ProcessAnalysis object with complete analysis
157
+ """
158
+ # Convert step dictionaries to ProcessStep objects
159
+ process_steps = [
160
+ ProcessStep(
161
+ name=s.get("name", f"Step {i+1}"),
162
+ description=s.get("description", ""),
163
+ time_minutes=s.get("time_minutes", 0),
164
+ is_manual=s.get("manual", s.get("is_manual", True)),
165
+ requires_decision=s.get("requires_decision", False),
166
+ requires_expertise=s.get("requires_expertise", False),
167
+ error_prone=s.get("error_prone", False),
168
+ data_sources=s.get("data_sources", []),
169
+ tools_used=s.get("tools_used", []),
170
+ dependencies=s.get("dependencies", [])
171
+ )
172
+ for i, s in enumerate(steps)
173
+ ]
174
+
175
+ # Create initial analysis
176
+ analysis = ProcessAnalysis(
177
+ name=name,
178
+ description=description,
179
+ steps=process_steps,
180
+ frequency=frequency,
181
+ stakeholders=stakeholders or [],
182
+ compliance_requirements=compliance_requirements or []
183
+ )
184
+
185
+ # Calculate total time
186
+ analysis.total_time_minutes = sum(s.time_minutes for s in process_steps)
187
+
188
+ # Collect all data sources and systems
189
+ analysis.data_sources_involved = list(set(
190
+ source
191
+ for step in process_steps
192
+ for source in step.data_sources
193
+ ))
194
+ analysis.systems_involved = list(set(
195
+ tool
196
+ for step in process_steps
197
+ for tool in step.tools_used
198
+ ))
199
+
200
+ # Calculate automation score
201
+ analysis.automation_score = self._calculate_automation_score(process_steps)
202
+
203
+ # Determine complexity
204
+ analysis.complexity = self._determine_complexity(analysis)
205
+
206
+ # Identify bottlenecks
207
+ analysis.bottlenecks = self._identify_bottlenecks(process_steps)
208
+
209
+ # Recommend automation types
210
+ analysis.automation_types = self._recommend_automation_types(analysis)
211
+
212
+ # Store in history
213
+ self.analysis_history.append(analysis)
214
+
215
+ return analysis
216
+
217
+ def _calculate_automation_score(self, steps: List[ProcessStep]) -> float:
218
+ """
219
+ Calculate automation potential score (0-100).
220
+
221
+ Higher score = easier to automate with higher potential value.
222
+ """
223
+ if not steps:
224
+ return 0.0
225
+
226
+ # Base score from manual steps (more manual = more opportunity)
227
+ manual_ratio = sum(1 for s in steps if s.is_manual) / len(steps)
228
+ base_score = manual_ratio * 40 # Up to 40 points
229
+
230
+ # Time-based score (more time = more value in automating)
231
+ total_time = sum(s.time_minutes for s in steps)
232
+ time_score = min(total_time / 60, 1.0) * 20 # Up to 20 points for 1+ hour
233
+
234
+ # Difficulty penalty
235
+ avg_difficulty = sum(s.automation_difficulty for s in steps) / len(steps)
236
+ difficulty_penalty = avg_difficulty * 30 # Up to 30 points penalty
237
+
238
+ # Repetitiveness bonus (more steps = likely more repetitive)
239
+ repetition_score = min(len(steps) / 10, 1.0) * 20 # Up to 20 points
240
+
241
+ # Error-prone bonus (high value in automating error-prone steps)
242
+ error_prone_ratio = sum(1 for s in steps if s.error_prone) / len(steps)
243
+ error_score = error_prone_ratio * 20 # Up to 20 points
244
+
245
+ final_score = base_score + time_score - difficulty_penalty + repetition_score + error_score
246
+ return max(0, min(100, final_score))
247
+
248
+ def _determine_complexity(self, analysis: ProcessAnalysis) -> ProcessComplexity:
249
+ """Determine process complexity level."""
250
+ steps = analysis.steps
251
+
252
+ # Count complexity factors
253
+ decision_count = sum(1 for s in steps if s.requires_decision)
254
+ expertise_count = sum(1 for s in steps if s.requires_expertise)
255
+ data_source_count = len(analysis.data_sources_involved)
256
+ system_count = len(analysis.systems_involved)
257
+ has_compliance = len(analysis.compliance_requirements) > 0
258
+
259
+ # Calculate complexity score
260
+ complexity_score = (
261
+ decision_count * 2 +
262
+ expertise_count * 3 +
263
+ data_source_count +
264
+ system_count +
265
+ (5 if has_compliance else 0)
266
+ )
267
+
268
+ # Map to complexity level
269
+ if complexity_score <= 5:
270
+ return ProcessComplexity.SIMPLE
271
+ elif complexity_score <= 12:
272
+ return ProcessComplexity.MODERATE
273
+ elif complexity_score <= 20:
274
+ return ProcessComplexity.COMPLEX
275
+ else:
276
+ return ProcessComplexity.ENTERPRISE
277
+
278
+ def _identify_bottlenecks(self, steps: List[ProcessStep]) -> List[str]:
279
+ """Identify bottleneck steps in the process."""
280
+ if not steps:
281
+ return []
282
+
283
+ bottlenecks = []
284
+ avg_time = sum(s.time_minutes for s in steps) / len(steps)
285
+
286
+ for step in steps:
287
+ reasons = []
288
+
289
+ # Time-based bottleneck
290
+ if step.time_minutes > avg_time * 1.5:
291
+ reasons.append("high time consumption")
292
+
293
+ # Dependency bottleneck
294
+ if len(step.dependencies) >= 3:
295
+ reasons.append("multiple dependencies")
296
+
297
+ # Expertise bottleneck
298
+ if step.requires_expertise and step.is_manual:
299
+ reasons.append("requires specialized expertise")
300
+
301
+ # Error-prone bottleneck
302
+ if step.error_prone:
303
+ reasons.append("error-prone")
304
+
305
+ if reasons:
306
+ bottlenecks.append(f"{step.name}: {', '.join(reasons)}")
307
+
308
+ return bottlenecks
309
+
310
+ def _recommend_automation_types(
311
+ self,
312
+ analysis: ProcessAnalysis
313
+ ) -> List[AutomationType]:
314
+ """Recommend suitable automation types based on analysis."""
315
+ types = []
316
+ steps = analysis.steps
317
+
318
+ # Check for data-centric patterns
319
+ if analysis.data_sources_involved:
320
+ types.append(AutomationType.DATA_PIPELINE)
321
+
322
+ # Check for repetitive, rule-based patterns
323
+ simple_manual = sum(
324
+ 1 for s in steps
325
+ if s.is_manual and not s.requires_decision and not s.requires_expertise
326
+ )
327
+ if simple_manual > len(steps) * 0.5:
328
+ types.append(AutomationType.RPA)
329
+
330
+ # Check for workflow patterns
331
+ if len(steps) >= 5 and len(analysis.stakeholders) > 1:
332
+ types.append(AutomationType.WORKFLOW)
333
+
334
+ # Check for ML patterns
335
+ decision_heavy = sum(1 for s in steps if s.requires_decision)
336
+ if decision_heavy > len(steps) * 0.3:
337
+ types.append(AutomationType.ML_BASED)
338
+
339
+ # Check for AI patterns (content, reasoning, NLP)
340
+ content_keywords = ["write", "generate", "summarize", "analyze", "review"]
341
+ has_content_steps = any(
342
+ any(kw in s.name.lower() or kw in s.description.lower() for kw in content_keywords)
343
+ for s in steps
344
+ )
345
+ if has_content_steps:
346
+ types.append(AutomationType.AI_POWERED)
347
+
348
+ # Check for infrastructure patterns
349
+ infra_keywords = ["deploy", "provision", "scale", "monitor", "backup"]
350
+ has_infra_steps = any(
351
+ any(kw in s.name.lower() or kw in s.description.lower() for kw in infra_keywords)
352
+ for s in steps
353
+ )
354
+ if has_infra_steps:
355
+ types.append(AutomationType.INFRASTRUCTURE)
356
+
357
+ # Check for security patterns
358
+ if analysis.compliance_requirements:
359
+ types.append(AutomationType.SECURITY)
360
+
361
+ # If multiple types, mark as hybrid
362
+ if len(types) >= 3:
363
+ types.append(AutomationType.HYBRID)
364
+
365
+ return list(set(types)) # Remove duplicates
366
+
367
+ def calculate_roi(
368
+ self,
369
+ analysis: ProcessAnalysis,
370
+ hourly_cost: float = 75.0,
371
+ automation_cost: float = 10000.0,
372
+ automation_reduction_pct: float = 0.80
373
+ ) -> Dict:
374
+ """
375
+ Calculate ROI for automating a process.
376
+
377
+ Args:
378
+ analysis: Process analysis
379
+ hourly_cost: Cost per hour of manual work
380
+ automation_cost: One-time automation implementation cost
381
+ automation_reduction_pct: Expected time reduction (0-1)
382
+
383
+ Returns:
384
+ ROI calculation dictionary
385
+ """
386
+ frequency_multiplier = self.FREQUENCY_MULTIPLIERS.get(
387
+ analysis.frequency, 12
388
+ )
389
+
390
+ # Current annual cost
391
+ hours_per_execution = analysis.total_time_minutes / 60
392
+ annual_manual_cost = hours_per_execution * hourly_cost * frequency_multiplier
393
+
394
+ # Post-automation annual cost
395
+ automated_hours = hours_per_execution * (1 - automation_reduction_pct)
396
+ annual_automated_cost = automated_hours * hourly_cost * frequency_multiplier
397
+
398
+ # Savings and ROI
399
+ annual_savings = annual_manual_cost - annual_automated_cost
400
+ roi_year_1 = ((annual_savings - automation_cost) / automation_cost) * 100
401
+ payback_months = (automation_cost / (annual_savings / 12)) if annual_savings > 0 else float('inf')
402
+
403
+ return {
404
+ "current_annual_cost": round(annual_manual_cost, 2),
405
+ "automated_annual_cost": round(annual_automated_cost, 2),
406
+ "annual_savings": round(annual_savings, 2),
407
+ "implementation_cost": automation_cost,
408
+ "roi_year_1_percent": round(roi_year_1, 1),
409
+ "payback_months": round(payback_months, 1),
410
+ "break_even_executions": round(automation_cost / (hours_per_execution * hourly_cost * automation_reduction_pct), 0)
411
+ }
412
+
413
+ def compare_processes(
414
+ self,
415
+ analyses: List[ProcessAnalysis]
416
+ ) -> List[Dict]:
417
+ """
418
+ Compare multiple processes for automation prioritization.
419
+
420
+ Returns processes ranked by automation potential and ROI.
421
+ """
422
+ rankings = []
423
+
424
+ for analysis in analyses:
425
+ roi = self.calculate_roi(analysis)
426
+
427
+ # Priority score combines automation score and ROI
428
+ priority_score = (
429
+ analysis.automation_score * 0.4 +
430
+ min(roi["roi_year_1_percent"] / 10, 60) + # Cap ROI contribution
431
+ (100 - roi["payback_months"] * 2) * 0.2 # Faster payback = higher priority
432
+ )
433
+
434
+ rankings.append({
435
+ "name": analysis.name,
436
+ "automation_score": analysis.automation_score,
437
+ "complexity": analysis.complexity.value,
438
+ "roi_year_1_percent": roi["roi_year_1_percent"],
439
+ "payback_months": roi["payback_months"],
440
+ "priority_score": round(max(0, priority_score), 1)
441
+ })
442
+
443
+ # Sort by priority score
444
+ rankings.sort(key=lambda x: x["priority_score"], reverse=True)
445
+
446
+ return rankings
447
+
448
+
449
+ # Example usage
450
+ if __name__ == "__main__":
451
+ analyzer = ProcessAnalyzer()
452
+
453
+ # Example: Monthly report generation process
454
+ analysis = analyzer.analyze_process(
455
+ name="Monthly Sales Report Generation",
456
+ description="Generate and distribute monthly sales performance reports",
457
+ steps=[
458
+ {
459
+ "name": "Extract data from CRM",
460
+ "time_minutes": 30,
461
+ "manual": True,
462
+ "data_sources": ["Salesforce"],
463
+ "tools_used": ["Excel"]
464
+ },
465
+ {
466
+ "name": "Extract data from ERP",
467
+ "time_minutes": 45,
468
+ "manual": True,
469
+ "data_sources": ["SAP"],
470
+ "tools_used": ["Excel"]
471
+ },
472
+ {
473
+ "name": "Merge and clean data",
474
+ "time_minutes": 60,
475
+ "manual": True,
476
+ "error_prone": True
477
+ },
478
+ {
479
+ "name": "Calculate KPIs",
480
+ "time_minutes": 30,
481
+ "manual": True,
482
+ "requires_expertise": True
483
+ },
484
+ {
485
+ "name": "Generate visualizations",
486
+ "time_minutes": 45,
487
+ "manual": True,
488
+ "tools_used": ["Power BI"]
489
+ },
490
+ {
491
+ "name": "Write executive summary",
492
+ "time_minutes": 60,
493
+ "manual": True,
494
+ "requires_decision": True,
495
+ "requires_expertise": True
496
+ },
497
+ {
498
+ "name": "Review and distribute",
499
+ "time_minutes": 30,
500
+ "manual": True
501
+ }
502
+ ],
503
+ frequency="monthly",
504
+ stakeholders=["Sales Director", "CFO", "Regional Managers"]
505
+ )
506
+
507
+ print("=" * 60)
508
+ print("PROCESS ANALYSIS REPORT")
509
+ print("=" * 60)
510
+ print(f"\nProcess: {analysis.name}")
511
+ print(f"Total Time: {analysis.total_time_minutes} minutes")
512
+ print(f"Automation Score: {analysis.automation_score:.1f}/100")
513
+ print(f"Complexity: {analysis.complexity.value.upper()}")
514
+ print(f"\nRecommended Automation Types:")
515
+ for at in analysis.automation_types:
516
+ print(f" - {at.value}")
517
+ print(f"\nBottlenecks Identified:")
518
+ for bn in analysis.bottlenecks:
519
+ print(f" - {bn}")
520
+
521
+ # Calculate ROI
522
+ roi = analyzer.calculate_roi(analysis)
523
+ print(f"\nROI Analysis:")
524
+ print(f" Current Annual Cost: ${roi['current_annual_cost']:,.2f}")
525
+ print(f" Automated Annual Cost: ${roi['automated_annual_cost']:,.2f}")
526
+ print(f" Annual Savings: ${roi['annual_savings']:,.2f}")
527
+ print(f" Year 1 ROI: {roi['roi_year_1_percent']}%")
528
+ print(f" Payback Period: {roi['payback_months']} months")