After interviews, most audits end up with a table of steps: who, what, which tool. Turning that into a diagram by hand is slow. This short script outputs a Mermaid flowchart with one lane per role, handy for any small-business AI workflow audit.
Input: a CSV of steps
id,role,step,tool,next
1,Customer,Sends enquiry,Website form,2
2,Front desk,Copies to sheet,Google Sheets,3
3,Front desk,Replies on WhatsApp,WhatsApp,4
4,Sales,Calls back,Phone,5
5,Sales,Sends quote,Email,
Script
import csv
from collections import defaultdict
def to_mermaid(path):
rows = list(csv.DictReader(open(path)))
lanes = defaultdict(list)
for r in rows:
lanes[r["role"]].append(r)
out = ["flowchart LR"]
for i, (role, steps) in enumerate(lanes.items()):
out.append(f' subgraph L{i}["{role}"]')
for s in steps:
out.append(f' S{s["id"]}["{s["step"]}<br/><i>{s["tool"]}</i>"]')
out.append(" end")
for r in rows:
for n in filter(None, r["next"].split(";")):
out.append(f' S{r["id"]} --> S{n}')
return "\n".join(out)
print(to_mermaid("steps.csv"))
Paste the output into any Mermaid renderer (GitHub Markdown supports it).
Using it in an audit
- Lane changes are handoffs. Count them; each is a place work can stall.
- Steps where the tool changes (form to sheet to WhatsApp) are copy-paste points and often the first automation candidates.
- Add a column for "minutes per run" and label nodes with it once you have measured.
We use a similar step table in our own work; more on how we decide what to build: how we decide what to build after mapping.
Disclosure: I co-founded NxFlowAI, an automation agency.
Top comments (0)