Skip to content
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

Atualizar até setembro de 2019 #41

Open
ppKrauss opened this issue Sep 20, 2019 · 5 comments
Open

Atualizar até setembro de 2019 #41

ppKrauss opened this issue Sep 20, 2019 · 5 comments

Comments

@ppKrauss
Copy link
Contributor

ppKrauss commented Sep 20, 2019

Revisar qual a melhor ordem de atualização, provavelmente os geoJSONs seriam os ultimos. Devido a isso, conferir se não houve falha a incluir os seguintes poligonos:
Sugere-se reiniciar com tabela oficial do IBGE revisada.

GeoJSONs atualizados

Além das ~100 de atualizações de arquivos geojson (ver commit), os seguntes arquivos novos foram inclusos, conforme git status

	data/dump_osm/RJ/CasimiroAbreu.geojson
	data/dump_osm/SP/Florinea.geojson
	data/dump_osm/SP/SaoLuizParaitinga.geojson

Apenas uma mensagem de erro em php src/dumpOsm.php geo, após todas as atualizações: "ERROR, no osmId or P402 for MG-Chiador / empty json for MG-Chiador".

Wikidatas atualizados

Passo-a-passo realizado:

  1. php src/etc/dumpWikidata.php chk
  2. php src/etc/dumpWikidata.php
  3. ... revisar erros e pegar dados oficiais nas planilhas novas do IBGE .. rodando tudo novamente.

