Closed mileswwatkins closed 6 years ago
@vv-qian, also note that the valid officeID
values are documented in the repo already: https://github.com/newsdev/elex/blob/master/elex/api/maps.py#L150-L169
These may come in handy if you have to raise an exception, or elsewhere. For example, instead of erroring with a message like 'F' is not a valid 'officeID' value
, you could instead offer the user suggestions for what values are valid.
This would be a good feature to add. You want to put together a pull request?
Yup, was getting @vv-qian prepped to tackle it, and checking with @jeremyjbowers that it was a useful feature to have for users outside of @nprapps. Vanessa's working on the PR and I'll do an initial review, she'll give y'all an @-mention (and remove the WIP
from the PR title) when it's ready for ya.
Use case: we want to gather county-level data for some races, but only state-level data for other races.
This is easy enough to do if the county-level data's for president, since that has a known and constant
raceID
andelex
supports the syntax--raceids 0
. Since the races we're following are all "national,"elex
's--national-only
flag doesn't help us differentiate. So unless we provide all the desiredraceID
s toelex
, there's no support for, say, fetching only governor's races.This is supported concisely in the AP Elections API using the
officeID
parameter.