### Political Parties API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt This API allows you to query information about political parties represented in the Chamber of Deputies. You can retrieve a list of all parties or get details about the members of a specific party. ```APIDOC ## GET /api/v2/partidos ### Description Retrieves a list of all political parties. Supports ordering. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/partidos ### Parameters #### Query Parameters - **ordem** (string) - Optional - Order direction ('ASC' or 'DESC'). Defaults to 'ASC'. - **ordenarPor** (string) - Optional - Field to order results by (e.g., 'sigla'). - **pagina** (integer) - Optional - Page number for pagination. - **itens** (integer) - Optional - Number of items per page. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/partidos?ordem=ASC&ordenarPor=sigla" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of party objects. - **id** (integer) - Party's unique identifier. - **sigla** (string) - Party's acronym. - **nome** (string) - Party's full name. - **uri** (string) - API URI for the party. #### Response Example ```json { "dados": [ { "id": 36835, "sigla": "PT", "nome": "Partido dos Trabalhadores", "uri": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835" }, { "id": 36769, "sigla": "DEM", "nome": "Democratas", "uri": "https://dadosabertos.camara.leg.br/api/v2/partidos/36769" } ] } ``` ## GET /api/v2/partidos/{id}/membros ### Description Retrieves the list of deputies who are members of a specific political party. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/partidos/{id}/membros ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the political party. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/partidos/36835/membros" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of deputy objects who are members of the party. - **id** (integer) - Deputy's unique identifier. - **uri** (string) - API URI for the deputy. - **nome** (string) - Deputy's full name. - **siglaPartido** (string) - Deputy's political party acronym. - **uriPartido** (string) - API URI for the deputy's party. - **siglaUf** (string) - Deputy's state acronym. - **idLegislatura** (integer) - Current legislature ID. - **urlFoto** (string) - URL to the deputy's photo. - **email** (string) - Deputy's email address. #### Response Example ```json { "dados": [ { "id": 204554, "uri": "https://dadosabertos.camara.leg.br/api/v2/deputados/204554", "nome": "Deputy Name", "siglaPartido": "PT", "uriPartido": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835", "siglaUf": "SP", "idLegislatura": 57, "urlFoto": "https://www.camara.leg.br/internet/deputado/bandep/204554.jpg", "email": "dep.email@camara.leg.br" } ] } ``` ``` -------------------------------- ### Integrate API and Extra Data - Python Requests Pandas Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Demonstrates integrating data from the official Chamber of Deputies API with local CSV files. It fetches current deputy information and loads historical party data, preparing them for combined analysis. Requires 'requests' and 'pandas' libraries. ```python import requests import pandas as pd from datetime import datetime # Fetch current deputies from API api_url = "https://dadosabertos.camara.leg.br/api/v2/deputados" response = requests.get(api_url, headers={"Accept": "application/json"}) deputies_data = response.json() # Create DataFrame from API response deputies_df = pd.DataFrame(deputies_data['dados']) # Load party historical data hopp_df = pd.read_csv( 'dados-extras/partidos/HOPP.csv', sep=';', encoding='utf-8' ) ``` -------------------------------- ### Fetch and Process Propositions with Committees (Python) Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Fetches proposition data from the Dados Abertos API and processes committee information from a local CSV file. It identifies active committees and prints their names and acronyms. Dependencies include requests and pandas. ```python import requests import pandas as pd # Fetch proposition data from the API propositions = requests.get( "https://dadosabertos.camara.leg.br/api/v2/proposicoes?ano=2023&itens=100", headers={"Accept": "application/json"} ).json() # Load committee data from a local CSV file committees_df = pd.read_csv( 'dados-extras/orgaos/comissoes-permanentes.csv', sep=';', encoding='utf-8' ) # Print active committees print("\nActive committees that may process recent propositions:") active_committees = committees_df[committees_df['datExtincao'].isna()] for idx, committee in active_committees.iterrows(): print(f"- {committee['txtSigla']}: {committee['txtNome']}") ``` -------------------------------- ### Merge Deputy Data with Party History (Python) Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Merges deputy data with historical party information based on the party's acronym (siglaPartido). It performs a left merge to include all deputies and their corresponding party details. Dependencies include pandas. ```python import pandas as pd # Assuming deputies_df and hopp_df are pre-loaded pandas DataFrames # deputies_df: DataFrame with deputy information # hopp_df: DataFrame with historical party information merged_df = deputies_df.merge( hopp_df[['siglaPartido', 'nome', 'dataOcorrencia', 'tituloOcorrencia']], left_on='siglaPartido', right_on='siglaPartido', how='left' ) ``` -------------------------------- ### CSV Data: Analyze Political Party Historical Occurrences (HOPP) with Pandas Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Process the HOPP (Histórico de Ocorrências de Partidos Políticos) CSV dataset using Python's Pandas library. This dataset contains historical information about political party events since 1935. The code demonstrates downloading, parsing, and analyzing party creation, name changes, mergers, and incorporations. ```python import pandas as pd import requests from io import StringIO # Download and parse HOPP CSV url = "https://raw.githubusercontent.com/CamaraDosDeputados/dados-abertos/master/dados-extras/partidos/HOPP.csv" response = requests.get(url) response.encoding = 'utf-8' # Parse CSV with semicolon separator df = pd.read_csv(StringIO(response.text), sep=';', encoding='utf-8') # Examine structure print(df.columns.tolist()) # ['id', 'siglaPartido', 'nome', 'codOcorrencia', 'tituloOcorrencia', # 'dataOcorrencia', 'idPartidoDestino', 'siglaPartidoDestino', 'descricaoOcorrencia'] # Find all party creation events creation_events = df[df['tituloOcorrencia'] == 'Criação'] print(f"Total parties created: {len(creation_events)}") # Track party name changes name_changes = df[df['tituloOcorrencia'] == 'Alteração Nome'] for idx, row in name_changes.iterrows(): print(f"{row['siglaPartido']} changed name on {row['dataOcorrencia']}") print(f" New party: {row['siglaPartidoDestino']}") print(f" Description: {row['descricaoOcorrencia']}") # Find parties that were merged or incorporated mergers = df[df['tituloOcorrencia'].isin(['Fusão', 'Incorporação'])] print(f"\nTotal merger/incorporation events: {len(mergers)}") ``` -------------------------------- ### Search Legislative Propositions - REST API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Allows searching for legislative propositions (bills, amendments) by keywords and year. It retrieves details such as ID, type, number, year, and summary. The API supports fetching specific proposition details, authors, and voting history. ```bash # Search for propositions by keyword and year curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes?keywords=educação&ano=2023&ordem=DESC&ordenarPor=id" \ -H "Accept: application/json" # Response structure: { "dados": [ { "id": 2342156, "uri": "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156", "siglaTipo": "PL", "codTipo": 139, "numero": 1234, "ano": 2023, "ementa": "Dispõe sobre políticas públicas para educação básica." } ], "links": [ { "rel": "self", "href": "https://dadosabertos.camara.leg.br/api/v2/proposicoes?keywords=educação&ano=2023" } ] } # Get full details of a specific proposition curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156" \ -H "Accept: application/json" # Get authors of a proposition curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156/autores" \ -H "Accept: application/json" # Get voting history of a proposition curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156/votacoes" \ -H "Accept: application/json" ``` -------------------------------- ### List Political Parties - REST API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Retrieves a list of all political parties represented in the Chamber of Deputies. The API allows querying for members of a specific party. Data includes party ID, acronym, and name. ```bash # List all political parties curl -X GET "https://dadosabertos.camara.leg.br/api/v2/partidos?ordem=ASC&ordenarPor=sigla" \ -H "Accept: application/json" # Response structure: { "dados": [ { "id": 36835, "sigla": "PT", "nome": "Partido dos Trabalhadores", "uri": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835" }, { "id": 36769, "sigla": "DEM", "nome": "Democratas", "uri": "https://dadosabertos.camara.leg.br/api/v2/partidos/36769" } ] } # Get members of a specific party curl -X GET "https://dadosabertos.camara.leg.br/api/v2/partidos/36835/membros" \ -H "Accept: application/json" ``` -------------------------------- ### Analyze Party Lifecycle - Python Pandas Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Analyzes the lifecycle of political parties by grouping data by party affiliation. It calculates the minimum and maximum occurrence dates and the total count of events for each party. The output is a DataFrame showing 'Party', 'First_Event', 'Last_Event', and 'Total_Events'. ```python party_lifecycle = df.groupby('siglaPartido').agg({ 'dataOcorrencia': ['min', 'max'], 'tituloOcorrencia': 'count' }).reset_index() party_lifecycle.columns = ['Party', 'First_Event', 'Last_Event', 'Total_Events'] print(party_lifecycle.head()) ``` -------------------------------- ### Retrieve Deputy List - REST API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Fetches a list of all current deputies from the Dados Abertos API. Supports filtering by party and state, and allows ordering of results. The API returns data in JSON format. ```bash # Retrieve list of all current deputies curl -X GET "https://dadosabertos.camara.leg.br/api/v2/deputados" \ -H "Accept: application/json" # Response structure: { "dados": [ { "id": 204554, "uri": "https://dadosabertos.camara.leg.br/api/v2/deputados/204554", "nome": "Deputy Name", "siglaPartido": "PT", "uriPartido": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835", "siglaUf": "SP", "idLegislatura": 57, "urlFoto": "https://www.camara.leg.br/internet/deputado/bandep/204554.jpg", "email": "dep.email@camara.leg.br" } ], "links": [ { "rel": "self", "href": "https://dadosabertos.camara.leg.br/api/v2/deputados" }, { "rel": "next", "href": "https://dadosabertos.camara.leg.br/api/v2/deputados?pagina=2&itens=15" } ] } # Get detailed information about a specific deputy curl -X GET "https://dadosabertos.camara.leg.br/api/v2/deputados/204554" \ -H "Accept: application/json" # Filter deputies by party and state curl -X GET "https://dadosabertos.camara.leg.br/api/v2/deputados?siglaPartido=PT&siglaUf=SP&ordem=ASC&ordenarPor=nome" \ -H "Accept: application/json" ``` -------------------------------- ### REST API: Query Legislative Sessions and Events Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Query information about plenary sessions, committee meetings, public hearings, and other legislative events. Supports filtering by date range and retrieving participants or agenda items for specific events. Requires an 'Accept: application/json' header. ```bash # List events within a date range curl -X GET "https://dadosabertos.camara.leg.br/api/v2/eventos?dataInicio=2023-09-01&dataFim=2023-09-30&ordem=DESC&ordenarPor=dataHoraInicio" \ -H "Accept: application/json" # Get participants of an event curl -X GET "https://dadosabertos.camara.leg.br/api/v2/eventos/65432/participantes" \ -H "Accept: application/json" # Get agenda items of an event curl -X GET "https://dadosabertos.camara.leg.br/api/v2/eventos/65432/pauta" \ -H "Accept: application/json" ``` -------------------------------- ### Legislative Propositions API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt This API provides access to detailed information about legislative bills, amendments, and other propositions. You can search for propositions by keywords and year, and retrieve details about specific propositions, their authors, and voting history. ```APIDOC ## GET /api/v2/proposicoes ### Description Searches for legislative propositions based on various criteria. Supports filtering by keywords, year, and ordering. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/proposicoes ### Parameters #### Query Parameters - **keywords** (string) - Optional - Search term for proposition content. - **ano** (integer) - Optional - Filter by the year the proposition was submitted. - **ordem** (string) - Optional - Order direction ('ASC' or 'DESC'). Defaults to 'ASC'. - **ordenarPor** (string) - Optional - Field to order results by (e.g., 'id'). - **pagina** (integer) - Optional - Page number for pagination. - **itens** (integer) - Optional - Number of items per page. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes?keywords=educação&ano=2023&ordem=DESC&ordenarPor=id" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of proposition objects. - **id** (integer) - Proposition's unique identifier. - **uri** (string) - API URI for the proposition. - **siglaTipo** (string) - Type acronym of the proposition (e.g., 'PL'). - **codTipo** (integer) - Type code of the proposition. - **numero** (integer) - Proposition number. - **ano** (integer) - Year of proposition submission. - **ementa** (string) - Summary of the proposition. - **links** (array) - Pagination links. #### Response Example ```json { "dados": [ { "id": 2342156, "uri": "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156", "siglaTipo": "PL", "codTipo": 139, "numero": 1234, "ano": 2023, "ementa": "Dispõe sobre políticas públicas para educação básica." } ], "links": [ { "rel": "self", "href": "https://dadosabertos.camara.leg.br/api/v2/proposicoes?keywords=educação&ano=2023" } ] } ``` ## GET /api/v2/proposicoes/{id} ### Description Retrieves full details of a specific legislative proposition identified by its ID. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/proposicoes/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the proposition. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - Proposition's unique identifier. - **uri** (string) - API URI for the proposition. - **siglaTipo** (string) - Type acronym of the proposition. - **codTipo** (integer) - Type code of the proposition. - **numero** (integer) - Proposition number. - **ano** (integer) - Year of proposition submission. - **ementa** (string) - Summary of the proposition. #### Response Example ```json { "id": 2342156, "uri": "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156", "siglaTipo": "PL", "codTipo": 139, "numero": 1234, "ano": 2023, "ementa": "Dispõe sobre políticas públicas para educação básica." } ``` ## GET /api/v2/proposicoes/{id}/autores ### Description Retrieves the authors of a specific legislative proposition. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/proposicoes/{id}/autores ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the proposition. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156/autores" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of author objects. - **id** (integer) - Author's unique identifier. - **uri** (string) - API URI for the author. - **nome** (string) - Author's name. - **urlFoto** (string) - URL to the author's photo. #### Response Example ```json { "dados": [ { "id": 204554, "uri": "https://dadosabertos.camara.leg.br/api/v2/deputados/204554", "nome": "Deputy Name", "urlFoto": "https://www.camara.leg.br/internet/deputado/bandep/204554.jpg" } ] } ``` ## GET /api/v2/proposicoes/{id}/votacoes ### Description Retrieves the voting history for a specific legislative proposition. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/proposicoes/{id}/votacoes ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the proposition. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/proposicoes/2342156/votacoes" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of voting records. - **id** (integer) - Voting record ID. - **uri** (string) - API URI for the voting record. - **dataHoraInicio** (string) - Date and time the vote started. - **dataHoraFim** (string) - Date and time the vote ended. - **descricao** (string) - Description of the vote. #### Response Example ```json { "dados": [ { "id": 12345, "uri": "https://dadosabertos.camara.leg.br/api/v2/votacoes/12345", "dataHoraInicio": "2023-10-27T14:00:00Z", "dataHoraFim": "2023-10-27T14:30:00Z", "descricao": "Votação do Projeto de Lei 1234/2023" } ] } ``` ``` -------------------------------- ### Legislative Sessions and Events API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Query information about plenary sessions, committee meetings, public hearings, and other legislative events, including schedules, participants, and proceedings. ```APIDOC ## GET /api/v2/eventos ### Description Lists legislative events within a specified date range. ### Method GET ### Endpoint /api/v2/eventos ### Query Parameters - **dataInicio** (string) - Required - The start date for the event search (YYYY-MM-DD). - **dataFim** (string) - Required - The end date for the event search (YYYY-MM-DD). - **ordem** (string) - Optional - Order of results (e.g., ASC, DESC). - **ordenarPor** (string) - Optional - Field to order results by (e.g., dataHoraInicio). ### Response #### Success Response (200) - **dados** (array) - List of events. - **id** (integer) - The unique identifier of the event. - **uri** (string) - The API URI for the event. - **dataHoraInicio** (string) - The start date and time of the event (ISO 8601 format). - **dataHoraFim** (string) - The end date and time of the event (ISO 8601 format). - **situacao** (string) - The status of the event. - **descricaoTipo** (string) - The type of event. - **descricao** (string) - A description of the event. - **localExterno** (string) - External location if applicable. - **orgaos** (array) - List of legislative bodies associated with the event. ### Response Example ```json { "dados": [ { "id": 65432, "uri": "https://dadosabertos.camara.leg.br/api/v2/eventos/65432", "dataHoraInicio": "2023-09-15T14:00", "dataHoraFim": "2023-09-15T18:00", "situacao": "Encerrado", "descricaoTipo": "Reunião Deliberativa", "descricao": "Comissão de Constituição e Justiça e de Cidadania", "localExterno": "", "orgaos": [ { "id": 2003, "uri": "https://dadosabertos.camara.leg.br/api/v2/orgaos/2003", "sigla": "CCJC", "nome": "Comissão de Constituição e Justiça e de Cidadania", "apelido": "CCJ" } ] } ] } ``` ``` ```APIDOC ## GET /api/v2/eventos/{id}/participantes ### Description Retrieves the participants of a specific legislative event. ### Method GET ### Endpoint /api/v2/eventos/{id}/participantes ### Path Parameters - **id** (integer) - Required - The ID of the event. ### Response #### Success Response (200) - **dados** (array) - List of participants. - *(Structure for participants not provided in the source text)* ### Response Example *(Example not provided in the source text)* ``` ```APIDOC ## GET /api/v2/eventos/{id}/pauta ### Description Retrieves the agenda items of a specific legislative event. ### Method GET ### Endpoint /api/v2/eventos/{id}/pauta ### Path Parameters - **id** (integer) - Required - The ID of the event. ### Response #### Success Response (200) - **dados** (array) - List of agenda items. - *(Structure for agenda items not provided in the source text)* ### Response Example *(Example not provided in the source text)* ``` -------------------------------- ### Political Party Historical Occurrences (HOPP) - CSV Data Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Provides comprehensive historical information about political party events including creation, extinction, name changes, mergers, and incorporations since 1935. ```APIDOC ## CSV Data - HOPP ### Description Download and parse the HOPP (Histórico de Ocorrências de Partidos Políticos) CSV dataset. ### Data Source `https://raw.githubusercontent.com/CamaraDosDeputados/dados-abertos/master/dados-extras/partidos/HOPP.csv` ### Columns - **id** (string) - Unique identifier for the occurrence. - **siglaPartido** (string) - Acronym of the political party. - **nome** (string) - Name of the political party. - **codOcorrencia** (integer) - Code for the type of occurrence. - **tituloOcorrencia** (string) - Title describing the occurrence (e.g., 'Criação', 'Alteração Nome', 'Fusão', 'Incorporação'). - **dataOcorrencia** (string) - Date of the occurrence (YYYY-MM-DD). - **idPartidoDestino** (string) - ID of the destination party in case of mergers or name changes. - **siglaPartidoDestino** (string) - Acronym of the destination party. - **descricaoOcorrencia** (string) - Detailed description of the occurrence. ### Usage Example (Python with Pandas) ```python import pandas as pd import requests from io import StringIO # Download and parse HOPP CSV url = "https://raw.githubusercontent.com/CamaraDosDeputados/dados-abertos/master/dados-extras/partidos/HOPP.csv" response = requests.get(url) response.encoding = 'utf-8' # Parse CSV with semicolon separator df = pd.read_csv(StringIO(response.text), sep=';', encoding='utf-8') # Examine structure print(df.columns.tolist()) # Find all party creation events creation_events = df[df['tituloOcorrencia'] == 'Criação'] print(f"Total parties created: {len(creation_events)}") # Track party name changes name_changes = df[df['tituloOcorrencia'] == 'Alteração Nome'] for idx, row in name_changes.iterrows(): print(f"{row['siglaPartido']} changed name on {row['dataOcorrencia']}") print(f" New party: {row['siglaPartidoDestino']}") print(f" Description: {row['descricaoOcorrencia']}") # Find parties that were merged or incorporated mergers = df[df['tituloOcorrencia'].isin(['Fusão', 'Incorporação'])] print(f"\nTotal merger/incorporation events: {len(mergers)}") ``` ``` -------------------------------- ### Deputy Information Retrieval API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt This API allows you to retrieve comprehensive information about Brazilian deputies, including biographical data, party affiliations, and legislative activities. It supports filtering by party and state, and provides pagination for large result sets. ```APIDOC ## GET /api/v2/deputados ### Description Retrieves a list of all current deputies. Supports filtering by party and state, and ordering results. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/deputados ### Parameters #### Query Parameters - **siglaPartido** (string) - Optional - Filter deputies by political party acronym. - **siglaUf** (string) - Optional - Filter deputies by state acronym. - **ordem** (string) - Optional - Order direction ('ASC' or 'DESC'). Defaults to 'ASC'. - **ordenarPor** (string) - Optional - Field to order results by (e.g., 'nome'). - **pagina** (integer) - Optional - Page number for pagination. - **itens** (integer) - Optional - Number of items per page. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/deputados?siglaPartido=PT&siglaUf=SP&ordem=ASC&ordenarPor=nome" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **dados** (array) - List of deputy objects. - **id** (integer) - Deputy's unique identifier. - **uri** (string) - API URI for the deputy. - **nome** (string) - Deputy's full name. - **siglaPartido** (string) - Deputy's political party acronym. - **uriPartido** (string) - API URI for the deputy's party. - **siglaUf** (string) - Deputy's state acronym. - **idLegislatura** (integer) - Current legislature ID. - **urlFoto** (string) - URL to the deputy's photo. - **email** (string) - Deputy's email address. - **links** (array) - Pagination links. #### Response Example ```json { "dados": [ { "id": 204554, "uri": "https://dadosabertos.camara.leg.br/api/v2/deputados/204554", "nome": "Deputy Name", "siglaPartido": "PT", "uriPartido": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835", "siglaUf": "SP", "idLegislatura": 57, "urlFoto": "https://www.camara.leg.br/internet/deputado/bandep/204554.jpg", "email": "dep.email@camara.leg.br" } ], "links": [ { "rel": "self", "href": "https://dadosabertos.camara.leg.br/api/v2/deputados" }, { "rel": "next", "href": "https://dadosabertos.camara.leg.br/api/v2/deputados?pagina=2&itens=15" } ] } ``` ## GET /api/v2/deputados/{id} ### Description Retrieves detailed information about a specific deputy identified by their ID. ### Method GET ### Endpoint https://dadosabertos.camara.leg.br/api/v2/deputados/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the deputy. ### Request Example ```bash curl -X GET "https://dadosabertos.camara.leg.br/api/v2/deputados/204554" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - Deputy's unique identifier. - **uri** (string) - API URI for the deputy. - **nome** (string) - Deputy's full name. - **siglaPartido** (string) - Deputy's political party acronym. - **uriPartido** (string) - API URI for the deputy's party. - **siglaUf** (string) - Deputy's state acronym. - **idLegislatura** (integer) - Current legislature ID. - **urlFoto** (string) - URL to the deputy's photo. - **email** (string) - Deputy's email address. #### Response Example ```json { "id": 204554, "uri": "https://dadosabertos.camara.leg.br/api/v2/deputados/204554", "nome": "Deputy Name", "siglaPartido": "PT", "uriPartido": "https://dadosabertos.camara.leg.br/api/v2/partidos/36835", "siglaUf": "SP", "idLegislatura": 57, "urlFoto": "https://www.camara.leg.br/internet/deputado/bandep/204554.jpg", "email": "dep.email@camara.leg.br" } ``` ``` -------------------------------- ### Process Parliamentary Voting Records - Node.js Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Parses parliamentary voting records from CSV files using Node.js and the 'csv-parser' library. It processes both overall voting data to analyze patterns like approval/rejection rates and average participation, and individual deputy votes to track voting behavior. Requires 'fs' and 'csv-parser' modules. ```javascript // Node.js example: Process voting data const fs = require('fs'); const csv = require('csv-parser'); // Parse voting records const votacoes = []; fs.createReadStream('dados-extras/votacoes/fontes/PlenVotacoes-ate_L55.csv') .pipe(csv({ separator: ';' })) .on('data', (row) => { votacoes.push({ id: row.codVotacao, data: row.datVotacao, resultado: row.txtResultado, descricao: row.txtDescricao, presentes: parseInt(row.qtdPresentes), sim: parseInt(row.qtdSim), nao: parseInt(row.qtdNao), abstencoes: parseInt(row.qtdAbstencoes) }); }) .on('end', () => { console.log(`Total votações processadas: ${votacoes.length}`); // Analyze voting patterns const aprovadas = votacoes.filter(v => v.resultado === 'Aprovado'); const rejeitadas = votacoes.filter(v => v.resultado === 'Rejeitado'); console.log(`Aprovadas: ${aprovadas.length}`); console.log(`Rejeitadas: ${rejeitadas.length}`); // Calculate average participation const avgParticipation = votacoes.reduce((sum, v) => sum + v.presentes, 0) / votacoes.length; console.log(`Média de presença: ${avgParticipation.toFixed(1)} deputados`); }); // Parse individual deputy votes const votos = []; fs.createReadStream('dados-extras/votacoes/fontes/PlenVotos-L50.csv') .pipe(csv({ separator: ';' })) .on('data', (row) => { votos.push({ votacaoId: row.codVotacao, deputadoId: row.codDeputado, voto: row.txtVoto, partido: row.siglaPartido, uf: row.siglaUF }); }) .on('end', () => { // Analyze deputy voting behavior const votosPorDeputado = {}; votos.forEach(v => { if (!votosPorDeputado[v.deputadoId]) { votosPorDeputado[v.deputadoId] = { sim: 0, nao: 0, abstencao: 0, total: 0 }; } votosPorDeputado[v.deputadoId].total++; if (v.voto === 'Sim') votosPorDeputado[v.deputadoId].sim++; if (v.voto === 'Não') votosPorDeputado[v.deputadoId].nao++; if (v.voto === 'Abstenção') votosPorDeputado[v.deputadoId].abstencao++; }); console.log(`Deputies tracked: ${Object.keys(votosPorDeputado).length}`); }); ``` -------------------------------- ### REST API: Query Parliamentary Fronts Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Access information about parliamentary fronts (frentes parlamentares), which are cross-party groups focused on specific themes. Supports filtering by legislature number and retrieving members of a front. Requires an 'Accept: application/json' header. ```bash # List all parliamentary fronts curl -X GET "https://dadosabertos.camara.leg.br/api/v2/frentes?ordem=ASC&ordenarPor=titulo" \ -H "Accept: application/json" # Filter by legislature number curl -X GET "https://dadosabertos.camara.leg.br/api/v2/frentes?idLegislatura=57" \ -H "Accept: application/json" # Get members of a parliamentary front curl -X GET "https://dadosabertos.camara.leg.br/api/v2/frentes/54321/membros" \ -H "Accept: application/json" ``` -------------------------------- ### Validate Deputy Party Affiliations (Python) Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Validates deputy party affiliations against historical records from the hopp_df. It checks if a deputy's party has been extinct and prints warnings or informational messages. Dependencies include pandas. ```python import pandas as pd # Assuming deputies_df and hopp_df are pre-loaded pandas DataFrames # deputies_df: DataFrame with deputy information # hopp_df: DataFrame with historical party information for idx, deputy in deputies_df.iterrows(): party_history = hopp_df[hopp_df['siglaPartido'] == deputy['siglaPartido']] if len(party_history) > 0: creation = party_history[party_history['tituloOcorrencia'] == 'Criação'] extinction = party_history[party_history['tituloOcorrencia'] == 'Extinção'] if len(extinction) > 0: print(f"WARNING: Deputy {deputy['nome']} affiliated with extinct party {deputy['siglaPartido']}") else: print(f"INFO: Party {deputy['siglaPartido']} not found in historical records") ``` -------------------------------- ### Parliamentary Fronts API Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Access information about parliamentary fronts (frentes parlamentares), which are cross-party groups focused on specific themes or policy areas. ```APIDOC ## GET /api/v2/frentes ### Description Lists all parliamentary fronts. ### Method GET ### Endpoint /api/v2/frentes ### Query Parameters - **ordem** (string) - Optional - Order of results (e.g., ASC, DESC). - **ordenarPor** (string) - Optional - Field to order results by (e.g., titulo). - **idLegislatura** (integer) - Optional - Filter by legislature number. ### Response #### Success Response (200) - **dados** (array) - List of parliamentary fronts. - **id** (integer) - The unique identifier of the front. - **uri** (string) - The API URI for the front. - **titulo** (string) - The title of the front. - **idLegislatura** (integer) - The legislature number associated with the front. ### Response Example ```json { "dados": [ { "id": 54321, "uri": "https://dadosabertos.camara.leg.br/api/v2/frentes/54321", "titulo": "Frente Parlamentar da Educação", "idLegislatura": 57 } ] } ``` ``` ```APIDOC ## GET /api/v2/frentes/{id}/membros ### Description Retrieves the members of a specific parliamentary front. ### Method GET ### Endpoint /api/v2/frentes/{id}/membros ### Path Parameters - **id** (integer) - Required - The ID of the parliamentary front. ### Response #### Success Response (200) - **dados** (array) - List of members. - *(Structure for members not provided in the source text)* ### Response Example *(Example not provided in the source text)* ``` -------------------------------- ### REST API: Query Legislative Bodies and Committees Source: https://context7.com/camaradosdeputados/dados-abertos/llms.txt Access information about permanent committees, special commissions, parliamentary inquiry committees (CPIs), and other legislative bodies. Supports filtering by type and retrieving members or events associated with a body. Requires an 'Accept: application/json' header. ```bash # List all legislative bodies curl -X GET "https://dadosabertos.camara.leg.br/api/v2/orgaos?ordem=ASC&ordenarPor=sigla" \ -H "Accept: application/json" # Filter by body type (2 = permanent committee) curl -X GET "https://dadosabertos.camara.leg.br/api/v2/orgaos?codTipo=2" \ -H "Accept: application/json" # Get members of a committee curl -X GET "https://dadosabertos.camara.leg.br/api/v2/orgaos/2003/membros" \ -H "Accept: application/json" # Get events held by a committee curl -X GET "https://dadosabertos.camara.leg.br/api/v2/orgaos/2003/eventos?dataInicio=2023-01-01&dataFim=2023-12-31" \ -H "Accept: application/json" ```