-- Generating backups of JSON-Wikidata --

 USANDO CHECK WIKIDATA /opt/datasets-br/city-codes/data/dump_wikidata/../br-city-codes.csv
 -- Error-type-4, sem DDD em Q1940492 (IBGE 2200400)
 -- Error-type-4, sem DDD em Q2007777 (IBGE 3102209)
 -- Error-type-4, sem DDD em Q2102493 (IBGE 1700707)
 -- Error-type-4, sem DDD em Q2094729 (IBGE 2200509)
 -- Error-type-4, sem DDD em Q1784392 (IBGE 4200903)
 -- Error-type-4, sem DDD em Q1750770 (IBGE 4201109)
 -- Error-type-4, sem DDD em Q1805349 (IBGE 3102902)
 -- Error-type-4, sem DDD em Q1797156 (IBGE 5001003)
 -- Error-type-4, sem DDD em Q22063188 (IBGE 2902104)
 -- Error-type-4, sem DDD em Q1804949 (IBGE 3104205)
 -- Error-type-4, sem DDD em Q1805369 (IBGE 3107109)
 -- Error-type-4, sem DDD em Q1805722 (IBGE 3108107)
 -- Error-type-7, atribuição Q2844 (ao IBGE 5300108) não é município-BR!
 -- Error-type-4, sem DDD em Q1799538 (IBGE 3108602)
 -- Error-type-4, sem DDD em Q1815606 (IBGE 3109501)
 -- Error-type-4, sem DDD em Q2077925 (IBGE 3109808)
 -- Error-type-4, sem DDD em Q2007990 (IBGE 3110301)
 -- Error-type-4, sem DDD em Q1957976 (IBGE 3110806)
 -- Error-type-4, sem DDD em Q2077804 (IBGE 3111002)
 -- Error-type-4, sem DDD em Q1805812 (IBGE 3111804)
 -- Error-type-4, sem DDD em Q2064920 (IBGE 3112059)
 -- Error-type-4, sem DDD em Q2007691 (IBGE 3114204)
 -- Error-type-4, sem DDD em Q2347628 (IBGE 2303600)
 -- Error-type-4, sem DDD em Q251350 (IBGE 2303956)
 -- Error-type-4, sem DDD em Q2007621 (IBGE 3116605)
 -- Error-type-4, sem DDD em Q2063933 (IBGE 3116704)
 -- Error-type-4, sem DDD em Q2007414 (IBGE 3118205)
 -- Error-type-4, sem DDD em Q2008000 (IBGE 3119104)
 -- Error-type-4, sem DDD em Q1805792 (IBGE 3119302)
 -- Error-type-4, sem DDD em Q986510 (IBGE 2304251)
 -- Error-type-4, sem DDD em Q1805738 (IBGE 3121258)
 -- Error-type-4, sem DDD em Q1805786 (IBGE 3124302)
 -- Error-type-4, sem DDD em Q1900550 (IBGE 3125200)
 -- Error-type-7, atribuição Q175057 (ao IBGE 2605459) não é município-BR!
 -- Error-type-4, sem DDD em Q2101396 (IBGE 3127602)
 -- Error-type-4, sem DDD em Q2135472 (IBGE 2305233)
 -- Error-type-4, sem DDD em Q2050036 (IBGE 3130101)
 -- Error-type-4, sem DDD em Q1805773 (IBGE 3130705)
 -- Error-type-4, sem DDD em Q2007732 (IBGE 3133600)
 -- Error-type-4, sem DDD em Q1805374 (IBGE 3135209)
 -- Error-type-4, sem DDD em Q1804893 (IBGE 3137304)
 -- Error-type-4, sem DDD em Q2007758 (IBGE 3137536)
 -- Error-type-4, sem DDD em Q985575 (IBGE 4311304)
 -- Error-type-4, sem DDD em Q1805333 (IBGE 3138500)
 -- Error-type-4, sem DDD em Q2357138 (IBGE 3138658)
 -- Error-type-4, sem DDD em Q2289962 (IBGE 2307809)
 -- Error-type-4, sem DDD em Q2104166 (IBGE 3141405)
 -- Error-type-4, sem DDD em Q2079721 (IBGE 2804201)
 -- Error-type-4, sem DDD em Q1877935 (IBGE 3143104)
 -- Error-type-4, sem DDD em Q2063943 (IBGE 3143450)
 -- Error-type-4, sem DDD em Q2028310 (IBGE 2308906)
 -- Error-type-4, sem DDD em Q2289857 (IBGE 2309102)
 -- Error-type-4, sem DDD em Q2014499 (IBGE 2804508)
 -- Error-type-4, sem DDD em Q1924777 (IBGE 2804607)
 -- Error-type-4, sem DDD em Q2661298 (IBGE 3136603)
 -- Error-type-4, sem DDD em Q2028019 (IBGE 2309409)
 -- Error-type-4, sem DDD em Q2007609 (IBGE 3145901)
 -- Error-type-4, sem DDD em Q2014476 (IBGE 2805505)
 -- Error-type-4, sem DDD em Q1815988 (IBGE 3152808)
 -- Error-type-4, sem DDD em Q2078413 (IBGE 2805802)
 -- Error-type-4, sem DDD em Q1809966 (IBGE 3155504)
 -- Error-type-4, sem DDD em Q1804734 (IBGE 3155702)
 -- Error-type-4, sem DDD em Q1804907 (IBGE 3155801)
 -- Error-type-4, sem DDD em Q1886752 (IBGE 3157203)
 -- Error-type-4, sem DDD em Q2021424 (IBGE 2708204)
 -- Error-type-4, sem DDD em Q1904163 (IBGE 3161106)
 -- Error-type-4, sem DDD em Q578627 (IBGE 4318200)
 -- Error-type-4, sem DDD em Q1805400 (IBGE 3162807)
 -- Error-type-4, sem DDD em Q2078623 (IBGE 1720903)
 -- Error-type-4, sem DDD em Q921105 (IBGE 4217907)
 -- Error-type-4, sem DDD em Q22062867 (IBGE 2931004)
 -- Error-type-4, sem DDD em Q2105955 (IBGE 4126801)
 -- Error-type-4, sem DDD em Q22062864 (IBGE 2931202)
 -- Error-type-4, sem DDD em Q22062863 (IBGE 2931301)
 -- Error-type-4, sem DDD em Q2079737 (IBGE 2807303)
 -- Error-type-4, sem DDD em Q1804982 (IBGE 5008008)
 -- Error-type-4, sem DDD em Q22062856 (IBGE 2931707)
 -- Error-type-4, sem DDD em Q2104252 (IBGE 4127403)
 -- Error-type-4, sem DDD em Q2013156 (IBGE 2807402)
 -- Error-type-4, sem DDD em Q615936 (IBGE 2807501)
 -- Error-type-4, sem DDD em Q22060578 (IBGE 2931806)
 -- Error-type-4, sem DDD em Q22064399 (IBGE 3554805)
 -- Error-type-4, sem DDD em Q1784369 (IBGE 4218301)
 -- Error-type-4, sem DDD em Q22062855 (IBGE 2931905)
 -- Error-type-4, sem DDD em Q2445520 (IBGE 1508084)
 -- Error-type-4, sem DDD em Q1962454 (IBGE 3169703)
 -- Error-type-4, sem DDD em Q22062854 (IBGE 2932002)
 -- Error-type-4, sem DDD em Q22062853 (IBGE 2932101)
 -- Error-type-4, sem DDD em Q22062851 (IBGE 2932309)
 -- Error-type-4, sem DDD em Q1807390 (IBGE 2807600)
 -- Error-type-4, sem DDD em Q22060576 (IBGE 2932507)
 -- Error-type-4, sem DDD em Q13109246 (IBGE 3555901)
 -- Error-type-4, sem DDD em Q1793345 (IBGE 5221601)
 -- Error-type-4, sem DDD em Q1794037 (IBGE 5221700)
 -- Error-type-4, sem DDD em Q22062848 (IBGE 2932705)
 -- Error-type-4, sem DDD em Q2104841 (IBGE 2211209)
 -- Error-type-4, sem DDD em Q22062847 (IBGE 2932804)
 -- Error-type-4, sem DDD em Q730382 (IBGE 2211308)
 -- Error-type-4, sem DDD em Q22062845 (IBGE 2933000)
 -- Error-type-4, sem DDD em Q13109251 (IBGE 3556305)
 -- Error-type-4, sem DDD em Q2011987 (IBGE 4219150)
 -- Error-type-4, sem DDD em Q2233145 (IBGE 2211407)
 -- Error-type-4, sem DDD em Q22062840 (IBGE 2933208)
 -- Error-type-4, sem DDD em Q22066862 (IBGE 3556602)
 -- Error-type-4, sem DDD em Q986271 (IBGE 5222005)
 -- Error-type-4, sem DDD em Q2026896 (IBGE 2709400)
 -- Error-type-4, sem DDD em Q22062838 (IBGE 2933406)
