13 Week 13

  • Dates: 11/15/2021 - 11/21/2021

13.1 Lectures

Topic Video Mirror Notes
12.1 Web App with Dash [ClassTranscribe] [YouTube] [Dash Documentation]
12.2 Interactivity - Call Back in Dash [ClassTranscribe] [YouTube] [Callback Documentation]
12.3 Web App Example [ClassTranscribe] [YouTube] No notes

13.2 Discussion/Lab

  • No lab

13.3 Homework

  • No homework

13.4 Deadlines

  • No deadline this week.

13.5 Final Project

13.5.1 Goals

There are several goals for this project:

  • Practice reading package documentation and examples.
  • Data manipulation and aggregation with pandas.
  • Plotting with plotly.
  • Developing interactive web-app with Dash.

13.5.2 Deadline

  • Project option #2 (your choice of dataset) dataset approval request deadline only applied to students who choose option #2: 11:59 PM Tuesday 12/07/2021.
  • Project due date: 11:59 PM Tuesday 12/14/2021.
    • Late submissions are accepted until 11:59 PM Wednesday 12/15/2021 with 20% penalty.

13.5.3 Datasets

13.5.3.1 COVID-19 Vaccinations in the United States, Jurisdiction

  • This dataset contains the overall US COVID-19 vaccine deliveries and administration data at a national and jurisdiction level.
  • Source: Centers for Disease Control and Prevention
  • Description: here
  • Detailed explanation for each variable: here
  • Download instructions: see images below.

Step 1:

Step 2:

13.5.3.2 COVID-19 Vaccinations in the United States, County

  • This dataset contains the overall US COVID-19 vaccine administration and vaccine equity data at a county level.
  • Source: Centers for Disease Control and Prevention
  • Description: here
  • Detailed explanation for each variable: here
  • Download instructions: same steps as shown in the images above.

13.5.3.3 United States COVID-19 County Level of Community Transmission as Originally Posted

  • This dataset contains the community transmission levels for all available counties..
  • Source: Centers for Disease Control and Prevention
  • Description: here
  • Download instructions: same steps as shown in the images above.

13.5.3.4 Notes

  • These datasets are updated daily. Your project will be run with the most updated csv files at the time of grading (which means they will have more data than the ones you used to build your app, but they will have the exact same number of columns and data format).
  • You should test your app with multiple versions of these three datasets.

13.5.4 Project Options

13.5.4.1 US COVID-19 Data Tracker

  • Basic structure of your web app will look like this:
  • There are 4 graphs:
    • Graph 1: a US map with each state colored by the vaccination percentage. An example of this plot is the first plot in this article.
      • There are 2 inputs for this graph: whether the vaccination percentage is for fully vaccinated or at least 1 dose (input 1), and a slider for the vaccine data up to that date (input 2).
    • Graph 2: a state map with each county colored by the vaccination percentage. An example of this plot is provided in the CDC’s COVID-19 Integrated County View.
      • There are 3 inputs for this graph: the selected state (input 3), whether the vaccination percentage is for fully vaccinated or at least 1 dose (input 5), and a slider for the vaccine data up to that date (input 6).

Below is a graph for the state of Illinois’ fully vaccinated percentage:

  • Graph 3: a time series chart for the daily positive test result percentage (7-day moving averages) in the selected county. An example of this plot is provided in the CDC’s COVID-19 Integrated County View.
    • There are 3 inputs for this graph: the selected state (input 3), the selected county (input 4), and a range slider to select the start and end date (input 7).

Below is a graph for the Champaign county’s daily positive percentage (Illinois):

  • Graph 4: a time series chart for the daily number of new cases per 100K (7-day moving averages) in the selected county. An example of this plot is provided in the CDC’s COVID-19 Integrated County View.
    • There are 3 inputs for this graph: the selected state (input 3), the selected county (input 4), and a range slider to select the start and end date (input 7).

Below is a graph for the Champaign county’s daily number of new cases per 100K (Illinois):

  • Notes:
    • Options for Input 4 (county dropdown menu) must be dependent on the selected value for Input 3 (state dropdown menu).
    • Input 6 (slider for graph 2) must be dependent on the selected value for Input 3 (state dropdown menu).
    • Input 7 (range slider for graph 3 and 4) must be dependent on the selected value for Input 3 (state dropdown menu) and Input 4 (county dropdown menu).

13.5.4.2 Your dataset of choice

  • Please note that the dataset you choose have to be approved by the instructor before you start working on your web app!
  • The deadline for submitting a dataset approval request is 11:59 PM Tuesday 12/07/2021. After that, all requests will be denied.
  • To submit a dataset for approval, you need to send an email to the instructor with the following information:
    • Dataset name, source, and link.
      • Your dataset must have at least 20,000 rows and 10 columns.
      • If select multiple datasets to merge together, at least one of those must have at least 5000 rows and 5 columns.
    • Your idea of the web app.
      • There must be at least 3 different types of graphs.
      • There must be at least 3 different input types (dropbox menu, radio buttons, slider, checkbox, etc.)
      • There must be at least 4 inputs. Of those, at least 1 is dependent on another input (chained callback is needed).

13.5.5 Resources

13.5.5.1 Map Plots

13.5.5.2 Help from Course Staff

  • This is an individual project. You are graded on your work alone. That means there are restrictions on what course staff is allowed to help you with.
  • Here are examples of things course staff is allowed to do:
    • Point you to the documentation for various types of plots needed for this project.
    • Help you installing libraries needed for your plots.
    • Provide basic examples on how to build a Dash web app (basic callback, chained callback, different types of inputs, etc.).
    • Explain what the error message means and hints on how to fix the error (not actually fixing the error).
    • Etc.
  • Here are examples of things course staff is NOT allowed to do:
    • Work on your code (whether it’s helping you to just make your plot prettier or debug error).
    • Tell you which dataset you need for which plot.
    • Tell you which exact type of plot (plotting function) you should use for each of the required plots.
    • Tell you whether you will get full marks on your app/report/etc. (this is called grading, which will be done only after the deadline).
    • Etc.

13.5.6 Project Report

  • The report must be written using Jupyter Notebook and rendered into a .html file.
    • You can do this by clicking Files -> Download as -> HTML (.html).
  • Reports should be “approximately” 2 pages (with the default font size and line spacing) of text at most.
  • The report must have a title and the full name of the author.
  • Pay attention to grammar, spelling, formatting, etc. This is designed to provide practice for the real world, where you would provide reports to clients or to your boss. Use professional language, provide references, write paragraphs of complete sentences, etc.

There should be 4 sections in the report:

  • Section 1: Dataset description
  • Section 2: Question of interest (What is the goal of your web app)
  • Section 3: Testing of the web app (Explain how you test your web app and demonstrate with at least 1 example by using screenshots of the app)
  • Section 4: Conclusion & discussion (What did you do well? What could be improved? If someone is to continue working on your project, what should they tackle next?)

13.5.7 Grading Rubric

The total points for the project is 100. There are broken down by task:

  • The web app: 60 points
    • [10] Does the web app run when running python app.py?
    • [10] Are user’s input boxes/dropdowns/selections working as expected?
    • [20] Are the graphs selected satisfying the project requirements?
    • [10] Are the graphs clearly labeled with title and axis labels, colors, legends, etc.?
    • [10] Does the web app throw error(s) when changing input values?
  • Project report: 25 points
    • [5] Is the dataset clearly explained? Are all the variables listed and described?
    • [5] Is the question of interest clearly stated?
    • [5] Is the method of testing clearly stated and explained?
    • [5] Is there at least 1 example of the testing of the app?
    • [5] Is it clear how the conclusion and discussion relate to the goal outlined in question of interest?
  • Project report format: 15 points
    • [5] Are both the html file and the Jupyter Notebook submitted?
    • [5] Does the report have a title and clear section headings?
    • [5] Is the text free of spelling errors?

13.5.8 Submissions

  • You must name the Python file containing your web app as app.py.
  • ZIP all of the following files:
    • app.py file containing the web app
    • The Jupyter Notebook .ipynb file
    • The rendered .html file
  • DO NOT include the .csv files in your submission.
  • Name the .zip file as final.zip. You must name it exactly like that.
  • Submit the .zip file to the assignment box on Canvas by the deadline stated above.
  • After submitting, make sure to double-check that your files were correctly submitted.
    • There have been cases where the files were corrupted when submitting, hence preventing the graders from viewing the files.
    • It’s your responsibility to make sure your submitted files work. You might receive a penalty if the grader could not run your file due to incorrect submission.

13.5.9 FAQs

  • Q: I get an error gaierror: [Errno 8] nodename nor servname provided, or not known when running the app. What is this?
    • A: In the last line of your app, instead of app.run_server(debug=True), use app.run_server(debug=True, host = '127.0.0.1').
  • Q: I have problem installing Dash!
    • A: If you’re on Windows, make sure you’re running the conda install dash command inside Anaconda Prompt (not Command line prompt). If conda install dash does not work, try pip install dash or pip3 install dash.