fbpx
Home Blog Page 1666

Ask a Data Engineer: Warby Parker Edition 👓

0
Ask a Data Engineer: Warby Parker Edition 👓

wp-header

Codecademy’s very own Nick Duckwiler (left) and Ryan Tuck from Warby Parker (right) in our office. (📷: Mitch Boyer)

Last month, Codecademy and Warby Parker came together to work on a special Learn SQL from Scratch Capstone Project. It was during this time when I met Ryan Tuck, a Data Engineer at Warby, who played a major part in this partnership. So when he decided to drop by our office for the final QA round, I had to break out my notebook and ask some questions. Enjoy.


Hey Ryan, let’s start off with a question I’ve had for a while — what is a Data Engineer? (Is it similar to a Data Analyst or a Software Engineer?)

At Warby Parker, data engineers are responsible for creating and maintaining the plumbing required to support the data and reporting needs of the business. We use software engineering practices to automate the work of data cleaning, normalizing, and model building so that data is always ready to be consumed by data analysts in every department.

What languages/frameworks do you use at Warby?

On data engineering, we use Python as our general purpose programming language, as do most of the other teams in our Technology department. When it comes to databases, we use PostgreSQL for the majority of our SQL needs, and are beginning to use Amazon Athena and Google BigQuery for some of our larger datasets. We use Looker as our exclusive business intelligence entry point to all of this data.

What are some of the projects you worked on?

I’ve had the privilege of working with a lot of of smart people in every department at our company to help them solve their varied data needs, from reconciling financial data with the Accounting team to automating and modeling standardized performance metrics for our team of over 200 customer experience advisors.

As part of a team of five supporting the data needs of a rapidly growing company, I’ve tried where possible to focus on helping our analysts solve their own problems. This includes helping people learn Python and commit to our codebase, guiding the creation of data models in SQL, and encouraging people to submit pull requests to add features in Looker, our BI tool.

Seeing dozens of otherwise “non-technical” colleagues opening up PRs on a daily basis, and consequently being part of the democratization of tech that we value at Warby Parker, is probably the most rewarding “project” I’ve been a part of.

One project finished recently during our first annual “Hackweek” is called Pipes, which allows anyone at the company to easily move large amounts of data from wherever to wherever (Looker, Google Sheets, PostgreSQL, BigQuery, etc) on a regular cadence, or manually through a simple one-line chatbot interface. The adoption has been overwhelmingly positive and we’re looking to grow this sort of tooling out even more.

“We use software engineering practices to automate the work of data cleaning, normalizing, and model building so that data is always ready to be consumed by data analysts in every department.”

What got you into the data field?

I’ve always been drawn to analytical fields like math, and became pretty proficient in Excel during some internships in college. Once I had learned to program and learned more about data science and its applications in artificial intelligence, I knew that anything I could do to immerse myself in the world of data would be a step in the right direction.

Three and a half years ago, I landed a job as a junior software engineer at Warby Parker not fully knowing what I was in for, but am so glad I got the opportunity to help build tools to support an interesting and ever-changing data-driven culture here.

Where did you learn SQL and Python?

I had a background in C++, and was exposed to Python through an Intro to Data Science course. When Warby Parker hired me onto the Data team in 2015, I had never written a SQL query in my life, but picked it up quickly and within a few months started up internal SQL training classes, which I still teach on a monthly basis.

What does your tattoo say?


The ultimate cheatsheet.

This is Bayes’ Theorem, which is an equation that describes how to update probabilities given new evidence. Two summers ago I worked on building a tool to help predict weekly fantasy football performance. Some colleagues suggested a Bayesian approach would be appropriate, since there aren’t really enough data points in an NFL season to be able to use statistical approaches that require larger datasets, and I’d want to regularly update my predictions after each player’s latest performance.

I did a deep dive into understanding the (simple) math underlying Bayes’ Theorem and came out of that experience with a whole new worldview, understanding my entire knowledge of the world as a big and intricate probabilistic model that I was continuously updating with every experience I ever have. It was pretty transformative, and I figured that was worth a tattoo.

What is a concept in SQL/Python that’s essential to your work?

