-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds coordinates raw model; improves ap model; adds geolocation on mv…
…a; adds tags to models
- Loading branch information
1 parent
3653502
commit b423268
Showing
8 changed files
with
173 additions
and
18 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
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
16 changes: 16 additions & 0 deletions
16
models/raw/area_programatica/_area_programatica_schema.yml
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,16 @@ | ||
models: | ||
- name: raw_area_programatica__bairros_aps | ||
description: As Áreas Programáticas de Saúde do Rio de Janeiro são 10 grandes regiões que dividem a cidade para fins de planejamento e gestão. Essa divisão facilita a organização do sistema de saúde e permite identificar e abordar problemas específicos de cada área. | ||
columns: | ||
- name: bairro | ||
description: A coluna 'bairro' representa o nome do bairro na cidade do Rio de Janeiro. | ||
data_type: string | ||
quote: true | ||
- name: ap | ||
description: A coluna 'ap' representa o código da Área Programática, um identificador único para cada uma das 10 Áreas Programáticas da cidade do Rio de Janeiro. | ||
data_type: int64 | ||
quote: true | ||
- name: ap_titulo | ||
description: A coluna 'ap_titulo' representa o nome ou título da Área Programática correspondente. | ||
data_type: string | ||
quote: true |
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 |
---|---|---|
|
@@ -6,5 +6,3 @@ sources: | |
schema: brutos_area_programatica_staging | ||
tables: | ||
- name: bairros_aps | ||
|
||
|
17 changes: 7 additions & 10 deletions
17
models/raw/area_programatica/raw_area_programatica__bairros_aps.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,13 +1,10 @@ | ||
{{ | ||
config( | ||
alias="bairros_aps", | ||
schema= "brutos_area_programatica" | ||
) | ||
}} | ||
{{ config(alias="bairros_aps", schema="brutos_area_programatica") }} | ||
|
||
with source as ( | ||
select * from {{ source('brutos_area_programatica_staging', 'bairros_aps') }} | ||
) | ||
with | ||
source as ( | ||
select bairro, ap, ap_titulo | ||
from {{ source("brutos_area_programatica_staging", "bairros_aps") }} | ||
) | ||
|
||
select * | ||
from source | ||
from source |
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,64 @@ | ||
models: | ||
- name: raw_geo_pgeo3__estabelecimentos_coordenadas | ||
description: O modelo raw_geo_pgeo3__estabelecimentos_coordenadas contém dados geográficos relacionados a estabelecimentos de saúde. Estes dados são municipais, provenientes da API do IPP. | ||
columns: | ||
- name: id_cnes | ||
description: Esta coluna representa o identificador único do estabelecimento de saúde. É um número de sete dígitos, preenchido com zeros à esquerda caso o número original tenha menos de sete dígitos. | ||
data_type: string | ||
quote: true | ||
- name: endereco_cep | ||
description: Esta coluna representa o Código de Endereçamento Postal (CEP) do endereço do estabelecimento de saúde. É um número de oito dígitos, preenchido com zeros à esquerda caso o número original tenha menos de oito dígitos. | ||
data_type: string | ||
quote: true | ||
- name: endereco_bairro | ||
description: Esta coluna representa o bairro do endereço do estabelecimento de saúde. | ||
data_type: string | ||
quote: true | ||
- name: endereco_logradouro | ||
description: Esta coluna contém o nome da rua do estabelecimento. | ||
data_type: string | ||
quote: true | ||
- name: endereco_numero | ||
description: Esta coluna contém o número do endereço do estabelecimento. | ||
data_type: string | ||
quote: true | ||
- name: latitude_cep | ||
description: Esta coluna contém a latitude do estabelecimento com base no CEP. | ||
data_type: float64 | ||
quote: true | ||
- name: longitude_cep | ||
description: Esta coluna representa a longitude do CEP do estabelecimento. | ||
data_type: float64 | ||
quote: true | ||
- name: latitude_addr | ||
description: Esta coluna representa a latitude do endereço do estabelecimento. | ||
data_type: float64 | ||
quote: true | ||
- name: longitude_addr | ||
description: Esta coluna representa a longitude do endereço do estabelecimento. | ||
data_type: float64 | ||
quote: true | ||
- name: latitude_api | ||
description: Latitude final à ser considerada (Tenta preencher com addr, e caso não consiga, tenta preencher com cep). | ||
data_type: float64 | ||
quote: true | ||
- name: longitude_api | ||
description: Longitude final à ser considerada (Tenta preencher com addr, e caso não consiga, tenta preencher com cep). | ||
data_type: float64 | ||
quote: true | ||
- name: data_extracao | ||
description: A data e hora em que os dados foram extraídos. | ||
data_type: datetime | ||
quote: true | ||
- name: ano_particao | ||
description: Esta coluna representa o ano da partição. | ||
data_type: int64 | ||
quote: true | ||
- name: mes_particao | ||
description: Esta coluna representa o mês da partição. | ||
data_type: int64 | ||
quote: true | ||
- name: data_particao | ||
description: Esta coluna representa a data da partição. É baseada na data_extração, e é utilizada para fins de organização dos dados e consultas mais rápidas. | ||
data_type: date | ||
quote: true |
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,8 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: brutos_geo_pgeo3_staging | ||
database: rj-sms | ||
schema: brutos_geo_pgeo3_staging | ||
tables: | ||
- name: estabelecimentos_coordenadas |
40 changes: 40 additions & 0 deletions
40
models/raw/geo_pgeo3/raw_geo_pgeo3__estabelecimentos_coordenadas.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,40 @@ | ||
{{ | ||
config( | ||
schema="brutos_geo_pgeo3", | ||
alias="estabelecimentos_coordenadas", | ||
partition_by={ | ||
"field": "data_particao", | ||
"data_type": "date", | ||
"granularity": "month", | ||
}, | ||
) | ||
}} | ||
|
||
with | ||
source as ( | ||
select | ||
lpad(id_cnes, 7, '0') as id_cnes, | ||
lpad(endereco_cep, 8, '0') as endereco_cep, | ||
|
||
endereco_bairro, | ||
endereco_logradouro, | ||
endereco_numero, | ||
|
||
safe_cast(latitude_cep as float64) as latitude_cep, | ||
safe_cast(longitude_cep as float64) as longitude_cep, | ||
safe_cast(latitude_addr as float64) as latitude_addr, | ||
safe_cast(longitude_addr as float64) as longitude_addr, | ||
safe_cast(latitude_api as float64) as latitude_api, | ||
safe_cast(longitude_api as float64) as longitude_api, | ||
|
||
safe_cast(data_extracao as datetime) as data_extracao, | ||
safe_cast(ano_particao as int64) as ano_particao, | ||
safe_cast(mes_particao as int64) as mes_particao, | ||
safe_cast(data_particao as date) as data_particao | ||
|
||
from {{ source("brutos_geo_pgeo3_staging", "estabelecimentos_coordenadas") }} | ||
|
||
) | ||
|
||
select * | ||
from source |