Skip to content

Commit

Permalink
.sodas automatically converts string into one element array
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasalmeida committed Oct 13, 2014
1 parent 09d5a39 commit c638591
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ A substancial number of Open Health Data resources are delivered through [Socrat

* openHealth.soda("URL or URL reference",fun)
```` javascript
// deliver that data to the console
// deliver first 1,000 entries that data to the console
openHealth.soda("NY Medicare Inpatient")
// deliver that data to a global variable NYmed
openHealth.soda("NY Medicare Inpatient",function(x){NYmed=x;console.log("done")})
// same data, using the URL directly
openHealth.soda("http://health.data.ny.gov/resource/2yck-xisk.json")
// now get all 31,895 records in that dataset, in gulps of 10,000.
// the undefined second argument indicates no query constraints. It could be, for example, {limit:2000}
openHealth.sodas("NY Medicare Inpatient",undefined,function(x){NYmed=x;console.log("done")})
// etc ...
// for list of URL references for SODA data see
openHealth.sodaData
````
3 changes: 2 additions & 1 deletion openHealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ this.getJSON=function(url,fun){
this.getJSON.cache=true

this.sodaData={ // some reference SODA data links
// "NY Medicare Inpatient":"http://health.data.ny.gov/resource/2yck-xisk.json",
"NY Medicare Inpatient":"http://health.data.ny.gov/resource/2yck-xisk.json",
// DSRIP NY
// Hospital Inpatient Prevention Quality Indicators
"DSRIP Hospital Inpatient Prevention Quality Indicators (PQI) for Adult Discharges by Zip Code (SPARCS): Beginning 2009":"https://health.data.ny.gov/resource/5q8c-d6xq.json",
Expand Down Expand Up @@ -142,6 +142,7 @@ this.sodaAll=function(url,q,fun,xx,fun0){ // version of soda2 that keeps reading
this.sodas=function(urls,q,fun,xx){ // version of sodaAll with multiple urls, for example, to load from a list of zip codes
//console.log(urls[0]);
//var urlsi = urls;
if(typeof(urls)=="string"){urls=[urls]} // so it can handle a single url too
if(!xx){xx=[]}
if(urls.length>0){ // keep going
var funLater=function(x){
Expand Down

0 comments on commit c638591

Please sign in to comment.