Donald Knuth said, “Premature optimization is the root of all evil.” I’ve generally found this to be true, and try to live by it in my work. For example, I’ll generally prefer to keep a data model simple by rebuilding it for all time on a daily basis using a single SQL query instead of making a more complicated model that requires iteratively adding to a table, keeping track of state, updated timestamps, when something last ran, etc.

A wise man once said, “Duplicating data makes things go fast,” but databases are already impressively fast to begin with, without implementing anything to improve performance. Ultimately, I almost always approach a problem thinking about optimizing for my time over machine time, for readability over performance, and for introducing as little cognitive overhead as is required by the problem at hand. Only once performance issues or readability issues present themselves will some code be worth a rewrite.

Last question! Since you wrote Warby Parker’s internal SQL training courses, I know there gotta be some inner Curriculum Developer in you. Can you teach a SQL concept in 2 minutes?

Sure! Have you ever written a query that yields some result set and you think, “I’d love to query the stuff I just produced like it was a table?” Enter the WITH clause.

Suppose I have a mega query that gives the transaction summaries:

select
    transactions.date as transaction_date,
    sum(items.price) as total_cost,
    count(*) as number_of_items
from
    transactions
inner join
    customers
    on
    customers.id = transactions.customer_id
inner join
    transaction_items
    on
    transactions.id = transaction_items.transaction_id
inner join
    items
    on
    items.id = transaction_items.item_id

Using WITH, I can create a temporary table within my query that I can SELECT from and treat it just like a regular old table.

I will put everything from the previous query in a parentheses and use WITH to give it the name transaction_summaries.

Then I’ll apply the date and customer filtering down below for a more readable query, to separate out all the JOIN logic from the actual WHERE filters that I want to apply on that data.

with transaction_summaries as (
  select
      transactions.date as transaction_date,
      sum(items.price) as total_cost,
      count(*) as number_of_items
  from
      transactions
  inner join
      customers
      on
      customers.id = transactions.customer_id
  inner join
      transaction_items
      on
      transactions.id = transaction_items.transaction_id
  inner join
      items
      on
      items.id = transaction_items.item_id
)

select 
        * 
from 
        transaction_summaries
where 
        first_name = 'beyonce'
        and 
        transaction_date > '2018–01–01'
order by 
        total_cost desc
limit 
        5

If you’re familiar with subqueries, this does a similar thing but makes the SQL far more readable, even if your query isn’t quite as performant as it would have been. This is essentially an implementation of the mantra “Don’t Repeat Yourself” that’s common in the world of programming.

Incredible. And love the SQL styling! 😍


Huge shout out to Ryan and the whole Warby Parker team for making this partnership happen. Special hat tips for behind-the-scenes support from:

  • Lon Binder, Chief Technology Officer, Warby Parker
  • Maddie Tierney, Executive Assistant, Warby Parker
  • Kayla Robbins, Executive Assistant, Warby Parker
  • Kaki Read, Senior Communications Manager, Warby Parker
  • Isabel Seely, Senior Brand Manager, Warby Parker

It’s been an absolute pleasure. And of course, the fam at Codecademy. You know who you are. Couldn’t do it without you.

Lessons from The Science of Learning in the Field

0
Lessons from The Science of Learning in the Field

Over the past few months, I have had the pleasure of working on a Science of Learning grant through the Learning Agency, funded by the Overdeck Family Foundation (see here). Through this grant, professors and researchers with expertise in the science of learning have been paired with K-12 teachers across the country. Each team is then assigned a strategy that has been shown to be effective through research, and we work together to help implement the strategy in the classroom.

I’m on a team with two middle school math teachers at Sky View Middle School in Leominster, Massachusetts, and another team with an English and Biology teacher at Douglas High School in Memphis, Tennessee. The middle school math teachers and I are working on implementing interleaving, which is the concept of switching between ideas or problems during practice. (You can learn more about interleaving here.) With the high school English and biology teachers, we’re implementing dual coding, which is the concept of combining words and visual representations. (You can learn more about dual coding here.)

I liked this idea a lot when it was originally pitched–putting together teams of researchers and teachers to bring expertise from different perspectives and knowledge bases, is just brilliant. Now that I’m actually getting to experience it myself, I am loving this project even more! Meeting up with teachers, talking about teaching practices, and getting to observe live classroom interactions has been amazing. I am learning so much, and my immense respect for K-12 teachers is only growing. In continued follow-up with the teachers, it sounds like they are enjoying the project as well and learning a lot. (Bi-directional communication for the win!)

