Skip to content

Commit

Permalink
Merge pull request #419 from basedosdados/censo-2022-coordenadas
Browse files Browse the repository at this point in the history
[dbt]: `br_ibge_censo_2022.coordenada_endereco`
  • Loading branch information
arthurfg authored Feb 6, 2024
2 parents a1c48bc + cc5cc79 commit bab6213
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(alias='coordenada_endereco',
schema='br_ibge_censo_2022',
materialized='table',
cluster_by = ["id_municipio", "id_uf", "especie_endereco"])}}

SELECT
SAFE_CAST(id_uf AS STRING) id_uf,
SAFE_CAST(COD_MUN AS STRING) id_municipio,
SAFE_CAST(COD_ESPECIE AS STRING) especie_endereco,
SAFE_CAST(NV_GEO_COORD AS STRING) nivel_geo_coordenada,
SAFE_CAST(LATITUDE AS FLOAT64) latitude,
SAFE_CAST(LONGITUDE AS FLOAT64) longitude,
ST_GEOGPOINT(SAFE_CAST(LONGITUDE AS FLOAT64),SAFE_CAST(LATITUDE AS FLOAT64)) ponto
FROM basedosdados-staging.br_ibge_censo_2022_staging.coordenada_endereco AS t



10 changes: 10 additions & 0 deletions models/br_ibge_censo_2022/br_ibge_censo_2022__dicionario.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ config(alias='dicionario', schema='br_ibge_censo_2022') }}

SELECT
SAFE_CAST(id_tabela AS STRING) id_tabela,
SAFE_CAST(nome_coluna AS STRING) nome_coluna,
SAFE_CAST(chave AS STRING) chave,
SAFE_CAST(cobertura_temporal AS STRING) cobertura_temporal,
SAFE_CAST(valor AS STRING) valor

FROM basedosdados-staging.br_ibge_censo_2022_staging.dicionario AS t
65 changes: 65 additions & 0 deletions models/br_ibge_censo_2022/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,68 @@ models:
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: br_ibge_censo_2022__coordenada_endereco
description: Coordenadas geográficas das espécies de endereços do Censo 2022
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- id_municipio
- id_uf
- latitude
- longitude
- nivel_geo_coordenada
columns:
- name: id_municipio
description: ID Município IBGE - 7 Dígitos
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- relationships:
to: ref('br_bd_diretorios_brasil__municipio')
field: id_municipio
- name: id_uf
description: ID da Unidade da Federação
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- relationships:
to: ref('br_bd_diretorios_brasil__uf')
field: id
- name: especie_endereco
description: Espécie de endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: nivel_geo_coordenada
description: Nível de geocodificação
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: latitude
description: Latitude da Coordenada de Localização da Espécie do Endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: longitude
description: Longitude da Coordenada de Localização da Espécie do Endereço
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: ponto
description: Ponto geográfico criado a partir das colunas longitude e latitude.
tests:
- dbt_utils.not_null_proportion:
at_least: 0.05
- name: br_ibge_censo_2022__dicionario
description: Dicionário
columns:
- name: id_tabela
description: ID Tabela
- name: nome_coluna
description: Nome da coluna
- name: chave
description: Chave
- name: cobertura_temporal
description: Cobertura temporal
- name: valor
description: Valor

0 comments on commit bab6213

Please sign in to comment.