Quick and dirty dependency map automation

horizontal neon lights
Photo by H Shaw on Unsplash

After some of my recent articles on building a dependency map, a few people got in touch asking for tips on actually creating them. Here’s a quick way to get started.

You might have noticed the following example in my previous posts.

Dependency map example

I created the graphic above with an amazing bit of kit called Neo4j. It’s actually an incredibly sophisticated graph database technology, so it almost feels a little sacrilegious to be using it for this.

I’m not going to get into the mechanics, largely because I don’t fully understand them myself. But I can give you what you came for, a quick way to automatically generate the visuals.

Neo4j works by creating a database instance that you can then interact with, so I’m going to give you the two scripts used to create and then visualise the example above.

First, the creation script. This works by creating nodes for each business function we need to represent. Here we’re asking Neo4j to create a number of ‘team’ type nodes and assign each an appropriate string name.

CREATE (Finance:Team {name: 'Finance'})
CREATE (Performance:Team {name: 'Performance'})
CREATE (Penetration:Team {name: 'Penetration'})
CREATE (BA:Team {name: 'BA'})
CREATE (Development:Team {name: 'Development'})
CREATE (Infrastructure:Team {name: 'Infrastructure'})
CREATE (Pipeline:Team {name: 'Pipeline'})
CREATE (Platform:Team {name: 'Platform'})
CREATE (Projects:Team {name: 'Projects'})
CREATE (PMO:Team {name: 'PMO'})
CREATE (UX:Team {name: 'UX'})
CREATE (Network:Team {name: 'Network'})
CREATE (Business:Team {name: 'Business'})
CREATE (Analytics:Team {name: 'Analytics'})
CREATE (Ops:Team {name: 'Ops'})
CREATE (Security:Team {name: 'Security'})
CREATE (UI:Team {name: 'UI'})
CREATE (Monitoring:Team {name: 'Monitoring'})

The second part of the script is linking the nodes up.

CREATE(Finance)<-[:DEPENDS_ON {size: 'L', name: 'Unknown', type: []}]-(Infrastructure)
CREATE(Monitoring)<-[:DEPENDS_ON {size: 'L', name: 'Selenium', type: ['Process', 'Tool']}]-(Infrastructure)
CREATE(Network)<-[:DEPENDS_ON {size: 'L', name: 'Unknown', type: ['Tool', 'People']}]-(Infrastructure)
CREATE(Penetration)<-[:DEPENDS_ON {size: 'XL', name: 'Unknown', type: []}]-(Infrastructure)
CREATE(Infrastructure)<-[:DEPENDS_ON {size: 'Unknown', name: 'Selenium', type: ['Process', 'Tool', 'Skill', 'People']}]-(Monitoring)
CREATE(Finance)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: []}]-(Network)
CREATE(Penetration)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: []}]-(Network)
CREATE(Network)<-[:DEPENDS_ON {size: 'XL', name: 'Unknown', type: ['Tool', 'People']}]-(Penetration)
CREATE(Security)<-[:DEPENDS_ON {size: 'Unknown', name: 'Approval', type: ['People']}]-(Penetration)
CREATE(Security)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: ['People']}]-(Development)
CREATE(UX)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: []}]-(UI)
CREATE(UI)<-[:DEPENDS_ON {size: 'L', name: 'Unknown', type: ['People']}]-(Development)
CREATE(Security)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: ['People']}]-(Ops)
CREATE(Finance)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: []}]-(Security)
CREATE(Penetration)<-[:DEPENDS_ON {size: 'XL', name: 'Approval', type: []}]-(Security)
CREATE(Business)<-[:DEPENDS_ON {size: 'Unknown', name: 'Unknown', type: []}]-(Development)

Here we’re telling Neo4j to create a reference between two nodes and pass the collected meta data for that link. Let’s unpick one as an example.

CREATE(Monitoring)<-[:DEPENDS_ON {size: 'L', name: 'Selenium', type: ['Process', 'Tool']}]-(Infrastructure)

This is saying:

  1. Create a reference from Infrastructure to Monitoring (These need to be known nodes)
  2. Call that reference ‘DEPENDS_ON
  3. Mark that reference as size ‘L‘ and named ‘Selenium
  4. Say that the reference has the types ‘Process‘ and ‘Tool

Now we just need to visualise it!

MATCH (n1)-[r]->(n2) RETURN r, n1, n2

After running both of these commands, you should have a visual representation of the underlying graph structure displayed in your database browser. Export to an image file and you’re good to go.

More Automation!

So you could just go and manually edit the script above, but there are those of you looking at that manual job and working out how to get away with not doing it.

It is very straightforward to automate the creation of this script. Just pick your favorite language and script something up that takes the CSV output from your dependency map session and produces the required input for Neo4j. The latest script I used to generate a dependency map was created by my good friend David Grant between some meetings.

Summary

There are plenty of ways to go about creating a dependency map. I have previously created them manually in LucidChart and even Office! There are also plenty of ways to go about creating them using node-based technologies so don’t get hung up on this approach. This is simply the quickest way that I found to go from doodles to diagrams. Let me know how you get on.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.