It is probably not possible for everyone in education to do this – as much fun as we’re having, I know the logistics are complicated, time consuming, and expensive, and I definitely do not want to gloss over this part. But there are definitely common themes that I have noticed keep coming up as we all work together, and others may benefit from these.

I’ve noticed that it seems to work really well trying to implement one effective study strategy at a time. Can classroom instruction benefit from multiple evidence-based strategies? Of course, and other strategies, like adding in retrieval practice and spacing, keep coming up in the teams as we talk about the primary strategy (i.e., interleaving and dual coding). However, when many things are changed all at once, it becomes extremely difficult to figure out exactly what is working well for the classroom and what is not working as well as it could be. Complete overhauls are also very time consuming and unrealistic for most teachers, and attempting to do so may become overwhelming and lead to failure. Rather, it is best, in my opinion, to start with a few small changes that are likely to have a large impact on learning in the classroom. This way, teachers can monitor what is working well and what needs to be modified, and can continue to make small changes during each new year. Working with one strategy at a time and really learning this strategy falls in line with this method.

We also must consider the ever-present issue of time. Tackling one strategy at once, as mentioned above, does help with instructor time. But time is a big issue. It’s not just an issue of when to find the time to plan all of these extra learning strategies, but also an issue of when to find time in the classroom to add in all of these strategies! It is important to remember that these effective strategies are, in the long run, more efficient than less effective strategies. So, doing these strategies now can save a lot of time later.

Further, all of the teachers on my teams have noted that when looking at their own teaching practices they are already using the strategies in some ways. For the middle school math teachers, interleaving was already a part of some of their instruction, but now after learning more about the strategies and working on our teams the teachers can use interleaving sooner, more often, and more intentionally.

The same goes for dual coding. The high school biology teacher uses dual coding a lot, but really wants to focus on intentionally integrating the visual representation with the verbal one. The high school English teacher realized that she often uses graphic organizers to help students organize their writing. Dual coding is not just about pictures, but includes many visual representations of information. The English teacher is working on scaffolding the graphic organizers to help the students be able to create these organizers on their own when faced with a writing assignment to prepare for more independent writing. We’ve learned that it can be extremely helpful for teachers to start by looking at what they are already doing in the classroom, find where threads of the learning strategies already exist, and implement them more intentionally. (This saves on prep time, too!)

Finally, all of the teachers across the two teams have been talking about student awareness. The teachers are emphasizing the importance of making the use of the strategies clear to the students in their classrooms. Given that effective strategies lead to more difficulty than less effective strategies, it is a good idea to make the students aware of the challenge and help them embrace it. Over the next few months of the project, I hope to explore student awareness of learning strategies being used in the classroom more!

What Students Are Saying About: Leaving a Legacy, Fighting for a Cause and Looking at the Stars

0
What Students Are Saying About: Leaving a Legacy, Fighting for a Cause and Looking at the Stars

Men’s issues

Perhaps one of the most important issues, at least I believe it to be, is seen as almost taboo to talk about. I’m referring to men’s issues … Why can’t we talk about the higher suicide rate of men? Why can’t we talk about the lower life expectancy of men? Why can’t we talk about the harsher prison sentences, and unfair treatment in court for men? Why can’t we talk about the lack of father figures for men, particularly in inner cities? Why can’t we talk about the lack of representation for what actual masculinity is and should be? These issues and hundreds more are very real, and go unaddressed. Not once have I heard anyone talking about these issues in every day life. Not even by myself, because I’m too afraid to bring them up for fear of being called misogynist or sexist, or just having them rejected.

— Keegan Butler, Danvers MA

Gentrification

In my opinion, The problem that I think the people in my community should focus on the most is gentrification. Gentrification is when richer people or people of the higher class move to an area of lower class and try to make it Higher class and what it isn’t. I think this is a problem because my neighborhood is perfect the way it is (I think), but the rich people think that it needs work and that they can make it better and more fit for them because they may like the location but not the actual community. It just gets on my nerves because they think just because they have money, they can go to any neighborhood and raise the expectations of the people who own apartments and places to live so that the people who were there first will have a much harder time paying for it etc. I would take a stand on the topic of homelessness and poverty because this is also a slight problem in my neighborhood. I think that I would stand on this because I hate to see people suffer like that everywhere in the world.

