-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into br_cnj_improbidade_administrativa.condenacao
- Loading branch information
Showing
37 changed files
with
5,783 additions
and
62 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
18 changes: 18 additions & 0 deletions
18
models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__cid_10.sql
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,18 @@ | ||
{{ | ||
config( | ||
alias="cid_10", | ||
schema="br_bd_diretorios_brasil", | ||
materialized="table", | ||
) | ||
}} | ||
|
||
select | ||
safe_cast(subcategoria as string) subcategoria, | ||
safe_cast(descricao_subcategoria as string) descricao_subcategoria, | ||
safe_cast(categoria as string) categoria, | ||
safe_cast(descricao_categoria as string) descricao_categoria, | ||
safe_cast(capitulo as string) capitulo, | ||
safe_cast(descricao_capitulo as string) descricao_capitulo, | ||
safe_cast(causa_violencia as int64) causa_violencia, | ||
safe_cast(causa_overdose as int64) causa_overdose, | ||
from `basedosdados-dev.br_bd_diretorios_brasil_staging.cid_10` as t |
12 changes: 12 additions & 0 deletions
12
models/br_bd_diretorios_brasil/br_bd_diretorios_brasil__natureza_juridica.sql
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,12 @@ | ||
{{ | ||
config( | ||
alias="natureza_juridica", | ||
schema="br_bd_diretorios_brasil", | ||
materialized="table", | ||
) | ||
}} | ||
select | ||
safe_cast(id_natureza_juridica as string) as id_natureza_juridica, | ||
safe_cast(descricao as string) as descricao, | ||
safe_cast(escopo as string) as escopo | ||
from `basedosdados-dev.br_bd_diretorios_brasil_staging.natureza_juridica` as t |
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
46 changes: 46 additions & 0 deletions
46
models/br_camara_dados_abertos/br_camara_dados_abertos__despesa.sql
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,46 @@ | ||
{{ config(alias="despesa", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(initcap(txnomeparlamentar) as string) nome_parlamentar, | ||
safe_cast(replace(cpf, ".0", "") as string) cpf, | ||
safe_cast(replace(idecadastro, ".0", "") as string) id_deputado, | ||
safe_cast(nulegislatura as int64) ano_legislatura, | ||
safe_cast(sguf as string) sigla_uf, | ||
safe_cast(sgpartido as string) sigla_partido, | ||
safe_cast(codlegislatura as string) id_legislatura, | ||
safe_cast(txtdescricao as string) categoria_despesa, | ||
safe_cast(txtdescricaoespecificacao as string) subcategoria_despesa, | ||
safe_cast(txtfornecedor as string) fornecedor, | ||
safe_cast(txtcnpjcpf as string) cnpj_cpf_fornecedor, | ||
safe_cast(txtnumero as string) numero_documento_fiscal, | ||
case | ||
when indtipodocumento = '0' | ||
then 'Nota fiscal' | ||
when indtipodocumento = '1' | ||
then 'Recibo ou outros' | ||
when indtipodocumento = '2' | ||
then 'Documento emitido no exterior' | ||
when indtipodocumento = '3' | ||
then 'Despesa do Parlasul' | ||
when indtipodocumento = '4' | ||
then 'Nota fiscal eletrônica' | ||
when indtipodocumento = '5' | ||
then 'Nota fiscal eletrônica' | ||
else indtipodocumento | ||
end as tipo_documento, | ||
safe_cast(numano as int64) as ano_competencia, | ||
safe_cast(nummes as int64) as mes_competencia, | ||
safe_cast( | ||
split(format_timestamp('%Y-%m-%dT%H:%M:%E*S', timestamp(datemissao)), 'T')[ | ||
offset(0) | ||
] as date | ||
) data_emissao, | ||
safe_cast(vlrdocumento as float64) valor_documento, | ||
safe_cast(vlrglosa as float64) valor_retido, | ||
safe_cast(vlrliquido as float64) valor_liquido, | ||
safe_cast(numparcela as int64) numero_parcela, | ||
safe_cast(txtpassageiro as string) nome_passageiro, | ||
safe_cast(txttrecho as string) descricao_passagem_aerea, | ||
safe_cast(datpagamentorestituicao as datetime) data_pagamento_restituicao, | ||
safe_cast(vlrrestituicao as float64) valor_restituicao, | ||
safe_cast(urldocumento as string) url_documento, | ||
from `basedosdados-dev.br_camara_dados_abertos_staging.despesa` as t |
3 changes: 1 addition & 2 deletions
3
models/br_camara_dados_abertos/br_camara_dados_abertos__frente_deputado.sql
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
{{ config(alias="frente_deputado", schema="br_camara_dados_abertos") }} | ||
select distinct | ||
safe_cast(id as string) id_frente, | ||
safe_cast(titulo as string) titulo, | ||
safe_cast(titulo as string) titulo_deputado, | ||
safe_cast(replace(id_deputado, ".0", "") as string) id_deputado, | ||
initcap(nome_deputado) nome_deputado, | ||
safe_cast(titulo_deputado as string) titulo_deputado, | ||
safe_cast(url_foto_deputado as string) url_foto_deputado, | ||
from `basedosdados-dev.br_camara_dados_abertos_staging.frente_deputado` as t |
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
Oops, something went wrong.