From b543cf4695efdfa46d1b52ebf90af6a04f13d6d0 Mon Sep 17 00:00:00 2001 From: Charlie Tonneslan Date: Sun, 17 May 2026 13:47:10 -0400 Subject: [PATCH] ACS5: restrict state_county_blockgroup to 2013+ Block group geography wasn't published in the ACS API until 2013. Calling state_county_blockgroup with an earlier year currently hits the Census API and comes back with 'unknown/unsupported geography hierarchy', which doesn't help anyone diagnose the actual problem. Narrow the @supported_years on this method so callers get an UnsupportedYearException up front instead, matching the behavior of the other geography-specific methods on the class. Closes #140, #155. Signed-off-by: Charlie Tonneslan --- census/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/census/core.py b/census/core.py index 2101e17..6129d05 100644 --- a/census/core.py +++ b/census/core.py @@ -353,7 +353,11 @@ def state_county_tract(self, fields, state_fips, 'in': 'state:{} county:{}'.format(state_fips, county_fips), }, **kwargs) - @supported_years() + # Block group geography wasn't published in the ACS API until 2013; earlier + # years just return "unknown/unsupported geography hierarchy" from the API. + # Restrict the supported years so callers get a clearer UnsupportedYear + # error up front. See #140, #155. + @supported_years(2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013) def state_county_blockgroup(self, fields, state_fips, county_fips, blockgroup, tract=None, **kwargs): geo = {