Learning objectives

This lab has two separate parts. In the first, we'll continue with the dashboard example from lecture, auditing whether it behaves correctly. In the second, we'll get a head start on the data structure design for the assignment that goes out on Friday.

This lab will:

Setup

Part 1Reviewing the dashboard

The dashboard from lecture has changed slightly. It now has two charts and two actual quiz questions under the charts (rather than just a submit button). The second chart shows the percent of responses correct for each concept in a quiz course.

We'll start by having you download the dashboard code and get it running on your computer.

Dashboard Setup

Overview of Files

Inside the folder, you'll find the following files:

Task 1

You need to assess whether and how the dashboard is working. First things first, look at the new chart and develop a hypothesis for what it does. Then, submit quiz responses to make sure that the charts change the way you expect. These are a form of test case (you think through the expected impact before running the test, rather than writing an assert statement).

Summarize your findings in your worksheet.

Task 2

For each issue that you found, look through the various .py files and try to identify which parts of the code are responsible. Note them in your worksheet.

Task 3

More generally, look at the .py files (except for app.py) and critique what you see, using the questions in the worksheet as a guide. Write your answers in the worksheet.

Checkpoint

Show a TA your experiments, findings, and analysis.

Task 4

If you still have time in this segment of lab, work with Claude to try to fix the program. Tell it what problems you noticed and what results you expected to see instead. Each time Claude claims to have fixed the program, restart the page and check whether the issue has been fixed.

Make observations in your worksheet as you go.

Part 2Preparing a Bikeshare Dashboard

For your next homework assignment, you will be creating a dashboard to help the operations manager at a Bikeshare company. Each evening, the operations manager has to decide where bikes need to be moved overnight so that there are enough bikes in place for the rides expected on the next day. The company has enough trucks to make 15-20 moves per evening. The dashboard needs to help the manager decide which moves to make.

In this half of lab, you'll get a head start on designing the data structures you need and getting familiar with the dataset that you'll be working with. The assignment uses real data from Bluebikes, Boston's bike share program.

Prioritizing Moves

There are many metrics one could use in deciding how to move bikes around overnight. For now, the manager wants to look at the net flow of a station. This is the number of bikes that arrived throughout the day minus the number that left. A positive net flow means bikes pile up, so the company should remove some of them; a negative one means the company should deliver additional bikes there.

In planning this dashboard, you'll need to figure out how to compute the net flow of each station, and how to sort stations based on their net flow.

Get Familiar with the Bluebikes Data

Make a folder called bikeshare inside your lab folder, download starter.zip and unzip it there.

Open lab-trips.csv and lab-stations.csv, which you just unzipped. They are a tiny made-up sample of trips among four real Bluebikes stations, small enough to check by hand. (On the homework, you will get real data covering a day, a week, and a month.)

Task 5

Spend a few minutes looking at the sample data. What do you notice about it? How do the two files relate? Make notes in your worksheet about what you expect to have to do in order to prepare this data for use in creating the dashboard.

Task 6

Now, identify the data structures (lists, dataclasses, dictionaries) that you will want to have in order to compute a set of nightly moves based on the net flow. Keep in mind that you do not have to keep the data in the tables as provided in the csv files -- you get to decide which datastructures you want; part of your work on the assignment will involve extracting or converting the data you get from Bluebikes into the form that you'll need to generate content for the dashboard.

Checkpoint

Show a TA your data structure choice.

Task 7

Compare notes with another student or pair who has reached this point in the assignment. Use this feedback to make your final decision about the data structures you will need.

Task 8

If you get this far and still have time, you could work with Claude to develop the code to convert the csv data to your chosen data structure. You'll get the rest of the requirements for this assignment in the handout that releases on Friday.