In this blog I'll be talking about today's project where DSNY13, as a team, designed a schema, created tables, and build dashboards around mocked marathon data in one day.

The Data

The first thing we did was explore the data. This was done by putting it into Tableau Prep and building a dictionary. The data had 30 fields where each row was a marathon name, race date, first name, and last name.

The Schema

We stuck to the minimum table requirement and planned out the schema below, where we'd create different unique IDs for the different instances.

Writing the Code

For this project, we cloned the main branch called marathon raw and each created our own branch for the SQL code we were making before merging it together into one long SQL script. I was making the Charities table and the Result Charities table, so I created a branch with those names containing the code for the SQL creation.

Here is an example line of code:

create or replace table charities(

    charity_id int primary key,

    charity_name varchar(100) not null

);

insert into 

    charities

select 

        row number () over (order by charity_name desc) as charity_id,

        charity_name

    from

            marathon_raw;

What this code does is create the Charities table and name the fields, while also adding constraints. For example, by adding 'primary key' after charity_id, while inserting data there can not be repeats or else it'll error. Then, it inserts values, including a window function that gets a unique number for each charity name, and then the charity names themselves from the raw data.

The Dashboard

I did a conditions analysis where I made a scatterplot to look at how environmental conditions influence run times. The tables I needed for this purpose successfully connected logically in tableau.

And created a scatterplot looking at finish time by temperature and elevation with the ability to look at the individual runner's information by clicking on the dot.

A future iteration of this dashboard will have additional filters and factors being looked at, such as age and repeat racers.