Difficulty in relating the SNIS municipalities to those of IBGE

Asked

Viewed 451 times

1

I’m trying to build a database that includes the population served by the sanitation service and the per capita GDP of each municipality. The first data I have already been able to access by SNIS. The second data is available at IBGE and I also have it in hand.

However, the IBGE system does not use the code of the municipalities. The SNIS data has a column with the code of the municipalities, but it is not the same number of other databases - it contains only 6 digits. It seems to me that the only alternative would be to aggregate the data by the name of the municipalities, what I do not know how to do and could generate infinite incongruities.

If anyone can help me, I’d be most grateful.

  • 1

    Question, wouldn’t it be better if you assigned one id for each municipality, along with its name, in a parent table, and then two daughter tables, one to assign the GDP to the id of the respective municipality, and another table to launch the population served by basic sanitation, also attributing to the id of the municipality?

2 answers

1

There are several Brazilian municipalities that have the same name, I thought there were few, but the check the list of all of them, I’ve seen a lot of cases. I think the worst case is Bom Jesus, name of a municipality in Piauí, one in Rio Grande do Norte, one in Paraíba, one in Santa Catarina and one in Rio Grande do Sul. There are other names that only differ in accentuation, such as Arapuá (MG) and Arapuã (PR).

However, a state cannot have two municipalities with the same name or two municipalities that only differ in accentuation. So if you can get the name or state acronym of each county and concatenate to the name, each county name will be unique.

There may be differences regarding upper and lower case, accents and apostrophes. For example, a basis can give you "Water Eye of Cunhãs (MA)" and the other "DAGUA EYE OF WEDGES (MA)". In this case you convert everything to uppercase, remove the accents and remove the apostrophes to unify the name.

So if you can get the name, acronym or state code together with the name of the county from the foundations, then simply relate the names of municipalities together with the states for you to do this mapping [solution 1].

If you can’t get the name, acronym, or state code directly, it may be part of the county code. For example, the first two digits of the municipality code used by IBGE in the databases I know are the same digits of the state. I don’t know how the SNIS data you are using is, but I think it’s just the IBGE county code without the last digit, because at least that’s what I found when searching for some files for download on the SNIS site.

Disregarding the last digit of the IBGE code is safe, since this is only a check digit. From what I checked on the spreadsheets I found on the SNIS website, that’s exactly the case. For example, the municipality of Americana has the IBGE code 3501608, and the spreadsheet I found somewhere on the SNIS website contains the code 350160. In both cases, 35 is the code of the state of São Paulo. In this case, just disregard the last digit of the IBGE code and the codes will match. [solution 2]

If your code is something that does not have similarity with the IBGE code and you do not have the state information available directly, then even so you should try to find a pattern that from the code you discover the state. If this pattern does not exist, then you dance, for in this case you will not be able to know who is who in the case of Good Jesus, for example. However, I find it unlikely that the SNIS base you are using relates the municipality without informing absolutely nothing of the state in question.

0

Friend yesterday has this thing is on the cider site. It is very difficult to find the link of the database dowloads. But make sure that t3m everything you need Download updated cider municipios

Browser other questions tagged

You are not signed in. Login or sign up in order to post.