I'll be writing about my first day of my Capstone project. For this project I'm working with FDA datasets, one of which I got from connecting to their API. I'll be talking about that process in this blog.

Connecting to the API

My first step was reading the documentation here: FDA API Documentation. Most of my time was spent understanding the documentation and how to translate the instruction into Alteryx. After signing up for the API Key, I originally tried to insert it into the URL using the formula tool in this format: https://api.fda.gov/drug/event.json?api_key=yourAPIKeyHere. However, when that didn't work, I switched to the download tool, following the instruction in the "HTTPS requests only" section (see below).

After ensuring I could successfully connect to the API, I masked the API key which I'll explain more in detail in the next section. To explain the rest of the workflow, I first inputted the Base URL and desired endpoint into a text input. Then, I joined it with the file containing my API Key. After, I created a formula within a formula tool.

This portion took some trouble shooting, where initially I would only get one row of data. I then realized that, by default, this API limited the amount of rows that was returned, with the default being limit=1. After some trial and error, I realized that my maximum limit was 100, leading to my plan to only look at a specific time period, possibly just a couple of years, for this project.

Here is the formula I ended up using in the formula tool: [Base URL] + [Shortages Endpoint] + '.json?' +'sort=initial_posting_date:desc&limit=1000'

After, I connected to the download tool and parsed out the download data.

Then I cleaned the field names and the values.

Masking the API Key

I was deciding between two methods for masking my API Key, where I would either create an app where the user has to input the key themselves, or ensure that the key wasn't hardcoded by making a file and deselecting the file while exporting the workflow. I picked the latter option.

An important thing to remember was ensuring that the Header was spelled correctly. In this scenario, I had to make sure the Header was "Authorization:". Then, the value was "Basic" with a space and then my API key. Then, once I joined the file onto my base URL, I was able to select the API Key within the Download tool by checking the relevant box (see below).

To export it, I went to Options -> Export Workflow and then deselected the file with the API Key to make sure it's not included in the flow.

Next Steps

My next steps in this project is to make sure the other datasets I have in mind, either FDA Drug Approvals where I can compare approvals with shortages or just general FDA Drug information so that I can drilldown somehow. Next. I'll make sure my user stories are concrete before building out my schemas, tables, and eventually dashboard sketches and dashboards.