Show live and planned work on an architecture diagram
This guide is for anyone who needs one picture of what runs today and what is still coming. open-diagram draws five states, and a small file can change them without touching the diagram.
Updated
Which states can a part have?
Live, building, trial, planned and retiring:
| State | Word in the key | How it is drawn |
|---|---|---|
live | Live | The default look: a solid dark border on white |
building | Being built | A dashed orange border on pale orange |
trial | In trial | A dashed purple border on pale purple |
planned | Planned | A dotted gray border on pale gray |
retiring | Retiring | A solid red border on pale red |
A panel with a state also shows the state's word in its header. The key at the top lists only the states the picture uses. Lines have their own two kinds: a solid line for "Data flows today", and a dotted line, "kind": "planned", for "Connection to build".
How do I set a state?
Add "status" to a tile or a panel. A tile becomes {"label": ..., "status": ...} instead of a plain string.
{
"title": "A bookshop's order system, this quarter",
"gap": 110,
"columns": [
[{"id": "shop", "title": "Online shop", "tiles": ["Checkout", {"label": "Gift cards", "status": "trial"}, {"label": "Paper catalogue", "status": "retiring"}], "cols": 1}],
[{"id": "orders", "title": "Order service", "tiles": ["Orders", {"label": "Fraud checks", "status": "building"}], "cols": 1}],
[{"id": "lockers", "title": "Parcel lockers", "status": "planned", "tiles": ["Locker booking", "Pickup codes"], "cols": 1}]
],
"links": [
{"from": "shop", "to": "orders"},
{"from": "orders", "to": "lockers", "kind": "planned", "label": "pickup orders"}
]
}
The check: 0 layout problems
In Python, pass status= to Tile or Panel. In a Mermaid flowchart, a class named after a state sets it: A:::building or class A,B planned.
How do I change states without editing the diagram?
Keep the states in a separate file and pass it with --statuses.
- Save the diagram above as
plan.json. - Write
states.json:
{"Fraud checks": "live", "Parcel lockers": "building"}
```
3. Draw with the file:
```bash
open-diagram draw plan.json --statuses states.json
```
Names match panel titles, panel ids and tile labels. `live` returns a part to the default look. With the same file, `open-diagram describe plan.json --statuses states.json` lists "Fraud checks" with no state and "Parcel lockers [being built]".
open-diagram checks the file before it draws anything. A misspelled name stops the draw with `no panel or tile is named 'Fraud check'`. An unknown state stops it with `unknown state(s) 'done'; this theme has: live, building, trial, planned, retiring`.
A JSON diagram can also keep the same names and states under a top-level `"statuses"` key. In Python, call `d.set_statuses({"Fraud checks": "live"})`.
## Can I add a state of my own?
Yes, through the theme. This Python adds a dashed purple "Pilot" state:
from open_diagram import Diagram, Status, Theme
theme = Theme() theme.statuses["pilot"] = Status("Pilot", stroke="#8E24AA", fill="#F6EDF9", dash="dashed") d = Diagram("My picture", theme=theme)