votesmart / python-votesmart

python client library for interacting with Project Vote Smart API
Other
84 stars 40 forks source link

votesmart.officials.getByDistrict returns duplicates #1

Closed sunlightlabs closed 15 years ago

sunlightlabs commented 15 years ago

When querying for officials using votesmart.officials.getByDistrict, every official returned is duplicated twice.

jamesturk commented 15 years ago

this definitely comes from PVS itself, though it should be trivial to have the code remove duplicates

jamesturk commented 15 years ago

actually they aren't quite duplicates:

>>> a,b = votesmart.officials.getByDistrict(21511)

>>> a == b

False

in this particular example the official is in both the Democratic and Working families party.

The recommended solution is to gather the attributes you need to be unique and use python's built in set() to make your results unique. Having the library throw away data introduces potential errors (eg. what if two lawmakers have the same name?)

sunlightlabs commented 15 years ago

this issue is now addressed in the documentation