-
Notifications
You must be signed in to change notification settings - Fork 119
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
A way to convert code_muni
into any other higher level aggregations
#311
Comments
Adding on this, at DataSUS's FTP there is a registry of changes of municipalities that were moved from one health region to another, as well as, a table that relates this change and can relate the health regions with the municipalities, by I have the relational database and can send it to anyone who will be working on this conversion, please mail me. |
Hi @rafalopespx . Thanks for opening this issue. I like the idea of a table that associates each
We could probably try to add the code of health regions to this output. Note however, that this output refers to the year 2010. I'm planning to update the function to include the Census 2022 soon. |
Hi everyone! I am working on something similar here, trying to make compatible all Brazilian Territorial Divisions (DTB) from IBGE. https://github.com/rfsaldanha/rdtb Very early stage development, but the goal may be to track the municipality changes overtime and space. |
Hi @rfsaldanha , thanks for the ping. It looks like you are trying to create a correspondence table for each year. Correct? |
Yes, to have the corresponding DTB for each year. The problem is that the official IBGE DTB does not agree with the also official IBGE spatial dataset of municipalities of the same year. :-( |
That's a problem, indeed. Which one should we trust, the spatial data or the table data? |
I think that the spatial data is more widely used, then more trusted… |
One thing that I encountered too, sometimes the spatial data do not agree with other levels or year of the same spatial data, if we pick all municipalities should this cover the country shapefile map or the state shapefile map, but this does not occur for some years |
A "tidy" geobr with topological validation of spatial features would be interesting. |
Hi both. Before We we make any data available in geobr, we process the data to harmonize column names, projections etc etc and we already "fix" the topolgy by applying For example, here's an example of the problem mentioned by @rafalopespx. The total area of the country polygon is not the same as the sum of areas of each state. This is an inconsistency (in this case a small one) in the original IBGE data, and there is not much we can do about it. The impression I have is that any attempt to solve this inconsistency should be done by IBGE in the original raw data.
|
I totally agree with you @rafapereirabr on this, and as I remember, I'm not so sure that the topological data is better than table data. And totally agrees, that the problem is at IBGE to be fixed. One thing that will be really helpful is to have the table data that relates any |
I agree, ideally, we would have all columns added to the output of the lookup table. obs. Do you know where to find the list of municipalities in each health region and macro region? I haven't found this table anywhere. It's is possible to determine this using a spatial join operation, but the original boundaries of health regions don't match those of municipalities, which creates some strange results (like a municipality from one state 'included' in the macro health region of another state) |
I have, I'll send you, where can I send you? |
Thanks, @rafalopespx . You can send it to rafa.pereira.br [at] gmail.com. However, ideally, we would prefer to have an official document or piece of data with this info with an url so we can refer it. |
Okay, I have found the relational data table in some different services from the Ministry of Health, you can download it directly from here: ftp://ftp.datasus.gov.br/territorio/tabelas/base_territorial.zip, which is the FTP server from DataSUS, and it points to the latest version of it. Or you can download it from here: https://datasus.saude.gov.br/transferencia-de-arquivos/ |
If none of them works I can send you the latest one that I downloaded, but I think downloading from there will guarantee you pick the official and latest version of each, and can be easily incorporated into a function |
Hey, we keep an updated directory of codes that a municipality can be related to at Base dos Dados. It also brings other codes besides health regions. you can either download it at the website or R
|
Hello there,
Is there any rapid and fast way to know from a
code_muni
in which health_region, macro or micro, this municipality is inserted?This is tricky to do if you trust only on the code, although the
code_muni
carries information from the state level and region, it is not true that part of thecode_muni
can be assigned to acode_health_region
orcode_health_macrorregion
, just taking the first 5 digits from thecode_muni
A workaround that I developed is using one of the relational tables from dataSUS to add the
code_health_region
and/orcode_health_macrorregion
to a data.frame withcode_muni
maybe this can be implemented in
read_municipality
function, as a parameter being passed by the user to return with other code other thancode_muni
Thanks for the amazing package!
The text was updated successfully, but these errors were encountered: