← Back to projects

Data & transparency

Brazilian Public Spending Analyzer

Ement: an application to compare funding allocated through Brazilian congressional budget amendments, search public records and export data.

Year2026
My contributionFull-stack development
TechnologiesNuxt · TypeScript · FastAPI · PostgreSQL · D3
Ement overview with committed, verified and paid amounts, amendment year trends and leading spending areas.

Understanding where public funds go

In Brazil, members of Congress can direct public funding through amendments to the federal budget. Comparing states or investigating an area such as healthcare goes beyond looking up a single allocation: it requires filtering thousands of records, adding up amounts and distinguishing spending commitments from verified expenses and payments.

I built Ement to bring those queries into one application. Visitors can start with a national overview, narrow their search and inspect individual allocations while keeping the same filters as they move between views.

From importing data to exploring it

My work covers the data import, API queries and aggregations, and the interface for exploring the results. The overview shows committed, verified and paid amounts, grouped by amendment proposal year, along with the leading spending areas and recipient states.

The map compares states by committed amounts, payments or commitments per resident. Users can search records by year, state, spending area and text, then sort and page through the results. Each record brings together its author, location, program, budget action and detailed amounts. Filters are stored in the URL and kept when navigating between views.

Architecture

Python scripts import the amendment dataset from Brazil's Transparency Portal into PostgreSQL. The FastAPI backend uses asyncpg to query records and calculate aggregates on the server.

The frontend uses Nuxt, Vue and TypeScript, with components for filters, indicators, charts and record details. D3 draws the map from a local geographic file covering Brazil's 26 states and the Federal District. Per-resident calculations use population figures from the 2022 Census by IBGE, Brazil's national statistics agency.

Decisions that support meaningful comparisons

  • The same selection in every view: indicators, the map, records and CSV exports share query parameters. Exports include all matching records, not just the visible page.
  • User input in queries: filter values are passed as SQL parameters, and sorting is restricted to predefined options. Neither accepts arbitrary input as part of the SQL statement.
  • Reading the results: totals and grouped results are queried within the same transaction. CSV exports read records in batches rather than loading the entire export into memory.
  • Separate spending stages: commitments (empenhado), expenses verified as payable (liquidado) and payments (pago) have distinct indicators. Payments against commitments carried over from previous fiscal years (restos a pagar) are also identified separately.
  • Geographic limits: records without a state remain in overall totals but are not assigned to a state on the map. Per-resident figures show the population reference year so readers can interpret the comparison.
  • Keyboard and mobile access: the layout adapts to smaller screens, the map supports keyboard selection, and the detail dialog supports focus navigation.

Dataset coverage and validation

The dataset shown here contains 86,871 records, with amendment proposal years from 2014 to 2025. The application lets visitors compare funding distribution, look up an allocation and export their selection.

Validation compares API totals against the source CSV down to the cent and checks combined filters, pagination, exports and invalid queries. A methodology page explains coverage and indicators, with links to the sources. The screenshots show the running application using this dataset.

Technologies

Python · FastAPI · asyncpg · PostgreSQL · Piccolo · Nuxt · Vue · TypeScript · Nuxt UI · D3

← Back to projects

PROJECTS AND OPPORTUNITIES

Let's talk

I'm available for freelance projects and roles on software development teams.

Let's talk