This is being merged into the CDC's Repo at 18F/cv_faq#505 and 18F/cv_faq#510
Many thanks to those who have worked on this. And thank you to 18F for accepting the PR.
JSON API for Coronavirus FAQ
Many websites will want to include information about Coronavirus and will want to make sure their information is accurate and up-to-date.
The US Government is maintaining a repository of questions and answers available at https://faq.coronavirus.gov.
The goal of this project is provide an API for anyone who wishes to incorporate that information onto their site so that they always have the most accurate and up-to-date information available.
The API consists of two endpoints that serve JSON. One contains the complete list of categories. The other contains the complete list of answers.
The answers endpoint is available at https://nyc-cto.github.io/coronavirus-answers/answers.json
and returns a JSON array containing all of the answer objects.
The category endpoint is available at https://nyc-cto.github.io/coronavirus-answers/categories.json
and returns a JSON array containing all of the category objects. The category objects are sorted in the same order as they appear on the home page of Coronavirus FAQ.
An answer object represents an answer about Coronavirus.
{
"title": "Where can I find additional information about water transmission and COVID-19?",
"category": "water-transmission",
"excerpt": "Water transmission and COVID-19",
"source": "CDC",
"source_url": "https://www.cdc.gov/coronavirus/2019-ncov/php/water.html",
"url": "https://faq.coronavirus.gov/water-transmission/additional-information-about-water-transmission-and-covid-19/",
"promoted": false,
"date": "2020-03-10",
"content": "<ul> <li><a href=\"https://www.cdc.gov/healthywater/global/sanitation/workers_handlingwaste.html\">CDC: Guidance for reducing health risks to workers handling human waste or sewage</a></li> </ul>"
}
title: the question. Human-readable text.
category: the name of the category this answer belongs to. A URL-safe string.
excerpt: the category name. Human-readable text. This data is not displayed on the Coronavirus FAQ page and it is recommended that you ignore it.
source: the name of the source for this answer. Human-readable text.
source_url: a URL pointing to the definiative source of the answer.
promoted: Promoted answers are listed on the hompage in the section for their category. Other answers are only listed on the category page. Boolean.
date: date this answer was last updated. ISO 8601 format.
content: content of the answer. An HTML fragment
A category object represents an answer category.
{
"banner": {
"heading": "CDC issues Domestic Travel Advisory.",
"content": "Employees of critical infrastructure, as <a href='https://www.cisa.gov/publication/guidance-essential-critical-infrastructure-workforce'>defined by the Department of Homeland Security</a>, have a special responsibility to maintain normal work schedule."
},
"title": "Traveling",
"name": "travel",
"url": "https://faq.coronavirus.gov/travel/"
}
title: title of the category. Human-readable text.
name: unique identifier for the category. URL-safe string.
url: the canonical URL to this category on https://faq.coronavirus.gov.
banner: an optional banner object for the category.
Categories only include a banner object if they have a banner that should be displayed. The underlying data includes banner data for all categories, but in most cases it is placeholder data and should be ignored.
A banner object represents information that is displayed as a banner with the category.
{
"heading": "CDC issues Domestic Travel Advisory.",
"content": "Employees of critical infrastructure, as <a href='https://www.cisa.gov/publication/guidance-essential-critical-infrastructure-workforce'>defined by the Department of Homeland Security</a>, have a special responsibility to maintain normal work schedule."
}
heading: the heading or title for the banner. Human-readable text.
content: the content for the banner. An HTML fragment.
This project is released under the MIT License. By contributing to this project you agree to license your contributions under those terms.
This project is built on Jekyll, a static site generator.
Category data is stored in Markdown files in the _categories
directory.
Answer data is stored in Markdown files in the _data
directory.
The paths and formats correspond exactly with the data files that generate the Coronavirus FAQ website. To update this project's content, replace those two directories with the directories from that project.
- Install Ruby
- Install Jekyll and Bundler,
gem install jeykll bundler
- Run the development server
jekyll serve
- View the site at
http://localhost:4000
The development server will watch for changes to the code and regenerate the site when they are made.
This project is deployed via GitHub Pages
The primary limitation is that there is no way for this project to automatically remain up-to-date with data from Coronavirus FAQ. This repo will be kept up to date with periodic pushes to match the canonical source, however an automated approach is being investigated.
This project should not exist.
The API endpoints should be a part of the Coronavirus FAQ project.
That would require copying the answers.json
and categories.json
into the Coronavirus FAQ codebase. Unfortunately, that codebase is not publicly available.
Automated tests can ensure the endpoints return valid JSON, in the documented structure, and with the correct data.
An automated system can check for updates to the Coronovirus FAQ page. That way, someone with access to their codebase can be notified to update the data in this project.
When the Coronavirus FAQ page changes, an automated system could then update the data on this project. This would require access to the Coronavirus FAQ repository to implement.