Skip to content

Instantly share code, notes, and snippets.

View kguidonimartins's full-sized avatar

Karlo Guidoni kguidonimartins

View GitHub Profile

Testes de qualidade de dados

Este documento é um espelho das especificações para testes de validação de dados em Darwin Core definidos pelo TDWG em https://github.com/tdwg/bdq/projects/2. As especificações foram extraídas do link anterior por um processo automatizado permitindo acompanhar a evolução e a proposição de novas especificações, quando disponíveis. Atualmente, quatro tipos de testes foram sugeridos:

  • Validation: indica teste do tipo de validação dos dados;

  • Amendment: teste que propõem mudanças e/ou melhoria dos dados;

  • Issue: teste que aponta problemas com o dado informado e necessita de intervenção do usuário para determinar se o dado é adequado para uso;

@kguidonimartins
kguidonimartins / create-dwc-table.R
Last active August 8, 2023 11:54
Darwin Core classes e termos
## ver também: https://github.com/sibbr/DarwinCoreBrasil
dwc_table <-
structure(list(classe = c("Record-level", "Record-level", "Record-level",
"Record-level", "Record-level", "Record-level", "Record-level",
"Record-level", "Record-level", "Record-level", "Record-level",
"Record-level", "Record-level", "Record-level", "Record-level",
"Record-level", "Record-level", "Record-level", "Record-level",
"Occurrence", "Occurrence", "Occurrence", "Occurrence", "Occurrence",
"Occurrence", "Occurrence", "Occurrence", "Occurrence", "Occurrence",
@kguidonimartins
kguidonimartins / get-capitais-br-coords.R
Created March 29, 2023 16:47
Obtenção das coordenadas geográficas da sede das capitais do Brasil via `{geobr}`
## -*- mode: ess-r; coding: utf-8-*-
## scratch-mode: ess-r-mode
## created-at: 20230329-111607
### Obtenção das coordenadas geográficas da sede das capitais do Brasil via `{geobr}`
if (!require("tidyverse")) install.packages("tidyverse")
if (!require("sf")) install.packages("sf")
if (!require("geobr")) install.packages("geobr")
if (!require("tidyverse")) install.packages("tidyverse")
if (!require("jsonlite")) install.packages("jsonlite")
url <- "https://resultados.tse.jus.br/oficial/ele2022/544/dados-simplificados/br/br-c0001-e000544-r.json"
jsonlite::fromJSON(url) %>%
purrr::pluck("cand") %>%
dplyr::select(nm, pvap)
fix_invalid_geometries <- function(data) {
is_valid <- st_is_valid(data)
invalid_geom <- data[!is_valid, ]
geom_valid <- data[is_valid, ]
sf_use_s2(TRUE)

Keybase proof

I hereby claim:

  • I am kguidonimartins on github.
  • I am karloguidoni (https://keybase.io/karloguidoni) on keybase.
  • I have a public key whose fingerprint is AC50 CF5F A1D6 C627 D6F7 D8D6 C488 C40C 2D08 30CB

To claim this, I am signing this object:

if (!require("ade4")) install.packages("ade4")
#> Loading required package: ade4
# Where am I?
getwd()
#> [1] "/tmp/RtmpK0kjbc/reprex2437bf19e2d4b1"
folder <- "kleyer-files"
data_zip <- paste0(folder, "/", "data.zip")
#!/usr/bin/env sh
echo "Hey!"
@kguidonimartins
kguidonimartins / FleaTree.tre
Created May 16, 2020 22:08
getting help `{phyr}`
(((((Tarsopsylla_octodecimdentata:1.0,(Myoxopsylla_jordani:1.0,(((Nosopsyllus_mokrzeckyi:1.0,(Nosopsyllus_fidus:1.0,(Nosopsyllus_consimilis:1.0,((Nosopsyllus_simla:1.0,Nosopsyllus_philippovi:1.0):1.0,Nosopsyllus_fasciatus:1.0):1.0):1.0):1.0):1.0,(((Nosopsyllus_aralis:1.0,Nosopsyllus_turkmenicus:1.0):1.0,(Nosopsyllus_iranus:1.0,Nosopsyllus_laeviceps:1.0):1.0):1.0,Nosopsyllus_tersus:1.0):1.0):1.0,(Rostropsylla_daca:1.0,(((Oropsylla_ilovaiskii:1.0,Oropsylla_silantiewi:1.0):1.0,Oropsylla_alaskensis:1.0):1.0,(Amphalius_runatus:1.0,((((Amalaraeus_arvicolae:1.0,Amalaraeus_penicilliger:1.0):1.0,Amalaraeus_ioffi:1.0):1.0,Amalaraeus_dissimilis:1.0):1.0,(Paramonopsyllus_scalonae:1.0,(((Megabothris_rectangulatus:1.0,(Megabothris_turbidus:1.0,Megabothris_advenarius:1.0):1.0):1.0,((Megabothris_beljaevi:1.0,(Megabothris_calcarifer:1.0,Megabothris_walkeri:1.0):1.0,Megabothris_bispinosa:1.0):1.0,Megabothris_asio:1.0):1.0):1.0,(((Callopsylla_caspia:1.0,Callopsylla_lagomys:1.0):1.0,Callopsylla_saxatilis:1.0):1.0,((Ceratophyllus
origin destination origin_x origin_y destination_x destination_y flow
Brazil Aruba -53.09783112669137 -10.787777024605191 -69.9826771125094 12.520880383840192 49
Brazil Afghanistan -53.09783112669137 -10.787777024605191 66.00473365578554 33.83523072784668 65
Brazil Angola -53.09783112669137 -10.787777024605191 17.537367681548865 -12.293360543793685 25
Brazil Anguilla -53.09783112669137 -10.787777024605191 -63.06498926535687 18.223959502282636 74
Brazil Albania -53.09783112669137 -10.787777024605191 20.04983396108883 41.14244989474517 100
Brazil Aland -53.09783112669137 -10.787777024605191 19.95328767603767 60.2148868755776 18
Brazil Andorra -53.09783112669137 -10.787777024605191 1.5605437791792292 42.54229102187176 49
Brazil United Arab Emirates -53.09783112669137 -10.787777024605191 54.300167101563936 23.905281878496574 47
Brazil Argentina -53.09783112669137 -10.787777024605191 -65.17980692500295 -35.38134879526277 24