— Azalea Derrickson, Masterman School,Philly

Deforestation

One issue that I think deserves more attention is deforestation as well as the destruction of any of the other few untouched places on this planet. These places are the home of many animals that would go extinct if we do not stop destroying these places. It is important to preserve areas like these because, not only do they house many amazing animals, but many of these areas, such as the Amazon Rainforest (from 2017-2018, around 3,050 square miles of the Amazon was cleared) also provide oxygen for much of our planet and, as human beings, we need oxygen to survive. These few preserved places are not only valuable because they benefit us and other creatures, but also because they have value in their own right. The forests and mountains and plains were formed by chance. They were not formed explicitly for our benefit or to satisfy our endless greed. We cannot destroy these places for lumber or oil or iron because those few filthy rich individuals at the head of the companies that benefit from this destruction want more money.

— Amalia T., Masterman, Philadelphia

Gender equality

I think gender inequality is an issue that needs more attention. I think so many people aren’t earning the credit that they deserve. People work so hard to fight inequality just to be pushed away. Gender inequality isn’t just for females. It applies to males as well. The gender stereotypes, the LGBTQ+ community, the amount of money people are paid etc. This matters to me because I am a very strong believer of equality and equal rights for everyone no matter their color, gender, race, religion or anything near those terms. This stands out for me especially because this isn’t anything that is new. This has been going on since forever. “Boys can’t like pink,” “girls should be at home washing dishes.”

— Havana C, Masterman: Philadelphia, PA

Another current issue I feel very strongly about is feminism and gender equality, meaning politically, in the workplace and in everyday life. Currently, some forms of feminism are viewed as unnecessary and are only believed to exist because “women want attention and want more power than men”. I can’t say I blame the men who do not recognize the inequalities women, specifically black, indigenous and transgender women face everyday. Most men have not felt the fear of being cat called, most men have not had to sit down with their mother and be told why they can’t go certain places with certain people. Most men do not fear for their lives when walking home alone on a certain road. Most men do not fear that when they get older, another human would put something in their drink to lure them back to their apartment. Most men do not feel the fear I feel when a man enters an empty elevator alone with them. Most men have not felt the fear of being a woman in America.

Raiin.org says, “Females ages 16-19 are 4 times more likely than the general population to be victims of rape, attempted rape, or sexual assault”. Additionally, “Of women who are raped in their lifetime: 17.9% are Caucasian,11.9% are Latina, 18.8% are African-American, 34.1% are American Indian or Alaskan Native..”. There is no wonder that young girls are fearful for what their future in our messed up, rickety and flimsy American society may hold.

— Angela Xhori, Julia R. Masterman, Philadelphia

Mental health

I think an issue that deserves more attention is mental health awareness, especially for teens. It’s frustrating that mental health is one of those things I only hear in hushed whispers. It’s frustrating that my friend’s mom thinks she can cure her with essential oils but thinks that medication will harm her. It’s frustrating when schools encourage the decline of mental health by piling on homework and telling students to get it done by any means necessary. It’s frustrating when my guidance counselor says my grades are too high for me to be depressed, and that I should just stop procrastinating. It’s frustrating when my classmates make fun of me for something I can’t control. It’s frustrating seeing all of this misinformation about mental health, and it’s sad that adults aren’t willing to do more to educate us about it.

Film Club: ‘I Am Not Untouchable. I Just Have My Period.’

0
Film Club: ‘I Am Not Untouchable. I Just Have My Period.’

How do a culture’s or society’s values and beliefs affect gender equality?

“I Am Not Untouchable. I Just Have My Period.” is a four-minute film that touches on themes of cultural beliefs and gender. It profiles teenage girls who live in Surkhet, Nepal. In small villages like Surkhet, the practice of “chhaupadi” — forbidding girls and women from participating in daily life during their periods — is common. These girls tell their “menstruation stories” in an effort to speak out against the cultural practice and end the stigma against menstruation, both for themselves and future generations.

Students

1. Watch the short film above. While you watch, you might take notes using our Film Club Double-Entry Journal (PDF) to help you remember specific moments.

2. After watching, think about these questions:

• What moments in this film stood out for you? Why?

• Were there any surprises? Anything that challenged what you know — or thought you knew?

• What messages, emotions or ideas will you take away from this film? Why?

• What questions do you still have?

3. An additional challenge: What connections can you make between this film and your own life or experience? Why? Does this film remind you of anything else you’ve read or seen? If so, how and why?

4. Next, join the conversation by clicking on the comment button and posting in the box that opens on the right. (Students 13 and older are invited to comment, although teachers of younger students are welcome to post what their students have to say.)

5. After you have posted, try reading back to see what others have said, then respond to someone else by posting another comment. Use the “Reply” button or the @ symbol to address that student directly.

6. To learn more, read “I Am Not Untouchable. I Just Have My Period.” Cheryl Strayed writes:

The first time I heard the word “chhaupadi,” I was standing on a rooftop in Surkhet, Nepal, in November 2017, surrounded by teenage girls. They were students at the Kopila Valley School, where my husband, Brian Lindstrom, and I had spent the previous week leading workshops in writing and filmmaking, which led to our video Op-Ed above. Some of the girls had asked to meet with us after school to talk about their lives; we’d barely finished with introductions when one tearfully told us that she’d been banished from her home and made to sleep in a cow shed when she began menstruating. This is the way it was for many girls and women in Nepal, we learned, as the other girls told us their stories.

_________

More?

• See all the films in this series.

• Read our list of practical teaching ideas, along with responses from students and teachers, for how you can use these documentaries in the classroom.

• Our next Film Club will take place on Thursday, April 4.

What’s Going On in This Graph? | April 3, 2019

0
What’s Going On in This Graph? | April 3, 2019

1. This graph shows the average date of the “first leaf” appearance — a sign that spring has sprung. The graph originally appeared elsewhere on NYTimes.com. On the afternoon of Thursday, April 4, we will provide additional background about the graph as well as relevant statistical concepts.

After looking closely at the graph above, think about these three questions:

• What do you notice?
• What do you wonder?
What are you curious about that comes from what you notice in the graph?
• What might be going on in this graph?
Write a catchy headline that captures the graph’s main idea. If your headline makes a claim, tell us what you noticed that supports your claim.

The questions are intended to build on one another, so try to answer them in order. Start with “I notice,” then “I wonder,” and end with “The story this graph is telling is ….” and a catchy headline.

2. Next, join the conversation by clicking on the comment button and posting in the box that opens on the right. (Students 13 and older are invited to comment, although teachers of younger students are welcome to post what their students have to say.)

3. After you have posted, read what others have said, then respond to someone else by posting a comment. Use the “Reply” button or the @ symbol to address that student directly.

On Wednesday our collaborator, the American Statistical Association, will facilitate this discussion from 9 a.m. to 2 p.m. Eastern Time to help students’ understanding go deeper. You might use their responses as models for your own.

4. On Thursday afternoon, we will reveal more information about the graph at the bottom of this post. Students, we encourage you to post an additional comment after reading the reveal. How does the original New York Times article and the moderators’ comments help you see the graph differently? Try to incorporate the statistical terms defined in the Stat Nuggets in your response.

_________

• Read our introductory post, which includes information about using the “Notice and Wonder” teaching strategy.
• Learn about how and why other teachers are using this feature, and use the 2018-19 “What’s Going On in This Graph?” calendar to plan ahead for the 25 Wednesday releases.
• Go to the A.S.A. K-12 website, which includes This is Statistics, resources, professional development, student competitions, curriculum, courses and careers.

Learning With: ‘Purdue Pharma and Sacklers Reach $270 Million Settlement in Opioid Lawsuit’

0
Learning With: ‘Purdue Pharma and Sacklers Reach $270 Million Settlement in Opioid Lawsuit’

3. Why has Purdue Pharma been painted as the arch-villain of the opioid disaster, according to the article? What evidence is there that Purdue Pharma misled doctors and the public about the dangers of OxyContin?

4. How has the opioid crisis affected Oklahoma? Which example cited in the article do you find most significant?

5. Why is Purdue Pharma considering declaring bankruptcy? How many other lawsuits does the company face?

6. Where will the lawsuit settlement money be disbursed? How will the money help to address opioid addiction?

Finally, tell us more about what you think:

— What is your reaction to the article? Do you think the makers of OxyContin are responsible for the use and misuse of their product? Who do you think is responsible for the opioid epidemic? Doctors? Advertisers? Pharmacies? Distributors? The Food and Drug Administration? Consumers? How would you assign responsibility?

— What connections do you see between the Purdue Pharma settlement and other lawsuits against companies like gun manufacturers and cigarette makers? Are there any dangers in allowing lawsuits against companies, particularly pharmaceutical companies, for the products they make?

— How do we balance the medicinal benefits of painkillers with their highly addictive nature and with the death and devastation caused by their misuse and abuse? For example, the Democratic presidential candidate Kirsten Gillibrand recently proposed legislation to limit the supply of initial opioid prescriptions for acute pain to seven days, but the proposal was quickly criticized as infringing upon doctors’ ability to make case-by-case medical decisions.

— In a related article, “Museums Cut Ties With Sacklers as Outrage Over Opioid Crisis Grows,” Alex Marshall writes:

In a remarkable rebuke to one of the world’s most prominent philanthropic dynasties, the prestigious Tate museums in London and the Solomon R. Guggenheim in New York, where a Sackler sat on the board for many years, decided in the last week that they would no longer accept gifts from their longtime Sackler benefactors. Britain’s National Portrait Gallery announced it had jointly decided with the Sackler Trust to cancel a planned $1.3 million donation, and an article in The Art Newspaper disclosed that a museum in South London had returned a family donation last year.

The Tate’s statement noted the family’s “historic philanthropy,” then added: “However, in the present circumstances we do not think it right to seek or accept further donations from the Sacklers.”

What do you think of the decision by several museums to no longer accept donations from the Sackler family? Do you think other museums and other institutions doing business with the Sackler family should do so as well?

Hanging With Friends

0
Hanging With Friends

What story could this image tell?

Use your imagination to write the opening of a short story, poem or memoir inspired by this photo.

Post it in the comments, then read the related article to find out what this image is all about.

Find many more ways to use our Picture Prompt feature in this lesson plan.

8 Most Common English Grammar Mistakes We Make

0
8 Most Common English Grammar Mistakes We Make

Mar 20, 2019

When it comes to language, it’s easy to make English grammar mistakes, even as native speakers. Here are the 8 most commonly made errors to watch out for.

1. The Missing Comma

A comma is used after an introductory word, phrase, or clause. This gives a pause after the introductory element and delivers the message without confusion. Example: In case you didn’t know, I’m on leave next week.

 

2. The Apostrophe Catastrophe

Use “It’s” when the word means “It is” or “It has”. Example: I don’t believe it’s been a week! Use “Its” when something is belonging to it. Example: The pillow looks great with its new cover.

 

3. The Four W’s

Now that’s tricky. Let’s break it down, shall we? “Who” is used to identify a living pronoun. Example: Who baked this cake? “Whom” is used to describe someone on the receiving end of an action. Example: Whom did we hire for the position? “Whose” is used to assign ownership to someone. Example: Whose jacket is this? “Who’s” is the contraction of “Who is” or “Who has”.

 

4. Two Dots Don’t Make a Right

A colon is used after a complete sentence to introduce a word, phrase, clause, list or a quotation. It’s used to signal that what follows next will prove or explain the former statement. Example: There’s an increase in the number of people taking up online courses for three reasons: learning from the comfort of their home, increase their knowledge and skills at their own pace, boosts their résumé.

 

5. Fewer vs Less – What’s The Difference?

They are both the opposite for “more”, but the usage is different. Use “Fewer” when the items are countable like books, cars, pens, etc. Example: There are fewer cars in the parking area. Use “Less” when the items are not countable like sand, love, time, etc. Example: This glass has less water.

 

6. A Lot Of “Alot” Mistakes!

A lot of people use “Alot” (pun intended), but “Alot” is not a word! Yes, you heard it right. If you want to describe a vast number of things, use “A Lot”. Example: I have a lot of things to do. If you allocate or keep a certain portion for something, then you use “allot”. Example: I allot two hours a day for learning.

 

7. The Spelling Slip-Up

They sound exactly the same, but they have very different meaning. “Compliment” is a polite expression of praise or admiration. “Complement” is something that contributes extra features or improves something.

 

8. The Semicolon Stumble

A semicolon connects two independent clauses. The two clauses make sense on their own, but if they’re interrelated, you use a semicolon to connect them. Example: Call me tomorrow; I’ll let you know by then.

 

Ask a Data Engineer: Warby Parker Edition 👓

0
Ask a Data Engineer: Warby Parker Edition 👓

wp-header

Codecademy’s very own Nick Duckwiler (left) and Ryan Tuck from Warby Parker (right) in our office. (📷: Mitch Boyer)

Last month, Codecademy and Warby Parker came together to work on a special Learn SQL from Scratch Capstone Project. It was during this time when I met Ryan Tuck, a Data Engineer at Warby, who played a major part in this partnership. So when he decided to drop by our office for the final QA round, I had to break out my notebook and ask some questions. Enjoy.


Hey Ryan, let’s start off with a question I’ve had for a while — what is a Data Engineer? (Is it similar to a Data Analyst or a Software Engineer?)

At Warby Parker, data engineers are responsible for creating and maintaining the plumbing required to support the data and reporting needs of the business. We use software engineering practices to automate the work of data cleaning, normalizing, and model building so that data is always ready to be consumed by data analysts in every department.

What languages/frameworks do you use at Warby?

On data engineering, we use Python as our general purpose programming language, as do most of the other teams in our Technology department. When it comes to databases, we use PostgreSQL for the majority of our SQL needs, and are beginning to use Amazon Athena and Google BigQuery for some of our larger datasets. We use Looker as our exclusive business intelligence entry point to all of this data.

What are some of the projects you worked on?

I’ve had the privilege of working with a lot of of smart people in every department at our company to help them solve their varied data needs, from reconciling financial data with the Accounting team to automating and modeling standardized performance metrics for our team of over 200 customer experience advisors.

As part of a team of five supporting the data needs of a rapidly growing company, I’ve tried where possible to focus on helping our analysts solve their own problems. This includes helping people learn Python and commit to our codebase, guiding the creation of data models in SQL, and encouraging people to submit pull requests to add features in Looker, our BI tool.

Seeing dozens of otherwise “non-technical” colleagues opening up PRs on a daily basis, and consequently being part of the democratization of tech that we value at Warby Parker, is probably the most rewarding “project” I’ve been a part of.

One project finished recently during our first annual “Hackweek” is called Pipes, which allows anyone at the company to easily move large amounts of data from wherever to wherever (Looker, Google Sheets, PostgreSQL, BigQuery, etc) on a regular cadence, or manually through a simple one-line chatbot interface. The adoption has been overwhelmingly positive and we’re looking to grow this sort of tooling out even more.

“We use software engineering practices to automate the work of data cleaning, normalizing, and model building so that data is always ready to be consumed by data analysts in every department.”

What got you into the data field?

I’ve always been drawn to analytical fields like math, and became pretty proficient in Excel during some internships in college. Once I had learned to program and learned more about data science and its applications in artificial intelligence, I knew that anything I could do to immerse myself in the world of data would be a step in the right direction.

Three and a half years ago, I landed a job as a junior software engineer at Warby Parker not fully knowing what I was in for, but am so glad I got the opportunity to help build tools to support an interesting and ever-changing data-driven culture here.

Where did you learn SQL and Python?

I had a background in C++, and was exposed to Python through an Intro to Data Science course. When Warby Parker hired me onto the Data team in 2015, I had never written a SQL query in my life, but picked it up quickly and within a few months started up internal SQL training classes, which I still teach on a monthly basis.

What does your tattoo say?


The ultimate cheatsheet.

This is Bayes’ Theorem, which is an equation that describes how to update probabilities given new evidence. Two summers ago I worked on building a tool to help predict weekly fantasy football performance. Some colleagues suggested a Bayesian approach would be appropriate, since there aren’t really enough data points in an NFL season to be able to use statistical approaches that require larger datasets, and I’d want to regularly update my predictions after each player’s latest performance.

I did a deep dive into understanding the (simple) math underlying Bayes’ Theorem and came out of that experience with a whole new worldview, understanding my entire knowledge of the world as a big and intricate probabilistic model that I was continuously updating with every experience I ever have. It was pretty transformative, and I figured that was worth a tattoo.

