nas-quickstats

0.1.0 • Public • Published

nas-quickstats

A simple node library for accessing the National Agriculture Service QuickStats database.

For a quick example...

$node test

API

  1. Add the library into your file

    var nas = require('nas-quickstats');
  2. Declare your key that you obtained from the nas site.

    nas.key = 'asldfaj-sadfas-adsf-asdfsdf';
  3. Create a query using the variables from the nas site.

    var q = nas.query({
      commodity_desc: 'BEETS',
      statisticcat_desc: 'YIELD'
    });

    'query' takes an options object which can contain any number of key value pairs describing the query.

  4. Create a request declaring a type and passing in your query and a callback.

    Available types are: get, params, and counts.

    var r = nas.request(nas.type.get, q, function(data){
      console.log(data);
    });
  5. Send the request, and be on your merry way.

    r.send();

More details about the NAS api itself can be found @ http://quickstats.nass.usda.gov/api. Be sure to obtain an API key (it's instant) and read the terms and conditions of use.

This product uses the NASS API but is not endorsed or certified by NASS.

Package Sidebar

Install

npm i nas-quickstats

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • robbynshaw