As stated in the course description:
Over the semester, students will build a complex end-to-end data system.
You'll be building a live dashboard, with all the infrastructure behind it:
- Automated data ingestion
- A database
- Web-based interactive data visualization
Data flow:
API -> Python script -> BigQuery -> Streamlit app (on the internet) -> visualization
All of this will be in the cloud.
- Center for Disease Control (CDC) dashboards
- Chicago Region Transit Dashboard
- Chicago Transit Authority Historical Bus Crowding
- Colorado Behavioral Health Administration (BHA) Performance Hub
- Congestion Pricing Tracker
- Darkhorse Visualizations
- Gapminder
- Inside Airbnb
- MTA
- New York Flu Tracker
- New York Traffic Data Viewer (TDV)
- NYC Population FactFinder
- NYPD TrafficStat
- Tax Wrapped
- TransitMatters
- United States of Health
- Pair program as much as possible.
- All code is peer-reviewed through pull requests.
- All team members are contributing equal amounts.
- The Project leverages at least one dataset that's regularly updated.
- The code, documentation, and repository are clean, following good coding style and other best practices.
- Create dashboard(s) that explore relationships between variables.
- It should be more open-ended than Projects from Computing in Context, allowing users to explore.
- The site doesn't need to read like a blog post necessarily, but it should explain what's going on.
- It should layer several sources/dimensions of data to add depth and context (e.g. location, weather, demographics).
- It should have multiple visualizations that work together.
- The idea is that it should make it easy for someone (maybe a policymaker or other decision maker) to spot meaningful patterns or insights.
- The site + codebase should be a polished portfolio piece.
- Data is being automatically updated.
See the grouping by team_id. The teams have a corresponding repository and Google Cloud Project automatically created.
Your group will pick an initial:
- Problem space
- Dataset
Part of this project is getting experience with automated data ingestion. Doing so is more interesting with data that changes regularly. You can incorporate additional datasets in the future.
Do the following as a group:
- Discuss what you'd like your project to focus on.
- Don't need to get too specific yet.
- This doesn't lock you in.
- Explore datasets that are updated weekly (the more often, the better) and pick one that could be relevant.
- You can pick multiple, but start simple.
- Create a new notebook in your team repository.
- In the notebook, load and display the data from all your data sources.
- If there's an API, use the API.
- Draw one (or more) example visualizations that you'd like to produce.
- Have at least one be a time series.
- You can do so digitally or on a piece of paper.
- Include a title, legend, and axes labels (where appropriate).
- This is just a sketch; don't worry about the specific values.
You will then submit the following to the Discussion on Ed:
- What dataset are you going to use?
- Please include a link.
What are your research question(s)What questions should your users be able to answer by using your app?- Come up with at least three.
- Go deep, not broad.
- What's the link to your notebook?
- What's your target visualization?
- Include a picture.
- What are your known unknowns?
- What challenges do you anticipate?
Only one person from your group needs to submit. None of this is set in stone long term, it is just a starting place. It can all be changed later.
Goal: Get experience with an application development framework
-
Using your dataset from Part 1:
- Create a Streamlit app.
- Deploy to the Streamlit Community Cloud.
- Add a visualization.
- You can get fancy, but don't have to at this stage. Get something simple working first.
-
Bring in a second relevant dataset. (This one doesn't need to be regularly updated.)
- This can be shown on a separate page of your Streamlit app, or combined in a single visualization.
-
Add the names of the people on your team to your Streamlit app homepage.
-
Set the repository
Websiteto the app URL (https://<something>.streamlit.app/). -
Turn in the link to your live app via CourseWorks.
- You can load data:
- from a URL (preferred), either:
- An API
- A link to a CSV
- from a file, checked into the repository
- from a URL (preferred), either:
- Note the Streamlit app resource limits.
- At this stage, feel free to make the dataset small to get it working.
- If the app is slow to reload, experiment with caching.
Goal: Get experience with unit testing
Work on branches and submit pull requests for the chunks of work — you decide what the "chunks" are.
- Without writing any code:
- Review your existing code.
- What can be refactored into functions?
- Where can we make our code DRY?
- Decide what function you're going to create.
- Come up with test cases (inputs) and expected outputs.
- This can be in a text file, doc, piece of paper, etc.
- Review your existing code.
- Then, as code:
- Write tests.
- Confirm they fail.
- Refactor your code into the function.
- Make the tests pass.
- Repeat until you feel your code is well-organized and well-tested.
- Submit the links to the pull requests via CourseWorks.
As a result, your:
- "main" scripts (for Streamlit pages or otherwise)
- Functions
should be relatively short and easy to read.
This isn't a one-time thing; continue testing and refactoring as you continue with the Project.
You will hold a team retrospective, with the goal of improving how your team works together. Since the groups are small, it can be fairly informal.
- Schedule 45 minutes for the retro.
- The retro needs to be done live/synchronous, not asynchronous.
- Read about retros.
- Decide who will be the Facilitator.
- Optional: Get someone from outside the team.
- Facilitator: Set up EasyRetro. Instructions.
- In the actual retro:
- Read the Agile Prime Directive out loud.
- 5 minutes: Individually write down "what went well" and "what could be better".
- 10-15 minutes: Discuss what has gone well.
- 20-25 minutes: Discuss what could be better.
- 5 minutes: Document takeaways / action items.
- Move your Proposal to the Streamlit app as is.
- Revisit the Proposal.
- Any new insights?
- Anything you want to adjust?
- Document any changes to the Proposal on the Streamlit page.
- Proceed with enhancing the app.
- If the majority of your code (to call APIs, etc.) is in modules/functions, it can be
imported from a Jupyter notebook. You can do exploratory analysis there, moving things to modules/Streamlit as you go. - You might not be able to fully answer the question(s) yet, but get as close as you can.
- If the majority of your code (to call APIs, etc.) is in modules/functions, it can be
At this point, your project should be looking more like one of the examples. Looking through the Streamlit data elements may be helpful.
Submit links to:
- The EasyRetro board
- Jupyter notebook(s), if any
- The (updated) Streamlit app
Goal: Understand how to work with a cloud-based database
- A service account has been created in your Project for you. It has been given read-only access to BigQuery.
- There are various things that can go wrong in these steps. Don't wait until the last minute.
Do the following for your regularly-updated data source. Only do one for now — we'll do the rest in Lab 10.
- Install pandas-gbq.
- Load data.
- Create a Python script that:
- Creates the table, if it doesn't exist
- Pulls data from your data source
- Copies the data to BigQuery using the appropriate technique
- Since you'll be running the script locally, authenticate with a user account.
- How to write tables with pandas-gbq
- How will you know it worked as intended?
- Create a Python script that:
- Have your app use BigQuery.
- Each team member will need to:
- Create a service account key as JSON. The service account is
streamlit@[project].iam.gserviceaccount.com. - Set up secrets management locally.
- Make sure to add
secrets.tomlto your.gitignoreso that you don't accidentally commit it to Git.
- Make sure to add
- Copy the key information to your
secrets.tomlfile.
- Create a service account key as JSON. The service account is
- Modify your app to read data from BigQuery.
- Copy the secrets to your deployed app.
- Re-deploy.
- Each team member will need to:
- Submit the links via CourseWorks for:
- The pull request(s)
- The link to your live Streamlit app
- We'll do this once now, once at the end.
- This will be factored into an individual score.
Goal: Your regularly-updated data is being pulled in automatically.
Make a workflow that runs on a schedule to run your ETL. Check out the workflows in this repository as examples you can start with.
- How will you know if it worked?
- If something went wrong, where would you look to find out why?
There's an extra step
GitHub Actions will need credentials + permissions to write to BigQuery.How to do it
- Create a service account in Google Cloud.
- Grant it the appropriate role.
- Create a key as JSON.
- Add it to GitHub Actions as a secret.
- To test out the workflow, you can:
- Make the schedule more frequent
- Set it to
push - Run it manually
- Advanced: Run it locally
- To protect yourself in case your data gets messed up:
- Set up table snapshots.
- Make separate test and production datasets/tables in BigQuery.
Submit links via CourseWorks for:
- Your pull request(s)
- A successful run of the GitHub Action
Goal: Determine and prioritize TODOs
You'll do this prioritization exercise as a group.
- This must be done synchronously.
- Look back at the expectations.
- The Prep can be done in the meeting itself.
- You can use paper/stickies or a digital template like Miro's
Submit a photo/link to the matrix via CourseWorks.
Goal: Meet the expectations
Do tasks you came up with in the prioritization exercise in order of priority.
Goal: Force clarity of the project and code by having to show and explain them to others
Each group will do a presentation on their Project in class.
- 10-ish minutes to present, 3-ish minutes for Q&A
- Slides optional
- Everyone in the group should speak.
- Explain the initial proposal and how it's evolved.
- Show the live app.
- Walk through the code.
- You're giving a tour of what's unique about your system.
- You don't need to explain every line.
- For example, you might say things like:
- "We have our files organized as …"
- "In this function, we're …"
- "To improve performance, we changed this part to …"
- Talk through what you learned in doing the Project.
Students will fill out the feedback form for all the presentations they observe.
Goal: Narratively document your Project
While the presentation shows your Project to the other students, we also want a writeup that you can show off to potential employers, etc.
- Each team member: Write a few paragraphs.
- This can be (in order of preference):
- A page on the portfolio site you set up in Computing in Context
- A page on a separate personal site
- A LinkedIn post
- A Google Doc
- The content can be very similar to the presentation.
- While each team member's writeup will be similar, it should be in your own words.
- You're welcome to write in whatever language you prefer.
- Include screenshots of the live app, in case the live one goes down.
- This can be (in order of preference):
- Link to those blog posts from the Project site/README.
Submit a link to the page via CourseWorks.
Final check-in
Goal: Give the instructors a sense of how the teamwork went