What is a concept in SQL/Python that’s essential to your work?

Donald Knuth said, “Premature optimization is the root of all evil.” I’ve generally found this to be true, and try to live by it in my work. For example, I’ll generally prefer to keep a data model simple by rebuilding it for all time on a daily basis using a single SQL query instead of making a more complicated model that requires iteratively adding to a table, keeping track of state, updated timestamps, when something last ran, etc.

A wise man once said, “Duplicating data makes things go fast,” but databases are already impressively fast to begin with, without implementing anything to improve performance. Ultimately, I almost always approach a problem thinking about optimizing for my time over machine time, for readability over performance, and for introducing as little cognitive overhead as is required by the problem at hand. Only once performance issues or readability issues present themselves will some code be worth a rewrite.

Last question! Since you wrote Warby Parker’s internal SQL training courses, I know there gotta be some inner Curriculum Developer in you. Can you teach a SQL concept in 2 minutes?

Sure! Have you ever written a query that yields some result set and you think, “I’d love to query the stuff I just produced like it was a table?” Enter the WITH clause.

Suppose I have a mega query that gives the transaction summaries:

select
    transactions.date as transaction_date,
    sum(items.price) as total_cost,
    count(*) as number_of_items
from
    transactions
inner join
    customers
    on
    customers.id = transactions.customer_id
inner join
    transaction_items
    on
    transactions.id = transaction_items.transaction_id
inner join
    items
    on
    items.id = transaction_items.item_id

Using WITH, I can create a temporary table within my query that I can SELECT from and treat it just like a regular old table.

I will put everything from the previous query in a parentheses and use WITH to give it the name transaction_summaries.

Then I’ll apply the date and customer filtering down below for a more readable query, to separate out all the JOIN logic from the actual WHERE filters that I want to apply on that data.

with transaction_summaries as (
  select
      transactions.date as transaction_date,
      sum(items.price) as total_cost,
      count(*) as number_of_items
  from
      transactions
  inner join
      customers
      on
      customers.id = transactions.customer_id
  inner join
      transaction_items
      on
      transactions.id = transaction_items.transaction_id
  inner join
      items
      on
      items.id = transaction_items.item_id
)

select 
        * 
from 
        transaction_summaries
where 
        first_name = 'beyonce'
        and 
        transaction_date > '2018–01–01'
order by 
        total_cost desc
limit 
        5

If you’re familiar with subqueries, this does a similar thing but makes the SQL far more readable, even if your query isn’t quite as performant as it would have been. This is essentially an implementation of the mantra “Don’t Repeat Yourself” that’s common in the world of programming.

Incredible. And love the SQL styling! 😍


Huge shout out to Ryan and the whole Warby Parker team for making this partnership happen. Special hat tips for behind-the-scenes support from:

  • Lon Binder, Chief Technology Officer, Warby Parker
  • Maddie Tierney, Executive Assistant, Warby Parker
  • Kayla Robbins, Executive Assistant, Warby Parker
  • Kaki Read, Senior Communications Manager, Warby Parker
  • Isabel Seely, Senior Brand Manager, Warby Parker

It’s been an absolute pleasure. And of course, the fam at Codecademy. You know who you are. Couldn’t do it without you.

Word + Quiz: contretemps

0
Word + Quiz: contretemps

1. an awkward clash

2. unexpected and unfortunate occurrence

_________

The word contretemps has appeared in 17 articles on NYTimes.com in the past year, including on Jan. 4 in “F.D.A. Accuses Juul and Altria of Backing Off Plan to Stop Youth Vaping” by Sheila Kaplan:

WASHINGTON — The Food and Drug Administration is accusing Juul and Altria of reneging on promises they made to the government to keep e-cigarettes away from minors.

Dr. Scott Gottlieb, the agency’s commissioner, is drafting letters to both companies that will criticize them for publicly pledging to remove nicotine flavor pods from store shelves, while secretly negotiating a financial partnership that seems to do the opposite. He plans to summon top executives of the companies to F.D.A. headquarters to explain how they will stick to their agreements given their new arrangement.

… The contretemps with the F.D.A. is only the latest headache in Washington for Juul, a company that has had much more success capturing market share in an emerging industry than in navigating the government scrutiny that comes with it.

_________