1Read the as-built drawing
AutoCADDrawing literacyInput: P&ID-12-001 and plot plan PLOT-12-002, both Rev C. Output: a list of every tagged item.
- 25 tags: pumps, vessels, valves, instruments, piping, electrical
- 3 line numbers, for example
8"-PL-1001-A1A= size · service · sequence · spec - 4 instrument loops (PT/PIT, FT, LT, TT)
- Rev C cloud: PSV-2001 moved onto the relief header. Every revision changes the register.
2Build the asset register
ExcelData disciplineEach tag becomes one row with the same fields: what it is, which drawing and line it sits on, where it is, how critical it is, its condition, and when it is next due for inspection.
The planner's workbook has a frozen header, autofilter, and live COUNTIFS/SUMIF summary formulas.
| tag | type | drawing | line | crit. | cond. | next insp. |
|---|---|---|---|---|---|---|
| PSV-2001 | Valve | P&ID-12-001 C | 4"-PL-1003 | High | Poor | 2026-09-30 |
| P-101A | Pump | P&ID-12-001 C | 8"-PL-1001 | High | Fair | 2026-09-12 |
| MCC-01 | Electrical | PLOT-12-002 C | — | High | Fair | 2026-07-10 |
| L-1001 | Piping | PLOT-12-002 C | 8"-PL-1001 | High | Fair | 2026-09-01 |
| … 21 more rows | ||||||
3Model it in SQL
SQLThree related tables. Every work order and every inspection points back to an asset tag:
- assets (25): the register from step 2
- inspections (75): inspection history
- work_orders (14): maintenance, 12 of them still open
The view v_asset_risk calculates days overdue, open work orders, and the risk score. The rule lives in one place, so Excel, the dashboard, and the map always agree.
Files: schema.sql queries.sql station-12.db
-- Q4: Risk ranking
SELECT tag, type, criticality, condition,
days_overdue, open_wos, risk_score
FROM v_asset_risk
ORDER BY risk_score DESC, days_overdue DESC;
-- Q5: Action list (assets + open work orders)
SELECT a.tag, a.risk_score, a.days_overdue,
w.id AS wo_id, w.priority, w.status
FROM v_asset_risk a
LEFT JOIN work_orders w
ON w.asset_tag = a.tag
AND w.status IN ('Open','In Progress')
WHERE a.days_overdue > 0 OR w.id IS NOT NULL
ORDER BY a.risk_score DESC;
4Rank the risk
AnalysisIntegrity thinkingScore (0–100) = criticality + condition + time overdue + open work orders.
- Criticality: High 54 · Medium 36 · Low 18 (consequence)
- Condition: Poor 25 · Fair 12 · Good 0 (likelihood)
- Overdue: 0.25 per day, capped at 90 days (max +22.5)
- Open work orders: +4 each (known open problems)
Worked example: PSV-2001 (rank #1)
| Criticality: High | 54 |
| Condition: Poor | 25 |
| 62 days overdue × 0.25 | 15.5 |
| 1 open work order × 4 | 4 |
| Score (rounded down) | 98 |
Top of the action list
| # | Tag | Score | Why |
|---|---|---|---|
| 1 | PSV-2001 | 98 | Poor, 62 d overdue, set-pressure work order |
| 2 | P-101A | 94 | 80 d overdue, 2 open work orders (seal leak) |
| 3 | MCC-01 | 92 | 144 d overdue, the longest |
| 4 | L-1001 | 92 | 91 d overdue, coating holiday at support 14 |
| 5 | V-201 | 89 | Poor, 2 open work orders |
5Report it so a manager can act
Power BIThe dashboard is laid out like a Power BI report page: headline numbers, a criticality × condition grid, a map, and the ranked action list. The data/ folder holds a star-schema export (one asset table, two fact tables) that loads directly into Power BI.
Files: index.html (dashboard) dim_assets fact_inspections fact_work_orders
6Hand off to each team in its own format
GISAutoCADTechnical writing| Who | Gets | File |
|---|---|---|
| Inspection planner | Excel register + summary | .xlsx |
| Drafting / CAD | Layered drawing for markup | .dxf |
| GIS / field crew | Asset points with risk attributes | .geojson |
| Management | Dashboard + 2-page summary | |
| Next engineer | Method, assumptions, limits | case study |
↻ Closing the loop: the step that makes it a workflow
- The field crew inspects PSV-2001 and closes its work order.
- The new inspection date and condition go into the register.
- If the field finds a mismatch, the drawing gets a new revision (Rev D).
- Rerun the build (
python3 build.py), then check it (python3 validate.py: 20 checks). - The ranking updates and the next asset moves to the top.
Honest caveat: the data is synthetic. A real version would pull in-line inspection (ILI) and cathodic protection (CP) surveys, SCADA, and the maintenance system (CMMS), and would use a proper consequence model.
