Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nokken-Poole allows for missing icpsr key when getting start idpts #1

Open
lukesonnet opened this issue Nov 17, 2018 · 1 comment
Open

Comments

@lukesonnet
Copy link
Member

The following lines allow for start values for icpsrs that don't have ideal points in the payload. However, this should not be handled by pynominate but by whatever is generating the payload for pynominate.

dat['start'] = [
(
str(x['icpsr']) in payload['idpt']
and payload['idpt'][str(x['icpsr'])]
) or [0.0, 0.0]

I'm going to remove these lines so that it matches nominate.py, which will throw a key error if it can't find the right icpsr.

@lukesonnet
Copy link
Member Author

lukesonnet commented Nov 17, 2018

The function that we actually use is member_congress_votes, but that seems to be an old function. I'll switch it to use the above lines and delete member_congress_votes.

The problem here is that we construct icpsr_chamber_congress to get objects by icpsr-chamber-congress. This is an object where each key is a string with those three objects separated by underscores. This means we never preserve the type of the icpsr in the payload, which can be either string or int, as long as its the same throughout the payload.

I think the solution is to change the way we build icpsr_chamber_congress so that we can still accommodate payloads with either int or string icpsrs, and then rely on key errors when someone abuses that flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant