The API Briefing: Keeping an Eye on Crime with the National Crime Victimization Survey API
Every year, the Bureau of Justice Statistics surveys nearly 80,000 households and over 143,000 individuals about crime victimization. What is unique about this survey is that both reported and unreported crimes data is collected. The survey has a well-documented API which offers data in the CSV, XML, and JSON formats. Let’s examine the documentation to determine how a developer could use the data in the app.
The National Crime Victimization Survey (NCVS) API is split into “personal victimization” data and “household victimization” data. The personal victimization data has 32 variables that describes the crime and gives the victim’s demographic information. The household victimization data has similar information in 29 variables.
Obtaining the information is easy. The documentation provides sample API endpoints that helps the developer create a URL (uniform resource locator) to return data in a specific format. For example, if a developer would like all personal victimization data for 2010 as a JSON file, he or she would use the following URL: http://www.bjs.gov:8080/bjs/ncvs/v2/personal/2010?format=json (Caution: link will download a large file). Other URL calls could return data by population or the count of household incidents by year.
The NCVS API is an excellent data source for beginning developers to learn how to request and parse data for apps. Developers can use the most popular scripting languages to acquire the data and format it in a data table, charts, and interactive displays. The documentation is comprehensive and clearly defines the data fields. The only suggestion I’d have is to make it possible to include location information so that app developers could also experiment with mapping the data.*API – Application Programming Interface. How software programs and databases share data and functions with each other. Check out APIs in Government for more information. Each week in “The API Briefing,” I will showcase government APIs and the latest API news and trends. Visit this blog every week to learn how government APIs are transforming government and improving government services for the American people. If you have ideas for a topic or have questions about APIs, please contact me via email.
Dr. William A. Brantley is the HRIS Branch Chief in the USDA’s Rural Development Human Resources Office. You can find out more about his work in this space at BillBrantley.com. All opinions are his own and do not reflect the opinions of the USDA or GSA.