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

WIP: Refactor campaign donation script #1

Merged
merged 14 commits into from
Nov 27, 2017
Merged

WIP: Refactor campaign donation script #1

merged 14 commits into from
Nov 27, 2017

Conversation

cuducos
Copy link

@cuducos cuducos commented Nov 20, 2017

Hi @lacerdamarcelo,

Once more thank you very much for the PR with the script to collect data on campaign donations!

There are still some bugs in this PR I guess — I'll test it further tomorrow. However this is what I had in mind when I suggested we could follow the DRY (don't repeat yourself) moto a bit closer, adding more readability and maintainability to the great script you've started.

The bulk os changes might seem too big IMHO. However your strategies were solid and I tried to wrap them in a more concise code structure — roughly 22% less code. I kept changes more atomic commit by commit. Maybe the best way to approach this PR is to follow my commit messages and differences, step by step, commits by commit from 4b669e1 to 18d5bc5 (there are commits ahead of them, but the core changes were made in this interval).

Arioston Jaerger and others added 14 commits October 7, 2017 11:07
Use 3rd party libs (requests and tqdm) to simplify code and to avoid reinventing the wheel
DRY by using a flexible function that always returns a DataFrame, using or not the `chunksize` argument
DRY using a base class with the intention to re-use it later
DRY using a temporary context manager (later the idea is to re-use the class built for 2010 directory)
Gather 2010 and 2012-2016 context managers in a common context manager
Gather all these operations in a single point of the script
DRY by using a save function
@cuducos
Copy link
Author

cuducos commented Nov 21, 2017

Done (I guess)…

@lacerdamarcelo lacerdamarcelo merged commit 895efc9 into lacerdamarcelo:issue_275 Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants