-
Notifications
You must be signed in to change notification settings - Fork 1
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
Filtra serviços de GPS com base no GTFS para dash GPS SPPO 8 dias #108
Open
igorlaltuf
wants to merge
4
commits into
prefeitura-rio:master
Choose a base branch
from
igorlaltuf:dashboard_gps_sppo_8_dias
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,21 @@ | ||
# Dados para o dashboard "GPS dos ônibus" | ||
* Versão: 0.1 | ||
* Data de início: 13/07/2023 | ||
|
||
|
||
## 1. Resumo | ||
|
||
Este modelo tem por objetivo tratar os dados de GPS para que eles sejam exibidos no dashboard de "[GPS dos ônibus](https://app.powerbi.com/view?r=eyJrIjoiZTljNzIxNTAtN2QxZS00OTczLThjMjUtNWY1NjdjZWVlODZmIiwidCI6IjkwNzI2YWVlLWQwMmMtNDlmZS05ODlmLTQ1ZGVmM2QwNjlkYyJ9)". | ||
|
||
|
||
## 2. Etapas | ||
|
||
### 2.1 Importação | ||
O modelo utilizou dados das seguintes tabelas: | ||
|
||
rj-smtr.dashboards.gps_sppo_8_dias | ||
|
||
rj-smtr.projeto_subsidio_sppo.viagem_planejada | ||
|
||
### 2.2 Transformações | ||
Os dados da tabela gps_sppo_8_dias foram filtrados de forma que o resultado final incluisse apenas aqueles serviços presentes na tabela viagem_planejada. |
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,21 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: sppo_gps_8_dias | ||
description: "sppo_gps_8_dias" | ||
columns: | ||
- name: id_veiculo | ||
description: "Número do veículo configurado no equipamento." | ||
- name: servico | ||
description: "Código do serviço." | ||
- name: latitude | ||
description: "Latitude do veículo no momento da captura do sinal de GPS." | ||
- name: longitude | ||
description: "Longitude do veículo no momento da captura do sinal de GPS." | ||
- name: data | ||
description: "Data de captura do sinal de GPS no formato yyyy-mm-dd." | ||
- name: hora | ||
description: "Horário de captura do sinal de GPS no formato HH:mm:ss." | ||
- name: timestamp_gps | ||
description: "Timestamp de captura do sinal de GPS no formato yyyy-mm-dd T HH:mm:ss." | ||
|
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,32 @@ | ||
/* Criar a tabela para ser usada no dashboard sobre GPS 8 dias*/ | ||
|
||
WITH | ||
gtfs AS ( | ||
SELECT DISTINCT | ||
route_short_name | ||
FROM | ||
`rj-smtr.br_rj_riodejaneiro_sigmob.routes_desaninhada` | ||
WHERE | ||
agency_id IN ('22002', '22003', '22004', '22005')), | ||
gps AS ( | ||
SELECT | ||
id_veiculo, | ||
servico, | ||
latitude, | ||
longitude, | ||
DATE(timestamp_gps) AS data, | ||
TIME(timestamp_gps) AS hora, | ||
timestamp_gps | ||
FROM | ||
rj-smtr.br_rj_riodejaneiro_veiculos.gps_sppo | ||
WHERE | ||
data between date_sub(current_date(), interval 8 day) and CURRENT_DATE() ) | ||
SELECT | ||
gps.* | ||
FROM | ||
gps | ||
JOIN | ||
gtfs | ||
ON gps.servico = route_short_name | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
atualizar com o sigmob v2