Skip to content

Commit 42cb99c

Browse files
authored
Merge pull request #102 from EDS-240-Data-Viz/annie-edits
Remove to do section for week 1 lab
2 parents 62f6d07 + 26ec096 commit 42cb99c

8 files changed

Lines changed: 871 additions & 416 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ student-groups/
6363
# data
6464
course-materials/data/
6565

66+
67+
**/*.quarto_ipynb

course-materials/week1.qmd

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ Template `.qmd` files will be provided alongside (most) lecture slides to help k
7777
: {.hover .bordered tbl-colwidths="[50,25,25]"}
7878

7979
## {{< fa clipboard-list title="a clipboard with a To Do list" >}} Pre-lab Prep {#pre-lab-prep}
80-
81-
::: {.callout-important}
82-
## TODO
83-
- update dataset? maybe with a little less cleaning
84-
- kickstart HW #1
85-
:::
80+
Coming soon!
8681

8782
### A. Install required packages
8883

docs/course-materials/week1.html

Lines changed: 378 additions & 408 deletions
Large diffs are not rendered by default.

docs/search.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,7 +3119,7 @@
31193119
"href": "course-materials/week1.html#pre-class-prep",
31203120
"title": "Course logistics, Intro, {ggplot2} review",
31213121
"section": " Pre-lecture Prep",
3122-
"text": "Pre-lecture Prep\n\nA. Install required packages\n\ninstall.packages(\"palmerpenguins\") # a package containing the `penguins` data set, which we'll use for plotting practice\ninstall.packages(\"tidyverse\") # a collection of packages used for data wrangling / manipulation and visualization (including {ggplot2})\n\n\n\nB. Create & organize your EDS-240-class-examples repository\nWe’ll be coding together quite a bit throughout this course. To stay organized, we’ll complete all of our in-class examples in one repository (repo). Setup your repository following these steps:\n\nCreate and clone a GitHub repository named EDS-240-class-examples (or something that makes sense for you). Step-by-step instructions are provided, below, if needed:\n\n\n\n\n\n\n\nStep-by-step instructions for creating and cloning a GitHub repo:\n\n\n\n\n\nCreate a remote (GitHub) repo:\n\nNavigate to your GitHub profile and click on Repositories (top menu bar)\nClick on the green New button in the upper right-hand corner\nGive it the name EDS-240-class-examples, and optionally, a short description. Select the radio button for Public repository (it should be selected by default). Initialize this repository with a README, then click Create repository.\nFrom your repo’s main page, click the green Code button and copy the URL to your clipboard\n\nClone your repo:\nYou may choose the IDE of your choice, though the instructions below describe a workflow for RStudio users.\n\nOpen up RStudio\nClick on the drop down menu next to the R project icon (top right corner)\nClick New Project… &gt; Version Control &gt; Git &gt; paste your repo’s URL in the Repository URL: box and press Tab to auto fill the Project directory name field (it should automatically be named the same as your GitHub repo). Browse to select where on your computer you’d like your repo to be saved.\nClick Create Project\n\n\n\n\n\nCreate a folder for each week (e.g. week1/, week2/, week3/, etc.) inside your repository’s root directory to help keep all the various files that we’ll download / create organized. This consistent naming scheme will also make it easy to add large files (e.g. data files) to your .gitignore file, which is automatically created when you clone your repo.\nUpdate your .gitignore file to prevent yourself from accidentally committing data files (GitHub limits the size of files allowed in repos). Open your .gitignore file and add the following:\n\n\n# ignore any folder named `data/` within folders named `week*` (* acts as a wildcard)\n/week*/data/\n\n\nFill out your repo’s README, referencing the MEDS README Guidelines.\n\n\n\nC. Download the .qmd template\nTemplate .qmd files will be provided alongside (most) lecture slides to help keep us organized and on track throughout class. They are available for download directly from GitHub at the link(s) provided in the Lecture Materials table (below). Look for the download button at the top right corner of the file (it looks similar to this, ). Please download all necessary templates and save them to the appropriate EDS-240-data-viz-examples/weekX folder before each class."
3122+
"text": "Pre-lecture Prep\n\nA. Install required packages\n\ninstall.packages(\"palmerpenguins\") # a package containing the `penguins` data set, which we'll use for plotting practice\ninstall.packages(\"tidyverse\") # a collection of packages used for data wrangling / manipulation and visualization (including {ggplot2})\n\n\n\nB. Create & organize your EDS-240-class-examples repository\nWe’ll be coding together quite a bit throughout this course. To stay organized, we’ll complete all of our in-class examples in one repository (repo). Setup your repository following these steps:\n\nCreate and clone a GitHub repository named EDS-240-class-examples (or something that makes sense for you). Step-by-step instructions are provided, below, if needed:\n\n\n\n\n\n\n\nNoteStep-by-step instructions for creating and cloning a GitHub repo:\n\n\n\n\n\nCreate a remote (GitHub) repo:\n\nNavigate to your GitHub profile and click on Repositories (top menu bar)\nClick on the green New button in the upper right-hand corner\nGive it the name EDS-240-class-examples, and optionally, a short description. Select the radio button for Public repository (it should be selected by default). Initialize this repository with a README, then click Create repository.\nFrom your repo’s main page, click the green Code button and copy the URL to your clipboard\n\nClone your repo:\nYou may choose the IDE of your choice, though the instructions below describe a workflow for RStudio users.\n\nOpen up RStudio\nClick on the drop down menu next to the R project icon (top right corner)\nClick New Project… &gt; Version Control &gt; Git &gt; paste your repo’s URL in the Repository URL: box and press Tab to auto fill the Project directory name field (it should automatically be named the same as your GitHub repo). Browse to select where on your computer you’d like your repo to be saved.\nClick Create Project\n\n\n\n\n\nCreate a folder for each week (e.g. week1/, week2/, week3/, etc.) inside your repository’s root directory to help keep all the various files that we’ll download / create organized. This consistent naming scheme will also make it easy to add large files (e.g. data files) to your .gitignore file, which is automatically created when you clone your repo.\nUpdate your .gitignore file to prevent yourself from accidentally committing data files (GitHub limits the size of files allowed in repos). Open your .gitignore file and add the following:\n\n\n# ignore any folder named `data/` within folders named `week*` (* acts as a wildcard)\n/week*/data/\n\n\nFill out your repo’s README, referencing the MEDS README Guidelines.\n\n\n\nC. Download the .qmd template\nTemplate .qmd files will be provided alongside (most) lecture slides to help keep us organized and on track throughout class. They are available for download directly from GitHub at the link(s) provided in the Lecture Materials table (below). Look for the download button at the top right corner of the file (it looks similar to this, ). Please download all necessary templates and save them to the appropriate EDS-240-data-viz-examples/weekX folder before each class."
31233123
},
31243124
{
31253125
"objectID": "course-materials/week1.html#lecture-materials",
@@ -3133,7 +3133,7 @@
31333133
"href": "course-materials/week1.html#pre-lab-prep",
31343134
"title": "Course logistics, Intro, {ggplot2} review",
31353135
"section": " Pre-lab Prep",
3136-
"text": "Pre-lab Prep\n\n\n\n\n\n\nTODO\n\n\n\n\nupdate dataset? maybe with a little less cleaning\nkickstart HW #1\n\n\n\n\nA. Install required packages\n\ninstall.packages(\"here\") # for reproducible, relative file paths\ninstall.packages(\"janitor\") # tools for cleaning dirty data\ninstall.packages(\"usdata\") # demographic data on the United States at the county and state levels spanning multiple years.\n\n\n\nB. Download necessary data\nDownload fracking data (registryupload_1.csv) from Google Drive and save it to your class repo in the following location: EDS-240-class-examples/week1/data/registryupload_1.csv\n\n\n\n\n\n\nWhy are we downloading from Google Drive and not directly from FracFocus?\n\n\n\n\n\nThese data were originally downloaded as a zip file from FracFocus in November 2023 when they were still quite messy. Since then, FracFocus has published cleaner versions of these data, which is great, but also defeats the purpose of this exercise . For this reason, we’ll be working with this saved version of the data, rather than downloading directly from FracFocus’s data download page.\n\n\n\n\n\nC. Add data to .gitignore\nWe don’t want to push any data in our repo to GitHub (GitHub enforces file size limits, and you’ll run into some serious headaches when you try to push a file that’s too big). To avoid doing this, we can add our data files to our .gitignore file, which, as the name implies, is a collection of files that we want Git to ignore. Open up your .gitignore file and add the following line (anywhere is fine, but it makes sense to add it beneath the last line):\n\n\n\n.gitignore\n\n# ignore any folder named `data/` within folders named `week__` (* acts as a wildcard)\n/week*/data/\n\n\nNotice that when you Save your modified .gitignore file, untracked data files at the specified file path disappear from your Git tab in RStudio, and a modified .gitignore file appears in it’s place (this is what we want!). Stage / add, commit, and push .gitignore.\n\n\n\n\n\n\nA gif of this whole process (in case it’s helpful!)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nAn example repo with three folders: week1/, week2/, and other-stuff/. Each of those folders has a subfolder named data/, and each data/ folder contains a .csv file. Adding the line, /week*/data/ to the .gitignore tells Git to ignore folders (and their contents) named data/ that are within a parent folder named week__ (the * acts as a wildcard). If we wanted to ignore all three data/ folders (including other-stuff/data/), we can instead include /*/data/ to our .gitignore.\n\n\n\n\n\n\nD. Prepare a week1-lab.qmd file\nAdd a new blank file to your class repo – you’ll complete your lab exercises here. For organization’s sake, it should live in the following location: EDS-240-class-examples/week1/week1-lab.qmd. Fill out the necessary YAML information (title, author, date + any other information you find helpful)."
3136+
"text": "Pre-lab Prep\nComing soon!\n\nA. Install required packages\n\ninstall.packages(\"here\") # for reproducible, relative file paths\ninstall.packages(\"janitor\") # tools for cleaning dirty data\ninstall.packages(\"usdata\") # demographic data on the United States at the county and state levels spanning multiple years.\n\n\n\nB. Download necessary data\nDownload fracking data (registryupload_1.csv) from Google Drive and save it to your class repo in the following location: EDS-240-class-examples/week1/data/registryupload_1.csv\n\n\n\n\n\n\nNoteWhy are we downloading from Google Drive and not directly from FracFocus?\n\n\n\n\n\nThese data were originally downloaded as a zip file from FracFocus in November 2023 when they were still quite messy. Since then, FracFocus has published cleaner versions of these data, which is great, but also defeats the purpose of this exercise . For this reason, we’ll be working with this saved version of the data, rather than downloading directly from FracFocus’s data download page.\n\n\n\n\n\nC. Add data to .gitignore\nWe don’t want to push any data in our repo to GitHub (GitHub enforces file size limits, and you’ll run into some serious headaches when you try to push a file that’s too big). To avoid doing this, we can add our data files to our .gitignore file, which, as the name implies, is a collection of files that we want Git to ignore. Open up your .gitignore file and add the following line (anywhere is fine, but it makes sense to add it beneath the last line):\n\n\n\n.gitignore\n\n# ignore any folder named `data/` within folders named `week__` (* acts as a wildcard)\n/week*/data/\n\n\nNotice that when you Save your modified .gitignore file, untracked data files at the specified file path disappear from your Git tab in RStudio, and a modified .gitignore file appears in it’s place (this is what we want!). Stage / add, commit, and push .gitignore.\n\n\n\n\n\n\nTipA gif of this whole process (in case it’s helpful!)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nAn example repo with three folders: week1/, week2/, and other-stuff/. Each of those folders has a subfolder named data/, and each data/ folder contains a .csv file. Adding the line, /week*/data/ to the .gitignore tells Git to ignore folders (and their contents) named data/ that are within a parent folder named week__ (the * acts as a wildcard). If we wanted to ignore all three data/ folders (including other-stuff/data/), we can instead include /*/data/ to our .gitignore.\n\n\n\n\n\n\nD. Prepare a week1-lab.qmd file\nAdd a new blank file to your class repo – you’ll complete your lab exercises here. For organization’s sake, it should live in the following location: EDS-240-class-examples/week1/week1-lab.qmd. Fill out the necessary YAML information (title, author, date + any other information you find helpful)."
31373137
},
31383138
{
31393139
"objectID": "course-materials/week1.html#lab-materials",

docs/site_libs/bootstrap/bootstrap-6cc4bdad0b9e89b2630bb6c80e6a8d1d.min.css

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
class QuartoAxeReporter {
2+
constructor(axeResult, options) {
3+
this.axeResult = axeResult;
4+
this.options = options;
5+
}
6+
7+
report() {
8+
throw new Error("report() is an abstract method");
9+
}
10+
}
11+
12+
class QuartoAxeJsonReporter extends QuartoAxeReporter {
13+
constructor(axeResult, options) {
14+
super(axeResult, options);
15+
}
16+
17+
report() {
18+
console.log(JSON.stringify(this.axeResult, null, 2));
19+
}
20+
}
21+
22+
class QuartoAxeConsoleReporter extends QuartoAxeReporter {
23+
constructor(axeResult, options) {
24+
super(axeResult, options);
25+
}
26+
27+
report() {
28+
for (const violation of this.axeResult.violations) {
29+
console.log(violation.description);
30+
for (const node of violation.nodes) {
31+
for (const target of node.target) {
32+
console.log(target);
33+
console.log(document.querySelector(target));
34+
}
35+
}
36+
}
37+
}
38+
}
39+
40+
class QuartoAxeDocumentReporter extends QuartoAxeReporter {
41+
constructor(axeResult, options) {
42+
super(axeResult, options);
43+
}
44+
45+
createViolationElement(violation) {
46+
const violationElement = document.createElement("div");
47+
48+
const descriptionElement = document.createElement("div");
49+
descriptionElement.className = "quarto-axe-violation-description";
50+
descriptionElement.innerText = `${violation.impact.replace(/^[a-z]/, match => match.toLocaleUpperCase())}: ${violation.description}`;
51+
violationElement.appendChild(descriptionElement);
52+
53+
const helpElement = document.createElement("div");
54+
helpElement.className = "quarto-axe-violation-help";
55+
helpElement.innerText = violation.help;
56+
violationElement.appendChild(helpElement);
57+
58+
const nodesElement = document.createElement("div");
59+
nodesElement.className = "quarto-axe-violation-nodes";
60+
violationElement.appendChild(nodesElement);
61+
const nodeElement = document.createElement("div");
62+
nodeElement.className = "quarto-axe-violation-selector";
63+
for (const node of violation.nodes) {
64+
for (const target of node.target) {
65+
const targetElement = document.createElement("span");
66+
targetElement.className = "quarto-axe-violation-target";
67+
targetElement.innerText = target;
68+
nodeElement.appendChild(targetElement);
69+
nodeElement.addEventListener("mouseenter", () => {
70+
const element = document.querySelector(target);
71+
if (element) {
72+
element.scrollIntoView({ behavior: "smooth", block: "center" });
73+
element.classList.add("quarto-axe-hover-highlight");
74+
setTimeout(() => {
75+
element.style.border = "";
76+
}, 2000);
77+
}
78+
});
79+
nodeElement.addEventListener("mouseleave", () => {
80+
const element = document.querySelector(target);
81+
if (element) {
82+
element.classList.remove("quarto-axe-hover-highlight");
83+
}
84+
});
85+
nodeElement.addEventListener("click", () => {
86+
console.log(document.querySelector(target));
87+
});
88+
nodeElement.appendChild(targetElement);
89+
}
90+
nodesElement.appendChild(nodeElement);
91+
}
92+
return violationElement;
93+
}
94+
95+
report() {
96+
const violations = this.axeResult.violations;
97+
const reportElement = document.createElement("div");
98+
reportElement.className = "quarto-axe-report";
99+
if (violations.length === 0) {
100+
const noViolationsElement = document.createElement("div");
101+
noViolationsElement.className = "quarto-axe-no-violations";
102+
noViolationsElement.innerText = "No axe-core violations found.";
103+
reportElement.appendChild(noViolationsElement);
104+
}
105+
violations.forEach((violation) => {
106+
reportElement.appendChild(this.createViolationElement(violation));
107+
});
108+
document.querySelector("main").appendChild(reportElement);
109+
}
110+
}
111+
112+
const reporters = {
113+
json: QuartoAxeJsonReporter,
114+
console: QuartoAxeConsoleReporter,
115+
document: QuartoAxeDocumentReporter,
116+
};
117+
118+
class QuartoAxeChecker {
119+
constructor(opts) {
120+
this.options = opts;
121+
}
122+
async init() {
123+
const axe = (await import("https://cdn.skypack.dev/pin/axe-core@v4.10.3-aVOFXWsJaCpVrtv89pCa/mode=imports,min/optimized/axe-core.js")).default;
124+
const result = await axe.run({
125+
exclude: [
126+
// https://github.com/microsoft/tabster/issues/288
127+
// MS has claimed they won't fix this, so we need to add an exclusion to
128+
// all tabster elements
129+
"[data-tabster-dummy]"
130+
],
131+
preload: { assets: ['cssom'], timeout: 50000 }
132+
});
133+
const reporter = this.options === true ? new QuartoAxeConsoleReporter(result) : new reporters[this.options.output](result, this.options);
134+
reporter.report();
135+
}
136+
}
137+
138+
export async function init() {
139+
const opts = document.querySelector("#quarto-axe-checker-options");
140+
if (opts) {
141+
const jsonOptions = JSON.parse(atob(opts.textContent));
142+
const checker = new QuartoAxeChecker(jsonOptions);
143+
await checker.init();
144+
}
145+
}

0 commit comments

Comments
 (0)