Introducing a useful tool for hospitals on Drupal

Image
A toy ambulance on a bench

Horizontal recently completed building a Drupal 10 site for a major children's hospital. Drupal has long been a favorite choice in the healthcare sector. This post will introduce a module we contributed that we hope will make Drupal an even more appealing choice when hospitals are considering how to present themselves on the Web.

Some red tape

The major hospital we collaborated with is in the United States and, as such, has to consider many rules and regulations from the Centers for Medicare and Medicaid Services (CMS). Full disclosure, I don't know anything about most of these regulations. I did, however, get tasked with helping the hospital fulfill its obligations surrounding a "comprehensive machine-readable file with all items and services". In one sense, this is really easy: we just have to upload a file and link to it. Drupal, of course, is very good at that.

Except, there are a significant number of requirements: we need to post a single machine-readable file with a very specific naming convention. Further, we need to link to it in a number of different ways and we have to update the file at least once a year. Those requirements make things a bit messier, especially if the hospital has multiple locations operating under the same license (and website).

A new content entity type

Drupal works in entities and, at the end of the day, we're going to solve this problem with entities. Given the number of requirements, though, we weren't convinced that existing content entity types such as File or Media were our best choice. Instead, we chose to create a new content entity type that we dubbed Hospital Price Transparency (HPT). HPT entities are designed to make it easy to meet all of the legal requirements laid out by CMS. 

We liked the idea so much that we chose to contribute it to Drupal.org as the Hospital Price Transparency module. There are some very detailed docs available there. We'll try to stay high level in this post, but we'll speckle links throughout if you want to get your hands dirty.

Ok, so let's see how these HPT entities make life easy.

Creating an HPT entity

When adding a new HPT, we see a few fields we need to fill in:

A completed HPT form

 

Not surprisingly, there's a file field. However, that file field comes with some special behind-the-scenes validation that helps assure the file is in a machine readable format. Further, the file field has some special support of zip files. That can really come in handy, seeing as these files can be truly huge, easily approaching a GB in size!

We also see a note claiming that the end user will get served a file that meets CMS naming conventions regardless of the name of the uploaded file. That helps explain why there are other base fields on the entity. The EIN and hospital name are combined to create the user-facing name of the pricing document.

We can create as many HPT entities as we need. Here's what the admin list looks like when we have two of them.

The admin page with a couple HPTs.

 

Managing HPT entities

Let's never forget that Drupal is a content management system (a different kind of CMS). Drupal starts to really shine after we've created one or more HPT entities and we have to start to do stuff with them.

The most important thing we have to do is create links to them. But we also have to update the pricing at least once a year. And if we have more than one location, we may need to do this same thing for each location. If we've simply uploaded some files and linked directly to the files, it's pretty easy to imagine that this might go badly. On the other hand, with HPT entities we can edit an HPT and update its file and we're done! Any link to that HPT will automatically serve the updated file. The HPT entity has revision history just like a node, too, which means it's easy to keep track of the historical updates to any HPT (and revert if the need should arise).

You might be thinking to yourself that Media entities could do be managed just as easily. My answer to that would be that you're probably right, but HPT might still be better. There are some musings on Media in the HPT docs.

Isn't Drupal great?

I can't tell you how much fun I had while working on this module. It's an amazing example of how you can take something pretty easy (e.g. posting a file), do a lot of work (i.e. contribute a module), and instead make it really easy for lots of people! I'd say that's really the essence of the Drupal community.