Technology

Diagrams As Code In Your Repo’s README

What’s in a README? That which we call the [first go-to piece of developer onboarding material to a repo] by any other [filename] would smell as sweet.

As a project or codebase evolves, team members will leave and new ones will join. For the latter events it’s critical to have a concise README in the base of any project to introduce and explain a project with minimal hand-holding. With software or infrastructure (cough, Cloud) that can also mean how it’s meant to run, where it’s supposed to reside, and what it actually builds or deploys. Diagrams are an excellent supplement to a README, and defining that diagram with code makes it developer friendly, maintainable, and durable (vs. a fragile or overly verbose auto-generation).

With more complex projects or (especially) infrastructure-as-code, diagrams are essential to illustrate the network topology or module relations. The diagram code’s syntax is meant to be the focus for documentation, and relieves a developer from trying to visually align boxes or figure out how to spline an arrow to be aesthetically pleasing. (A diagram rendering might not be pretty but it’s correct to the code and therefore no team member should ever be harangued about poor artistic skills.) The diagram code can always be referenced for more detail, and can even include non-rendering elements such as comments.

Making the Diagram Happen — An Example

The examples below are written in Graphviz’s directed graph, digraph, DOT language. (The Graphviz technology has stood the test of time, originating from the early 1990’s out of AT&T Labs Research, and is still widely used.) The diagram’s image has been rendered with the `dot` program, and the caption has a link to a webapp which can do browser side rendering.

(View a live/webapp rendering of the above code here. Otherwise the Graphviz/dot program is needed to perform a local render: `dot yourDiagramCode.dot -Tpng -o output.png`)

Keep it Simple, Automation Can Be Overkill

It’s a very basic diagram and that’s part of the thesis here: KISS applies even to documentation. Your product or business team members might even start looking inside your repo because the diagram has lowered the learning curve just that bit extra. As an onboarding engineer it’s quicker to view an image than to try to read/parse through hundreds of lines of terraform. It is worth mentioning that terraform can generate graphviz code

terraform graph | dot -Tpng -o output.png

but I’ve tried this with even medium sized projects and the resulting image is >40k pixels wide and not useful.

For the Long Run

Beyond the code+rendering process, there’s immense benefit in the re-use of the usual mechanics of git/GitHub to the diagram code: git add, commit, diff, compare, merge, pull request, blame, etc. As fluently as your team of developers and engineers can collaborate over application code in a repository, the same mode can apply to maintaining the project’s diagram. And in the long run, a complex project’s repository has a better chance of having a maintained and up-to-date diagram.

Be the Agent of Change

How best to adopt? I would highly recommend experimenting with the Graphviz dot language and asking your team to do the same. If your repository is public then Gravizo has a clever way of scanning your repository and providing a link to a rendered image. But if your code is secure and private, the Graphviz CLI (dot) can easily be downloaded and then it becomes a (fun) exercise in CI to update your diagram after a PR/merge of your README and diagram code:

$ dot yourDiagramCode.dot -Tpng -o output.png #then to s3/etc.

Happy diagramming.

“I’ve always been fascinated by maps and cartography. A map tells you where you’ve been, where you are, and where you’re going — in a sense it’s three tenses in one.”

Peter Greenaway

Explore the latest content from Zus

Explore articles, case studies, succes stories and insights on modern health care.

Company
In the News

Zus Health Accepted as a Candidate QHIN Under TEFCA

Company
In the News

Zus Health Achieves HITRUST r2 Certification, Demonstrating Commitment to Cybersecurity and Information Protection

Company
Product

No Second Chances: How Zus Helps Providers Use AI to Get Risk Capture Right the First Time

Company
Product
Technology

Feature Fridays: Turning Condition Chaos into Clinical Clarity for Improved Care

Healthcare Disruption
In the News

Reimagining the EHR: From System of Record to System of Orchestration

Healthcare Disruption
In the News

The End of Retrospective Risk Adjustment: Why Prospective Coding Is the New Standard

Company
In the News

Zus Health Helps Value-Based Care Organizations Capture Accurate Risk with Intuitive, Evidence-Based Workflows

Company
In the News

The One Big Beautiful Bill Reforms Won’t Make Medicaid More Efficient, But Common Patient Records Will

Company
In the News
Technology

We Could Cut US Healthcare Costs in Half Tomorrow by giving it CPR…Common Patient Records.

Company
Product
Technology

Breathing Life into Patient Data: How the ZAP Brings Care to Life with CPR

Company
Product
Technology

Feature Fridays: Finding the Records Others Miss with Zus’ Record Locator Service

Company
Product
Technology

Feature Friday: The ZAP That Works Everywhere Care Happens

Company
Product
Technology

From Alerts to Action: Hospitalization Summaries that Keep Care on Track

Company
Product
Technology

Feature Fridays: Making Medication Management Smarter with Medication Journey Enrichment

Healthcare Disruption
In the News

