Jarbas — a tool for Serenata de Amor
Jarbas is a tool for Serenata de Amor contributors.
In Jarbas context a Document
refers to a document (a reimbursement claim) from CEAP.
This endpoint lists Document
objects and it accepts any field (and any combination among them) as a filter. For example:
GET /api/document/?year=2015&state=RS&congressperson_id=42
These are the fields that can be combined for filtering purposes:
applicant_id
cnpj_cpf
congressperson_id
document_id
document_type
month
party
reimbursement_number
state
subquota_group_id
subquota_number
term
year
This endpoint gets the URL to the digitalized version of the receipt of a Document
. It returns { url: null }
if the digitalized version is not available. The endpoint expects a Document.pk
(i.e. the primary key of the Document
object).
A supplier is a Brazilian company in which congressperson have made expenses and claimed for reimbursement.
This endpoit gets the info we have for a specific supplier. The endpoint expects a Supplier.cnpj
(i.e. the CNPJ of a Supplier
object). It returns 404
if the supplier is not found.
The app is based in Python 3 and Node.js. Once you have pip
and npm
available, install the dependencies:
npm i
python -m pip install -r requirements-dev.txt
Copy contrib/.env.sample
as .env
in the project's root folder and adjust your settings. These are the main environment settings:
DEBUG
(bool) enable or disable Django debug modeSECRET_KEY
(str) Django's secret keyALLOWED_HOSTS
(str) Django's allowed hostsUSE_X_FORWARDED_HOST
(bool) Whether to use theX-Forwarded-Host
header
DATABASE_URL
(string) Database URL
AMAZON_S3_BUCKET
(str) Name of the Amazon S3 bucket to look for datasets (e.g.serenata-de-amor-data
)AMAZON_S3_REGION
(str) Region of the Amazon S3 (e.g.s3-sa-east-1
)AMAZON_S3_DATASET_DATE
(str) Datasets file name prefix of CEAP datasets from Serenata de Amor (e.g.2016-08-08
for2016-08-08-current-year.xz
)AMAZON_S3_SUPPLIERS_DATE
(str) Datasets file name prefix for suppliers dataset (e.g.2016-08-08
for2016-08-08-companies.xz
)
GOOGLE_ANALYTICS
(str) Google Analytics tracking code (e.g.UA-123456-7
)
Once you're done with requirements, dependencies and settings, create the basic structure at the database (and if you wish, create a super-user for you, so you can use Django Admin later):
python manage.py migrate
python manage.py createsuperuser
Now you can load the data from our datasets:
python manage.py loaddatasets
Use python manage.py loaddatasets --help
to check options on limiting the number of documents to be loaded from the datasets.
We generate assets through webassets and we serve static files through WhiteNoise, thus you might have to run:
python manage.py assets build
python manage.py collectstatic
Not sure? Run python manage.py check
and python manage.py test
just in case.
Run the server with python manage.py runserver
and load localhost:8000 in your favorite browser.
If you created a super-user account, you can also use Django Admin at /admin/
.
Licensed under the MIT License.