Module 14 Challenge
EdX/UT Data Analytics and Visualization Bootcamp
Cohort UTA-VIRT-DATA-PT-11-2024-U-LOLC
Author: Neel Agarwal
- Project Description
- Assignment Requirements
- Directory Structure
- Usage Instructions
- Key Functions & Code Notes
- GitHub Pages Deployment
- References and Citations
This repository contains an interactive dashboard that explores the Belly Button Biodiversity dataset. The goal is to visualize the bacteria found in human belly buttons by subject ID, displaying both a bar chart of the top bacterial species and a bubble chart of all bacterial cultures. This assignment deviates from typical Python-focused projects by relying primarily on JavaScript, HTML, and CSS (plus libraries like D3.js and Plotly.js) to create a dynamic web-based visualization experience. While this project goes beyond the basic requirements for this module, it doesn't interfere with the fulfillment of any of those requirements in creating extra functionality.
The assignment's base requirements and extra features are separated and summarized in the section below!
Below are the core requirements (as stated or implied by the Module 14 Challenge rubric) and how each one is addressed in this project:
Create a Horizontal Bar Chart
- Rubric Requirement: Display the top 10 (or more) bacterial species (OTUs) found in each volunteer’s navel.
- Implementation:
- Bar chart is generated in
app.jsby slicing and reversing the relevant data arrays (otu_ids,sample_values,otu_labels). - The chart is rendered via Plotly to a
<div id="bar">.
- Bar chart is generated in
- Location: See
barChart(json, params)function inapp.js.
Create a Bubble Chart
- Rubric Requirement: Visualize the overall distribution of bacterial species for each individual.
- Implementation:
- Bubble chart uses
otu_idsfor the x-axis,sample_valuesfor the y-axis and marker sizes, and color scales the bubbles byotu_ids. - Rendered via Plotly to
<div id="bubble">.
- Bubble chart uses
- Location: See
bubbleChart(json, params)function inapp.js.
Populate a Demographic Info Panel
- Rubric Requirement: Display each volunteer’s demographic information (ID, age, location, etc.).
- Implementation:
- A
<div id="sample-metadata">inindex.htmlis updated dynamically using thebuildMetadata()function. - Data is filtered by the volunteer’s ID; key-value pairs are appended into that
<div>for an at-a-glance summary.
- A
- Location: See
buildMetadata(sampleNum, json)inapp.js.
Dynamic Input/Dropdown
- Rubric Requirement: Provide a dropdown to select volunteer IDs, and upon user change, redraw charts.
- Implementation:
<select id="selDataset" />inindex.htmltriggerssampleChange(this.value)inapp.js.- The data is retrieved/filtered, and the charts and panel are updated accordingly.
- Location:
buildDropDown()andsampleChange()inapp.js.
README
- Rubric Requirement: An updated README that describes the purpose, process, dependencies, usage instructions, etc.
- Implementation:
- This document provides an overview of all the above features, instructions, and references.
In addition to the rubric requirements, the following enhancements go beyond the minimal scope:
Random Subject Selector
- A “Randomize” button that picks a random subject ID to demonstrate dynamic chart rendering.
Dynamic Bar Limit
- A custom dropdown (
id="barLimit") to let users choose how many bars to display (e.g., top 5, top 10, or “all”).
- A custom dropdown (
Real-time Alerts/Warnings
- If the data set for a particular subject ID is too small—or if you request more bars than available—the UI displays a warning message (
displayWarnings()inapp.js).
- If the data set for a particular subject ID is too small—or if you request more bars than available—the UI displays a warning message (
Loading Spinner / Overlay
- A loader UI that appears while fetching or updating data (
showLoader()/hideLoader()inapp.js).
- A loader UI that appears while fetching or updating data (
Color Change Interactions
- Some elements dynamically change color or background on click, providing a more interactive and modern user experience.
Optimized Code Structure
- The code is split into smaller, reusable helper functions (e.g.,
cleanLabels(),buildDropDown(), etc.) for maintainability.
- The code is split into smaller, reusable helper functions (e.g.,
Regex Text Cleaning
- The demographic info is cleaned before presentation per each request for new data, to allow for consistent presentation and potential storage of data.
More CSS Libraries
- Introduced CSS libraries to enhance existing Bootstrap styling and create favicon icons.
Below is a simplified view of the project layout:
BellyButtonBiodiversity/ │ ├── index.html ├── static/ │ └── js/ │ └── app.js │ ├── README.md └── .gitignore index.html- Contains the webpage structure, layout with Bootstrap columns, dropdowns, and
<div>placeholders for charts.
- Contains the webpage structure, layout with Bootstrap columns, dropdowns, and
app.js- The main JavaScript logic. Connects to the JSON data, populates dropdowns, updates charts, and displays the demographic info.
- Clone or Download this repository.
- Locate
index.htmlin your local folder. - Open
index.htmlin a browser (Chrome/Firefox recommended). - The page loads with a default test subject (or the first ID).
- Use the dropdown menu to pick a subject ID—charts and info update automatically.
- Optionally, click “Subject ID Randomizer” to see a random subject.
- Adjust the “Number of Bars to Show” dropdown to see fewer/more bar segments.
- Visit the GitHub Page to visit the tool preloaded in your web-browser by clicking here!
- You can also explore more information about how this tool was set up in this section of the README!
Note
If data is being fetched from a local samples.json, ensure that file is present in the correct relative path
or served via local server (some browsers block local JSON fetch for security).
- JavaScript (ES6+)
- HTML5 / CSS3
- D3.js v7
- Plotly.js
- Bootstrap 5
- (Optional) fetch / d3.json for data loading
- (Optional) Bootstrap Bundle for custom shading and boxing
- (Optional) Awesome Font's Favicon CSS Library
sampleChange(selectedID)- Main orchestration function for updating charts and metadata each time the user changes the dropdown.
buildMetadata(sampleNum, data)- Dynamically populates the demographic info panel.
barChart(jsonData, plotlyParams)&bubbleChart(jsonData, plotlyParams)- Construct the respective Plotly visualizations with the chosen data arrays.
displayWarnings(total, requested, alertBoxID)- Posts warnings/alerts if the user tries to show more bars than exist or if the sample size is too small.
showLoader()/hideLoader()- Control the loading spinner overlay for a smoother UX.
Feel free to explore these functions in app.js and adapt them for your future projects.
This project is also hosted via GitHub Pages, allowing anyone to view the interactive dashboard directly in their browser without cloning or running a local server. Here’s how you can check it out—or set it up yourself if you haven’t already:
View Live Dashboard
- You can access the deployed dashboard at https://neelka96.github.io/belly-button-challenge/.
- Once there, you’ll see the homepage (
index.html) loaded with the interactive charts.
How to Deploy on GitHub Pages
- Push Code to GitHub: Make sure your
index.html,app.js, and other files are on your main branch. - Enable Pages:
- Go to your repository’s Settings tab on GitHub.
- In the left-hand menu, click on Pages.
- Under Source, choose the branch you want to deploy (e.g.,
main) and the/rootfolder. - Click Save.
- Wait for Build: It may take a minute or two for GitHub to build the site. Once successful, you’ll see a green bar with the URL of your hosted site.
- Visit the Deployed Dashboard: Click or navigate to the URL (e.g.,
https://YourGitHubUsername.github.io/YourRepoName) to see the live site.
- Push Code to GitHub: Make sure your
Updating the Deployment
- Whenever you push additional commits to the chosen branch, GitHub automatically rebuilds and updates your Pages site.
- Just wait a minute or two for changes to propagate, then refresh your live URL.
Notes
- GitHub Pages only serves static content. Your JavaScript and data files should be relative paths in your HTML (e.g.,
./static/js/app.jsor similar) to ensure everything loads correctly. - If using local JSON or other data, ensure it’s included in the repository and references in
app.jsor HTML with a relative file path. - If you run into CORS issues or “404 Not Found,” double-check spelling, capitalization, and folder organization.
- GitHub Pages only serves static content. Your JavaScript and data files should be relative paths in your HTML (e.g.,
- edX/2U Bootcamp materials for the “Belly Button Biodiversity” dataset and assignment instructions.
- README.md: Created using OpenAI's ChatGPT LLM, trained using prior READMEs, all the deliverables, and the provided rubric given by edX/2U
- Plotly.js Official Docs: https://plotly.com/javascript/
- D3.js Documentation: https://d3js.org/
- Bootstrap Documentation: https://getbootstrap.com/
- Font Awesome Documentation: https://fontawesome.com/v4/
- Random code snippets for event handling, arrow functions, etc., derived from MDN Web Docs and personal experience.