IDEAS | BLOG

Adding Socrata to Your Drupal Game Plan

If you’re reading our blog, you’re probably already aware that some of the most important and sophisticated websites are built with Drupal. See whitehouse.gov, commerce.gov, brunomars.com. You’re probably also familiar with Socrata, the open data provider for federal, state, and local governments.

Drupal Socrata

The Socrata platform provides access, cost-savings, and data-driven innovation for hundreds of public sector leaders and millions of their constituents worldwide. Socrata counts the CDC, World Bank, and UN Development Programme (UNDP) among their customers. What’s likely news to you, though, is that thanks to some recent Forum One contributions to the Socrata Drupal project, these two platforms play well together! In this post, we’ll give an overview of what the Socrata/Drupal integration does, how to get started, and where we’ll be taking it next.

What Does the Socrata Drupal Project Do?

Socrata provides their own out-of-the-box data visualizations, but integration with Drupal gives you much more flexibility and extensibility. Using Socrata’s data within your Drupal site allows you to customize the way you’re using that data to tell your story, inform your audiences, and ultimately influence action. The Socrata Drupal project is a way to access all of the data provided by Socrata using familiar Drupal site building tools.

Using Views -- Drupal’s query and list-building tool, which has been moved into core with Drupal 8 -- you can easily query the Socrata API as a “data source,” so that your Socrata dataset can be seamlessly integrated into your Drupal site. The data source from Socrata can be the standard SODA2 API (think “show me all of the data in the City of Seattle building permits data set”) or the Catalog Search API (think “show me all of the datasets from the City of Seattle”). You can query and display the data with all the options that you’re accustomed to: selected fields from the dataset, filters and sorting, aggregation, output formatting, and all the standard options provided by Views.

And if you just want to add a default Socrata visualization inline with other content on your site, the Drupal project also provides a convenient way for you to add a Socrata dataset widget to any textarea. Simply copy and paste a “shortcode” for the dataset you’ve created into your content. Combined with other Drupal modules and site building, you might display aggregated statistics, charts, graphs, maps, or simple lists of data from Socrata -- all with the look and feel of the rest of your Drupal site. And of course, the relevant Socrata configuration is exportable so it can be tracked in your project’s code repository and deployed with confidence.

Where We’ve Been and What’s Next

At Forum One we started working closely with Socrata on the Drupal project last fall. We picked up on the initial project development by the previous maintainer, Robert Bates, and worked on code refactoring, addition of new features, a number of bug fixes and enhancements. We’re excited to currently have the project in a beta state, with an initial Drupal 7 stable release imminent. After that, we plan on additional minor enhancements and bug fixes, as well as documentation improvements.

We’ll also be starting a Drupal 8 port of the project soon. In the meantime, we consider the project ready for production use. Try out the Socrata module to integrate open government data on your Drupal site! And of course, feedback and review is welcome in the drupal.org issue queue.

More good ideas we think you'll enjoy