Skip to content

Commit

Permalink
Ajusta GTFS para Domingo CNU (#224)
Browse files Browse the repository at this point in the history
* commit inicial

* fix treatment

* Altera flow

* Incorpora changelog

* ajusta changelog

* atualiza changelog

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
eng-rodrigocunha and mergify[bot] committed Sep 13, 2024
1 parent c35e9b4 commit f448d9c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
7 changes: 7 additions & 0 deletions pipelines/migration/br_rj_riodejaneiro_gtfs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog - gtfs

## [1.1.1] - 2024-09-13

### Alterado

- Inserido ajuste para o tipo_os `CNU` com feed_start_date `2024-08-16` considerar o planejamento do GTFS de sábado no domingo. Afetado o modelo `ordem_servico_trips_shapes_gtfs.sql` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/224)
- Ajustado tratamento dos modelos `ordem_servico_sentido_atualizado_aux_gtfs.sql` e `ordem_servico_trips_shapes_gtfs.sql` em razão da apuração por faixa horária `DATA_SUBSIDIO_V9_INICIO` (https://github.com/prefeitura-rio/pipelines_rj_smtr/pull/224)

## [1.1.0] - 2024-09-11

### Alterado
Expand Down
2 changes: 1 addition & 1 deletion pipelines/migration/br_rj_riodejaneiro_gtfs/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Flows for gtfs
DBT: 2024-09-10
DBT: 2024-09-13
"""

from prefect import Parameter, case, task
Expand Down
16 changes: 13 additions & 3 deletions queries/models/gtfs/ordem_servico_sentido_atualizado_aux_gtfs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ LEFT JOIN
USING
(feed_version, servico)
WHERE
distancia_planejada != 0
AND distancia_total_planejada != 0
AND (partidas != 0 OR partidas IS NULL)
(
(
feed_start_date < '{{ var("DATA_SUBSIDIO_V9_INICIO") }}'
AND
(
distancia_planejada != 0
AND distancia_total_planejada != 0
AND (partidas != 0 OR partidas IS NULL)
)
)
OR
feed_start_date >= '{{ var("DATA_SUBSIDIO_V9_INICIO") }}'
)
21 changes: 17 additions & 4 deletions queries/models/gtfs/ordem_servico_trips_shapes_gtfs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ WITH
AND o.servico = t.trip_short_name
AND
(o.tipo_dia = t.tipo_dia
OR (o.tipo_dia = "Ponto Facultativo" AND t.tipo_dia = "Dia Útil"))
OR (o.tipo_dia = "Ponto Facultativo" AND t.tipo_dia = "Dia Útil")
OR (o.feed_start_date = "2024-08-16" AND o.tipo_os = "CNU" AND o.tipo_dia = "Domingo" AND t.tipo_dia = "Sabado")) -- Domingo CNU
AND
((o.sentido IN ("I", "C") AND t.direction_id = "0")
OR (o.sentido = "V" AND t.direction_id = "1"))
Expand Down Expand Up @@ -217,7 +218,19 @@ LEFT JOIN
-- rj-smtr-dev.gtfs.ordem_servico_faixa_horaria AS fh
USING
(feed_version, feed_start_date, tipo_os, tipo_dia, servico)
{% if is_incremental() -%}
WHERE
feed_start_date = '{{ var("data_versao_gtfs") }}'
{% endif -%}
{% if is_incremental() -%}
feed_start_date = '{{ var("data_versao_gtfs") }}' AND
{% endif -%}
(
(
feed_start_date >= '{{ var("DATA_SUBSIDIO_V9_INICIO") }}'
AND
(
fh.quilometragem != 0
AND (fh.partidas != 0 OR fh.partidas IS NULL)
)
)
OR
feed_start_date < '{{ var("DATA_SUBSIDIO_V9_INICIO") }}'
)

0 comments on commit f448d9c

Please sign in to comment.