mountainMath / cmhc

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

Double CT identifiers #18

Open mountainMath opened 3 months ago

mountainMath commented 3 months ago

There is an issue with some StatCan CT identifiers appearing twice with different internal CMHC identifiers. For example

get_cmhc(survey = "Rms", series = "Vacancy Rate", dimension = "Bedroom Type", breakdown = "Historical Time Periods", geo_uid = "3050016.02") 

gives an error because there are two internal CMHC CTs for this StatCan census tract as can be seen when calling

cmhc::cmhc_ct_translation_data |> filter(CTUID=="3050016.02")

Not sure what's going on here, will have to check into this in more detail.

mountainMath commented 3 months ago

Ok, looks like CMHC started splitting up census tracts along municipal boundaries, at least in the translation files they sent me. But this is done inconsistently. When querying data at the metro level with census tract breakdown, they aren't split. But in the new lookup table I got they are split and cause problems when querying the data. For this particular example I get "no data available" when I call it with the individual CMHC census tract ids, as well as with the census tract id for the region that corresponds to the data by metro level.

Of note, selecting specific census tracts on the CMHC web portal is currently disabled, but the (hacky) API calls still work for most CTs. Not sure what's going on here, will have to inquire.