1

Is this code supported by soda-js, and if so, why am I getting a 500 status code

var identifier = 'fgzt-sd3n'
var op = new soda.Consumer('data.cms.gov', options);
op.query()
    .withDataset(identifier)
    .where({npi:"in('1598908824','1194758300')"})
    .getRows()
    .on('success', function(rows){console.log(rows)})
    .on('error', function(error){console.log(error)})
}

Also can my list be an array or atleast a string variable maybe like

'in('+strList+')'

where

var strList="'1598908824','1194758300'"

1 Answers1

1

Try this instead:

var identifier = 'fgzt-sd3n' var op = new
soda.Consumer('data.cms.gov', options); op.query()
    .withDataset(identifier)
    .where({"npi in('1598908824','1194758300')"})
    .getRows()
    .on('success', function(rows){console.log(rows)})
    .on('error', function(error){console.log(error)}) }

I suspect that the where you were passing before got you a SoQL query of $where=npi=in(...) which would fail.

You should have received a 400 error instead of an unhelpful 500 - I'll file a bug on that one!

Rob
  • 26,989
  • 16
  • 82
  • 98
chrismetcalf
  • 1,556
  • 1
  • 8
  • 7
  • Ok, I think you meant `where("npi in('1598908824','1194758300')")` which works perfect. Thanks – Chris McKay May 02 '16 at 20:28
  • what is the limit on elements i can have within the `in(...)`. 500 elements is clearly not supported as it returns `{}` – Chris McKay May 02 '16 at 20:50
  • It depends on your HTTP library, but your total SoQL query length needs to be less than 2000 to 4000 characters. Our system will block anything longer than about 4000, but many library implementations cap out closer to 2000. – chrismetcalf May 03 '16 at 17:10