Zus Health Recognized as Early Adopter in CMS Interoperability Framework

Company
Product
Technology

Feature Fridays: Keeping the Patient Record Always On with Intelligent Refresh

Company
Product
Technology

Feature Fridays: There’s a New CPR in Town that’s Changing how Care is Delivered

In the News
Technology

Feedback Zus shared with CMS: Building Smarter Infrastructure for Data-Driven Care

Company
Product

Designed for Safety, Built for Care: How Zus Develops Trusted Healthcare Technology

Company
Product

AI Replaces the Legal Pad: How Homeward is Prepping for Care in Half the Time

Company
Healthcare Disruption
People

Pipe Dreams: Converting ADT Noise into Transitions of Care Clarity

Company
Healthcare Disruption

Pipe Dreams: Building Smarter Healthcare Data Networks for Better Care

Company
In the News

Strengthening the Future of Value-Based Care: Reflections on Health Care Value Week

Company
Product

Zus Health Celebrates Unprecedented Growth, Announcing New Clients and AI-Powered Innovations

Technology

AI-Powered Insights: A New Chapter for Healthcare

Company

Championing Connected Care: Zus Joins Accountable for Health

Company
Technology

A Bridge to Better Care: Zus Health and Kno2’s QHIN Partnership

Healthcare Disruption
In the News

Falling Stars, Rising Results

Company
Healthcare Disruption
In the News

Bracing for the Presidential Election: Healthcare on the Political Divide

Company

Setting the Course for Always-On Care: Reflections from the Zus Summit

Product
Technology

The Gang Explains Information Blocking: Meaningful Use Era

People
Product

Why Zus: Building for (and with) our users

Technology

Build vs. Buy at Zus

Healthcare Disruption

Lessons from beyond the healthcare walls

People
Technology

Why Zus: The new wave of platforming is coming!

Healthcare Disruption
Technology

The Evolution and Death of the Electronic Medical Record

Healthcare Disruption

Moving away from top-down healthcare

Company
Healthcare Disruption

A great night in Houston

Company
Product

Zus Health Joins athenahealth's Marketplace Program to Bring Real-time Clinical Data to the Point of Care

Healthcare Disruption

On timeliness in healthcare data

Case Studies

Cecelia Health leverages Zus data throughout the end-to-end patient journey

Healthcare Disruption

Claims to Fame

Healthcare Disruption

Data Interoperability as HEDIS Helper

People

Fixing healthcare through data

Healthcare Disruption

What is value-based care?

People

Cooking with Zus

Healthcare Disruption

Making DaaS Mainstream

Healthcare Disruption
People

Q&A with Dave Boerner: On evolution vs. revolution

Company
Healthcare Disruption

Affirming our vision of a connected healthcare ecosystem

Healthcare Disruption

The life-giving of a down market

Company
Healthcare Disruption

The year is dead, long live the year

Healthcare Disruption

I’m a Mac, I’m a PC

Healthcare Disruption
Technology

Yes, data is oil, but my car runs on gas.

Healthcare Disruption

Interoperability. It’s electric!

Company

Announcing the new Zus look

Company
In the News

Zus Health Closes Financing, Signs Partnership with Elation Health, to Accelerate Growth of its Data Service to Provide Connective Tissue for Healthcare

Company
Product

Why should I use Zus?

Healthcare Disruption

The Gang Explains Information Blocking: HIPAA

Healthcare Disruption

A Song of Health and FHIR

Technology

Accelerate your developer onboarding with helpful git commit messages

Technology

State, coupling, complexity, code: four liabilities

Healthcare Disruption
Product

Chasms and Fires

People
Technology

So, why Zus?

Healthcare Disruption
People

Why Zus: I’m here to save the (healthcare) world!

Healthcare Disruption

Curing America's Healthcare

Company

Why Zus

Company
In the News

Zus and Healthie Partner to Empower Digital Health Organizations to Access Patient Health History

Company
In the News

Canvas Medical and Zus Announce Strategic Product Partnership

Healthcare Disruption

From boat show to prom night

Technology

Mocking outbound http requests in go: you’re (probably) doing it wrong

No items found.

Zus Health Completes Another SOC 2 Type II Audit

Healthcare Disruption

Platform Do’s and Dont’s (from a former platform failure)

Healthcare Disruption

2023's on FHIR (but not R5)

In the News
Product

Zus x Healthie: In digital health, we’re all in this together.

Company
Technology

Maximizing Data: How Zus, Firefly and Elation Advance the Quest for Clinical Truth

Company
People

Inside the Zus Engineering Hiring Process

In the News
People

ACO Rx: A Strategic Shift From Claims to Real-Time Network Data

Case Studies

Zus Use: Real-time Patient Query in the ED

Company
Technology

Physicians Are Going in Blind: How Breaking Down EHR Silos Will Lead to Better Care

Company
People

The Challenges Providers Are Losing Sleep Over: A Roundtable Recap From the FLAACOs Conference