-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
# ruff: noqa: E501 | ||
|
||
import click | ||
|
||
from server.data.fec.contributions import ContributionsManager | ||
from server.data.manager import DataManager | ||
from server.data.names.nicknames import MessyNicknamesManager | ||
|
||
|
||
@click.group() | ||
def fec(): | ||
"""Work with FEC data.""" | ||
pass | ||
|
||
|
||
@fec.group() | ||
def names(): | ||
"""Work with names data.""" | ||
pass | ||
|
||
|
||
@names.command() | ||
@click.option( | ||
"--data", | ||
type=click.Path(exists=True), | ||
help="Path to data dir.", | ||
required=False, | ||
default=None, | ||
) | ||
def clean(data: str | None = None): | ||
"""Clean raw names data.""" | ||
data_manager = DataManager(data) if data is not None else DataManager.default() | ||
messy_names_manager = MessyNicknamesManager.from_data_manager(data_manager) | ||
nicknames_manager = messy_names_manager.nicknames_manager | ||
nicknames_manager.to_jsonl_data_manager(data_manager) | ||
|
||
|
||
@fec.group() | ||
def contributions(): | ||
"""Work with FEC contributions data.""" | ||
pass | ||
|
||
|
||
@contributions.command() | ||
@click.option( | ||
"--data", | ||
type=click.Path(exists=True), | ||
help="Path to data dir.", | ||
required=False, | ||
default=None, | ||
) | ||
def summarize(data: str | None = None): | ||
"""Summarize raw FEC individual contribution data.""" | ||
data_manager = DataManager(data) if data is not None else DataManager.default() | ||
contributions_manager = ContributionsManager.from_data_manager(data_manager) | ||
summaries_manager = contributions_manager.contribution_summaries_manager | ||
summaries_manager.to_jsonl_data_manager(data_manager) | ||
|
||
|
||
@contributions.command() | ||
def search(): | ||
"""Search summarized FEC contributions data.""" | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
fec() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters