Skip to content

Commit

Permalink
Merge branch 'main' into staging/pseudoanon-cliente-jae
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 5, 2024
2 parents 79a1b63 + 88954dc commit 316f5eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions queries/models/transito/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog - infracao

## [1.0.1] - 2024-09-04

### Corrigido

- Corrige colunas `status_infracao` e `descricao_situacao_autuacao` e o filtro incremental da tabela altuacao (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/186/)

## [1.0.0] - 2024-08-03

### Adicionado
Expand Down
6 changes: 3 additions & 3 deletions queries/models/transito/autuacao.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

WITH citran AS (
SELECT
DATE(data) AS data,
data,
id_auto_infracao,
DATETIME(concat(data,' ',hora,':00')) AS datetime_autuacao,
data_limite_defesa_previa,
data_limite_recurso,
NULL AS descricao_situacao_autuacao,
situacao_atual AS descricao_situacao_autuacao,
IF(status_infracao != "", status_infracao, NULL) AS status_infracao,
IF(codigo_enquadramento != "", codigo_enquadramento, NULL) AS codigo_enquadramento,
IF(tipificacao_resumida != "", tipificacao_resumida, NULL) AS tipificacao_resumida,
Expand Down Expand Up @@ -52,7 +52,7 @@ WITH citran AS (
FROM {{ ref('autuacao_citran') }}
{% if is_incremental() %}
WHERE
data BETWEEN DATE("{var('date_range_start')}") AND DATE("{var('date_range_end')}")
data BETWEEN DATE("{{var('date_range_start')}}") AND DATE("{{var('date_range_end')}}")
{% endif %}
)

Expand Down
4 changes: 2 additions & 2 deletions queries/models/transito/staging/autuacao_citran.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@


SELECT
data,
DATE(data) AS data,
SAFE_CAST(JSON_VALUE(content,'$.Hora') AS STRING) hora,
Cod__Detran as id_auto_infracao,
IF(JSON_VALUE(content, '$.DtLimDP') != '', SAFE_CAST(PARSE_DATE('%d/%m/%Y', JSON_VALUE(content,'$.DtLimDP')) AS STRING), NULL) data_limite_defesa_previa,
IF(JSON_VALUE(content, '$.DtLimR') != '', SAFE_CAST(PARSE_DATE('%d/%m/%Y', JSON_VALUE(content,'$.DtLimR')) AS STRING), NULL) data_limite_recurso,
SAFE_CAST(JSON_VALUE(content,'$.Situacao Atual') AS STRING) situacao_atual,
SAFE_CAST(JSON_VALUE(content,'$.St. Infracao') AS STRING) status_infracao,
SAFE_CAST(JSON_VALUE(content,'$."St. Infracao"') AS STRING) status_infracao,
SAFE_CAST(JSON_VALUE(content,'$.Multa') AS STRING) codigo_enquadramento,
SAFE_CAST(JSON_VALUE(content,'$.DsInf') AS STRING) tipificacao_resumida,
SAFE_CAST(JSON_VALUE(content,'$.Po') AS STRING) pontuacao,
Expand Down

0 comments on commit 316f5eb

Please sign in to comment.