mountainMath / cmhc

Wrapper for hack into CMHC data
Other
18 stars 5 forks source link

Halifax data missing? #14

Closed daniel-simeone closed 10 months ago

daniel-simeone commented 1 year ago

It seems that the Halifax data is now missing. Perhaps the underlying structure has been changed?

cmhc::get_cmhc(survey = "Rms", series = "Vacancy Rate", dimension = "Bedroom Type", breakdown = "Historical Time Periods", geo_uid = 205, year = 2020) and cmhc::get_cmhc(survey = "Rms", series = "Vacancy Rate", dimension = "Bedroom Type", breakdown = "Survey Zones", geo_uid = 205)

Both give "No data available."

The given survey/series/dimension/breakdown all appear in list_cmhc_tables() and the SGC Code (205) is as given by get_cmhc_geography(level = "MET")

This is the case for all calls to geo_uid 205 that I looked at (across all 31 tables that have both Historical Time Periods and Survey Zones as available breakdowns).

I'll try to look into the get_cmhc function to see what is happening.

daniel-simeone commented 1 year ago

The data is still on the website by survey zone: image Maybe the "API" changed somehow?

Here's the response object from the POST to CMHC:

image

Any thoughts?

FYI, @davidr-PA

mountainMath commented 1 year ago

I noticed that too and did send in a note to CMHC a couple of days ago, no response yet. Will follow up. In the meantime, you can get the historical data from StatCan Table 34-10-0130. get_cansim("34-10-0130") |> filter(GeoUID=="205")

daniel-simeone commented 1 year ago

Thank you!

mountainMath commented 1 year ago

I still have not heard anything official from CMHC, but it seems that they have renamed the internal identifier for Halifax CMA. It works if the new identifier is specified directly but a workaround is to query data for Halifax RM (geo_uid = "1209034") which matches the 2016 CMA definitions. But this only goes back to 1999 after amalgamation to current boundaries, and won't capture earlier times.:

cmhc::get_cmhc(survey = "Rms", series = "Vacancy Rate", dimension = "Bedroom Type", breakdown = "Historical Time Periods", geo_uid ='1209034', year = 2020)

However, the package won't translate it automatically back to the StatCan geographic identifier.

daniel-simeone commented 1 year ago

Thanks for that. Do you happen to have the Halifax-area zone IDs (the new ones) available easily in the same way you found that? Or you can tell how you figured that out, and I can do it?

I was looking through the (refreshed) GDB files, and they aren't there (nor is this new one for the city).

And it is still showing the 0580 in the URL and in the page code for Halifax zones, and in the queries I've looked with the Chrome inspector on the Housing Information Portal.

mountainMath commented 1 year ago

I think I got thing wrong in my explanation above, made some updates. Data for the CMA still seems to be missing, which is very unfortunate. The workaround above is getting data for the city not the CMA, which had identical boundaries in 2016.

mountainMath commented 10 months ago

This seems to be fixed now, at least in the current development branch