---- ERROS BY TYPE:
	Error-type-4, faltou DDD: 105
	Error-type-7, erros primários de WD: 2

Itens com falha por respectivo código IBGE= ('2200400','3102209','1700707','2200509','4200903','4201109','3102902','5001003','2902104','3104205','3107109','3108107','5300108','3108602','3109501','3109808','3110301','3110806','3111002','3111804','3112059','3114204','2303600','2303956','3116605','3116704','3118205','3119104','3119302','2304251','3121258','3124302','3125200','2605459','3127602','2305233','3130101','3130705','3133600','3135209','3137304','3137536','4311304','3138500','3138658','2307809','3141405','2804201','3143104','3143450','2308906','2309102','2804508','2804607','3136603','2309409','3145901','2805505','3152808','2805802','3155504','3155702','3155801','3157203','2708204','3161106','4318200','3162807','1720903','4217907','2931004','4126801','2931202','2931301','2807303','5008008','2931707','4127403','2807402','2807501','2931806','3554805','4218301','2931905','1508084','3169703','2932002','2932101','2932309','2807600','2932507','3555901','5221601','5221700','2932705','2211209','2932804','2211308','2933000','3556305','4219150','2211407','2933208','3556602','5222005','2709400','2933406')

Itens com falha mais grave = ('')
--- FIM ----

git diff > /tmp/city-codes-diff.osm.txt
git add 
git commit 
#####

git diff data/br-city-codes.csv
# nenhuma alteração

php src/etc/dumpWikidata.php
-- Generating backups of JSON-Wikidata --
 USANDO   city-codes/data/br-city-codes.csv
	(1 of 5570) GO-AbadiaGoias: saved (6184 bytes) with fresh Q304652
	(2 of 5570) MG-AbadiaDourados: saved (6202 bytes) with fresh Q582223
...
	(227 of 5570) BA-Andarai: PHP Notice:  Undefined index: datavalue in dumpWikidata.php on line 144
saved (6573 bytes) with fresh Q490022
	(228 of 5570) PR-Andira: saved (6025 bytes) with fresh Q1804315
...
	(532 of 5570) SE-BarraCoqueiros: PHP Notice:  Undefined index: datavalue
saved (6478 bytes) with fresh Q1784872
	(533 of 5570) RS-BarraFunda: saved (4363 bytes) with fresh Q584762
...
	(655 of 5570) AM-BocaAcre: PHP Notice:  Undefined index: datavalue 
saved (4816 bytes) with fresh Q1793334
	(656 of 5570) PI-Bocaina: saved (3790 bytes) with fresh Q2097681
...
	(1212 of 5570) CE-Cedro: saved (4124 bytes) with fresh Q2027857
	(1213 of 5570) PE-Cedro: PHP Notice:  Undefined index: datavalue 
saved (3578 bytes) with fresh Q716874
	(1214 of 5570) SE-CedroSaoJoao: saved (4639 bytes) with fresh Q2013083
...
	(1715 of 5570) MG-Estiva: saved (5919 bytes) with fresh Q1790777
	(1716 of 5570) SP-EstivaGerbi: PHP Notice:  Undefined index: datavalue 
saved (5069 bytes) with fresh Q738934
	(1717 of 5570) MA-Estreito: saved (4323 bytes) with fresh Q2068863
...
	(5569 of 5570) MA-ZeDoca: saved (4452 bytes) with fresh Q1806488
	(5570 of 5570) SC-Zortea: saved (4016 bytes) with fresh Q1648503
 ----------- ERRORS ---------
 * ERROR, empty json for PR-Cambira.

