Open patphongs opened 2 years ago
Making changes with the snippet has been fairly easy so far. Automating this may not be super helpful and a heavy lift. Iceboxing for now.
This is the CDC API call to determine COVID burden level: https://www.cdc.gov/coronavirus/2019-ncov/json/cdt-ccl-data.json. This needs to be added to our content security policy to automate this. The below JS can be added to the snippet to automate the process.
<div id="app">
<p>Washington, D.C.’s COVID-19 Community Level is currently <strong id="covid-level"></strong>.</p>
<p id="mask-requirement">Individuals visiting FEC offices are not required to wear masks.</p>
<p>Last updated: <em id="update-date"></em></p>
</div>
<script>
const div = document.querySelector("#app");
const url = "https://www.cdc.gov/coronavirus/2019-ncov/json/cdt-ccl-data.json?" + "cachebust=" + Date.now();
// sending request
async function getData() {
let response = await fetch(url);
let data = await response.json();
// fips code for DC is 11001
let filteredData = data.integrated_county_latest_external_data.filter( record => record.fips_code === "11001");
let covidLevel = filteredData[0];
let levelText = "";
let maskRequirement = null;
let updateDate = new Date(Date.parse(covidLevel.CCL_report_date));
switch(covidLevel.CCL_community_burden_level_integer) {
case "0": levelText = "LOW"; break;
case "1": levelText = "MEDIUM"; break;
case "2": levelText = "HIGH";
maskRequirement = "Individuals visiting FEC offices are required to wear masks while in FEC workspaces.";
break;
default: levelText = "Unknown";
}
document.getElementById("covid-level").innerText=levelText;
if(maskRequirement) {
document.getElementById('mask-requirement').innerHTML = maskRequirement;
}
document.getElementById("update-date").innerText=updateDate;
}
getData();
</script>
Unfortunately there's no ideal solution for this right now since we would need it to update every monday on a schedule and the data updates on Thursday. If we ever get a chance to get the django cron working, we may be able to do it that way.
Summary
What we're after: As community transmission levels change, COVID-19 guidance will also need to change fluidly on our website. We should work with agency management and HR to find a way to automate the posting of this guidance once we have established a streamlined process.
Related issues
List any relevant related issue(s)
Completion criteria