There’s a lot of chatter about executive orders, where US presidents use their authority to issue directives without congress passing a law. In an effort to understand, I set out to use open data and Orchestrate to shine a light on executive orders of the past three presidents. Between leveraging Orchestrate’s full text search and the flexibility of the Hapi.js framework, I was impressed with how quickly the basic prototype of the site came together with minimal code.


The executive order search app is up on Heroku. Search a word or phrase and it quickly runs three Orchestrate queries behind the scenes. Then the count for each of the last three presidents is updated based on the number of executive orders that matched the search. If you want to dig deeper, click the details button to see the dates and brief descriptions of each executive order.

Where the Data Came From

The Federal Register maintains a downloadable reference of all executive orders since 1994, available in several formats. This source was sufficient for titles of the executive orders, dates, URL of the publication and a few other bits of metadata. However, the real meat is in the full text of each order. For that, I needed to download the basic text version of nearly 800 executive orders.

Once I combined each executive order’s metadata with the full text, I pushed each to Orchestrate as an item in a single collection. All data in Orchestrate is indexed for search, so I was set. The heavy lifting to determine the number of executive orders is all done within the database.

JavaScript Up Front, JavaScript in Back

It’s important to note that, even though this application appears to only be front-end JavaScript, there’s a thin-yet-important server-side layer in place. Even if it were technically possible to call Orchestrate with client-side JavaScript, it would not be advisable, as it exposes your API Key. In the wrong hands, your API Key is all that is needed to inject inaccurate data or even delete all of your data.

For my backend, I chose Node.js and the Hapi framework because they’re lightweight, familiar and great for creating APIs. Since this server-side component is essentially just a way to keep my API Key hidden, an API specific for my front-end is really all I need.

Calling on Orchestrate

With the executive orders already loaded into Orchestrate, the only feature this app consistently uses is Search. Each time a user searches a word or phrase, the backend service makes three quick calls to Orchestrate in succession, one for each President. Since Heroku is within the same data center as Orchestrate (in this example, Amazon US East, each search averages 11ms. Even with three separate calls, the results are extremely fast.

My Lucene syntax query for each call looks something like this:

value.text:arkansas AND president:clinton

And since I don’t need the details of each executive order, I pass a limit=0 parameter so that I receive the total_count and little else. The code notes each response and stores the number for the search completed with all three presidents.

Once the backend has all three results, it spits out a simple JSON response for the search, like so:


Explore the Code

Much of the interaction aspects of the application happens in the front-end with jQuery. However, you can look at the Orchestrate calls within the app.js file. The entire project is on GitHub.

What data do you want to search? Login to the Dashboard and explore Orchestrate’s features now.

Photo by NobMouse