git diff > /tmp/city-codes.gitDiff.wikidata.txt
git status > /tmp/city-codes.gitStatus.wikidata.txt
git add 

Estimativas:

  • praticamente todos os 5570 arquivos, conforme wc -l city-codes.gitStatus.wikidata.txt, sofreram alguma atualização
  • houveram 21290 inclusoes ou modificacoes de propriedades P, conforme grep '+ "P' city-codes.gitDiff.wikidata.txt | wc -l
  • houeram 370 modificacoes ou deleções, conforme grep '\- "P' city-codes.gitDiff.wikidata.txt | wc -l
  • as inclusoes foram relativas a 98 propriedades, conforme sort lix | uniq | wc -l (resta destacar as mais frequentes).
  • as mais frequentes (maior quantidade de ocorrências na listagem) podem ser obtidas por grep '+ "P' city-codes.gitDiff.wikidata.txt | sort | uniq -c | sort

Inclusões com mais de 1000 itens (lembrando que o total é ~5570), mais importantes com nome em negrito:

Quantidade Propriedade Wikidata Nome da propriedade
1046 http://wikidata.org/entity/P41 imagem da bandeira
1175 http://wikidata.org/entity/P94 imagem do brasão
1804 http://wikidata.org/entity/P1296 identificador na Gran Enciclopèdia Catalana
2232 http://wikidata.org/entity/P856 página inicial oficial
5542 http://wikidata.org/entity/P6766 Who's on First ID
5569 http://wikidata.org/entity/P6555 Identificador de Unidade Eleitoral brasileira
ppKrauss added a commit that referenced this issue Sep 20, 2019
ppKrauss added a commit that referenced this issue Sep 20, 2019
@ppKrauss
Copy link
Contributor Author

PENDENTE correções e homologacao pelo novo arquivo IBGE municipios (2017 ou mais atual). Incluir a listagem IBGE (áreas, códigos e nomes) mais atual como parte dos CSVs de referência.

@ppKrauss
Copy link
Contributor Author

ppKrauss commented Feb 25, 2020

Correcoes conforme padrões vigentes (2020), divulgados em ibge.gov.br/explica, no arquivo de municipios ftp://geoftp.ibge.gov.br/organizacao_do_territorio/estrutura_territorial/divisao_territorial/2018/DTB_2018.zip

Mudança de nome:

uf nome aqui ibge_id Nome IBGE CORRETO??
TO São Valério da Natividade 1720499 São Valério São Valério (mudar)
RN Augusto Severo 2401305 Campo Grande Campo Grande (ok)
RN Boa Saúde 2405306 Januário Cicco Boa Saúde (mudar)
BA Santa Teresinha 2928505 Santa Terezinha Santa Teresinha (ok)

Simplificação (ou adaptação ao Novo Acordo Ortográfico), removendo hífen ou acento:

uf nome errado ibge_id Nome_Município IBGE (correto?)
RN Olho-d'Água do Borges 2408409 Olho d'Água do Borges
BA Iuiú 2917334 Iuiu
BA Muquém de São Francisco 2922250 Muquém do São Francisco
MG Passa-Vinte 3147808 Passa Vinte
MG Pingo-d'Água 3150539 Pingo d'Água
SP Biritiba-Mirim 3506607 Biritiba Mirim
SP Itaóca 3522158 Itaoca

Brasilia pode ter os codigos 5300108 e 53.


Trabalho adicional: as correções precisam ser aplicadas também na Wikidata, por exemplo São Valério agora tem datas e nomes corretos https://www.wikidata.org/wiki/Q1801542

@VitorRDias
Copy link
Collaborator

VitorRDias commented Feb 26, 2020 via email

@ppKrauss
Copy link
Contributor Author

Olá @VitorRDias, obrigado!

O que acha de partipar deste git como mais um gestor?
Eu sozinho me divirto, vou melhorando a proposta, mas não dou conta: como dataset sério a iniciativa "morre na praia" porque fica meio desatualizada e sem legitimidade nas discussões (mantenho em aberto diversas decisões de projeto por isso).

Sobre o seu comentário de alteração, por favor reforce na issue #42 , que é a proposta de incluir uma nova tabela para acompanhar as alterações oficiais.

@ppKrauss
Copy link
Contributor Author

Ah, @VitorRDias e demais colaboradores,

Qualquer correção, revisão ou sugestão pode ser realizada em planilha amigável (!), não precisa ser nerd para ajudar, confira este link de planilha-google:
https://docs.google.com/spreadsheets/d/1A4WzBTH26YMtp62CCaOjS30WwlubauSmOnpecZQ-fpI/edit#gid=1179172555

ppKrauss added a commit that referenced this issue Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants