Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrige tratamento de viagens #234

Merged
merged 15 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pipelines/migration/projeto_subsidio_sppo/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
Flows for projeto_subsidio_sppo

DBT: 2024-09-16
DBT: 2024-09-17
"""

from prefect import Parameter, case, task
Expand Down
10 changes: 10 additions & 0 deletions queries/models/projeto_subsidio_sppo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog - projeto_subsidio_sppo

## [9.0.2] - 2024-09-17

### Corrigido

- corrigidas as referencias a tabela `gps_sppo` em `aux_registro_status_trajeto` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/234)

### Alterado

- Alterada a consulta por shapes em `aux_registro_status_trajeto` para buscar o feed_start_date do particionamento da tabela shapes_geom em `data_versao_efetiva`(https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/234)

## [9.0.1] - 2024-09-11

### Alterado
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-- depends_on: {{ ref('subsidio_data_versao_efetiva') }}
{% if execute %}
{% set result = run_query("SELECT feed_start_date FROM " ~ ref('subsidio_data_versao_efetiva') ~ " WHERE data BETWEEN DATE_SUB(DATE('" ~ var("run_date") ~ "'), INTERVAL 2 DAY) AND DATE_SUB(DATE('" ~ var("run_date") ~ "'), INTERVAL 1 DAY)") %}
{% set feed_start_dates = result.columns[0].values() %}
{% endif %}

{% if var("run_date") == "2024-05-05" %}
-- Apuração "Madonna · The Celebration Tour in Rio"
{% set gps_interval = 7 %}
Expand Down Expand Up @@ -27,7 +33,8 @@ with gps as (
date_sub(date("{{ var("run_date") }}"), interval 1 day) as data_operacao
{% endif %}
from
`rj-smtr.br_rj_riodejaneiro_veiculos.gps_sppo` g -- {{ ref('gps_sppo') }} g
-- `rj-smtr.br_rj_riodejaneiro_veiculos.gps_sppo` g
{{ ref('gps_sppo') }} g
where (
data between date_sub(date("{{ var("run_date") }}"), interval 1 day) and date("{{ var("run_date") }}")
)
Expand Down Expand Up @@ -116,7 +123,8 @@ with gps as (
ST_GEOGPOINT(longitude, latitude) posicao_veiculo_geo,
date_sub(date("{{ var("run_date") }}"), interval 1 day) as data_operacao
from
`rj-smtr.br_rj_riodejaneiro_veiculos.gps_sppo` g -- {{ ref('gps_sppo') }} g
-- `rj-smtr.br_rj_riodejaneiro_veiculos.gps_sppo` g
{{ ref('gps_sppo') }} g
where (
data between date_sub(date("{{ var("run_date") }}"), interval 1 day) and date("{{ var("run_date") }}")
)
Expand All @@ -133,8 +141,9 @@ shapes AS (
*
FROM
{{ ref("shapes_geom_gtfs") }}
-- rj-smtr.gtfs.shapes_geom
WHERE
date_sub(date("{{ var("run_date") }}"), interval 1 day) BETWEEN feed_start_date AND feed_end_date
feed_start_date IN ('{{ feed_start_dates|join("', '") }}')
),
-- 3. Deduplica viagens planejadas
viagem_planejada AS (
Expand Down
Loading