Using an API key to analyze NASA’s data in Alteryx

Self-serve data science helps businesses use their own data to ask and answer questions. These insights can lead to faster and smarter decisions. However, no business exists in a vacuum.  At Continuus, most of our clients combine internal data with information from outside sources. Whether it’s an ongoing feed from Bloomberg or a one-time query of survey data, the use of external data sources can improve your decision-making abilities.

Developers often integrate disparate technologies using an Application Programming Interface (API). To illustrate how easy it is to use an API key to integrate external data with Alteryx, let’s look at a fun exercise we recently completed using a publicly-available data feed from NASA.

NASA’s Open Innovation team works to make the space agency’s data freely available to the public. We decided to protect our fellow citizens from possible doom due to an asteroid or other space object by analyzing data from the Near Earth Object (NEO) Feed with Alteryx.

After applying for API access on NASA’s website we searched for the specific documentation for the NEO data feed. We then:

  • Determined the URL needed and the http protocol for making the data request.
  • Used a text input tool to paste in the URL, along with our user-specific API key and other parameters (such as start and end date) required to make the request.
  • After the full URL is passed to the download tool, http action is set from the payload tab.
  • Results for this API are returned data in JSON format, so we passed the data through a JSON parse tool, then further parsed the data using a text to columns tool.
  • Finally, we filtered out the metadata and we had our complete data set.

json-data.png

To see the data in action, we wrote the output to a Tableau data visualization. Now we can see all the asteroids that have approached earth in 2018 and those that are projected in the next week.

 

Finally, for an extra challenge, we created an API integration with the Slack messaging app. The integration will allow us to send an alert should an asteroid get too close for comfort. Using an API for Slack, we acquired a URL and key that will post a message to our entire team.  Within Alteryx, we created a conditional alert and formatted it as a JSON request. Using the download tool again, we input the full URL, set the http action to POST and took the query string/body from our field containing the formatted JSON message.

 

The JSON message created in Alteryx is:

{"channel":"#doomsdaywatch","text":  "Good News! No potentially hazardous 'Near Earth Objects' in view for this week!\n\nPlease resume your normal activities :smile:"}

Here’s what the message looks like when published in Slack:

doomsday-bot.png

While you might not worry about an asteroid hitting the Earth, using an API key to integrate external data can come in handy in real-world situations, such as John Heisler’s analysis of wind farm data for a client. See how the powers of Alteryx and Tableau were combined to enable short-term risk planning and up-to-date deep analytics.