Skip to content

Commit

Permalink
Add companies module to the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
cuducos committed Nov 17, 2019
1 parent a6999fb commit 26dacda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ But you can specify which datasets to download and where to save them. For examp
$ serenata-toolbox /tmp/serenata-data --module federal_senate chamber_of_deputies
Available modules are ``chamber_of_deputies``, ``companies`` and ``federal_senate``.

Yet, you can specify a specific year:

.. code-block:: bash
Expand All @@ -58,7 +60,7 @@ Or use it all together:

.. code-block:: bash
$ serenata-toolbox /tmp/serenata-data --module federal_senate --year 2017
$ serenata-toolbox /tmp/serenata-data --module federal_senate companies --year 2017
Finally, you might want to get help:

Expand Down
7 changes: 7 additions & 0 deletions serenata_toolbox/serenata-toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ from argparse import ArgumentParser

from serenata_toolbox import log
from serenata_toolbox.chamber_of_deputies.reimbursements import Reimbursements as ChamberDataset
from serenata_toolbox.companies.dataset import Dataset as CompaniesDataset
from serenata_toolbox.datasets import Datasets
from serenata_toolbox.federal_senate.dataset import Dataset as SenateDataset

Expand All @@ -26,13 +27,15 @@ def main():
datasets = Datasets(path)
datasets.downloader.download(datasets.downloader.LATEST)
return

if 'chamber_of_deputies' in args.module:
if args.year:
for year in args.year:
chamber = ChamberDataset(path=path, year=year)
else:
chamber = ChamberDataset(path=path)
chamber()

if 'federal_senate' in args.module:
if args.year:
for year in args.year:
Expand All @@ -43,6 +46,10 @@ def main():
senate.translate()
senate.clean()

if 'companies' in args.module:
companies = CompaniesDataset(path)
companies()


if __name__ == '__main__':
main()

0 comments on commit 26dacda

Please sign in to comment.