Skip to content

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

License

Notifications You must be signed in to change notification settings

robbynshaw/nas-quickstats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published