From 98047ecbfcbef14d7c7c6cf273ac767ba5f9c0a6 Mon Sep 17 00:00:00 2001 From: "J. A. Cooper" Date: Mon, 16 Dec 2024 12:35:46 -0500 Subject: [PATCH 1/3] Update README and core.py with 2023 as default and in tuples. --- README.rst | 10 +++++----- census/core.py | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index cb5b844..ad98b2f 100644 --- a/README.rst +++ b/README.rst @@ -67,13 +67,13 @@ Datasets For each dataset, the first year listed is the default. -* acs5: `ACS 5 Year Estimates `_ (2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) +* acs5: `ACS 5 Year Estimates `_ (2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) * acs3: `ACS 3 Year Estimates `_ (2013, 2012) -* acs1: `ACS 1 Year Estimates `_ (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) -* acs5dp: `ACS 5 Year Estimates, Data Profiles `_ (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) +* acs1: `ACS 1 Year Estimates `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) +* acs5dp: `ACS 5 Year Estimates, Data Profiles `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) * acs3dp: `ACS 3 Year Estimates, Data Profiles `_ (2013, 2012) -* acs1dp: `ACS 1 Year Estimates, Data Profiles `_ (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) -* acs5st: `ACS 5 Year Estimates, Subject Tables `_ (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) +* acs1dp: `ACS 1 Year Estimates, Data Profiles `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) +* acs5st: `ACS 5 Year Estimates, Subject Tables `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) * sf1: `Census Summary File 1 `_ (2010) * pl: `Redistricting Data Summary File `_ (2020, 2010, 2000) diff --git a/census/core.py b/census/core.py index 5beeb4e..5b011f7 100644 --- a/census/core.py +++ b/census/core.py @@ -327,10 +327,10 @@ def get(self, *args, **kwargs): class ACS5Client(ACSClient): - default_year = 2022 + default_year = 2023 dataset = 'acs5' - years = (2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) + years = (2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009) @supported_years() def state_county_subdivision(self, fields, state_fips, @@ -359,7 +359,7 @@ def state_county_blockgroup(self, fields, state_fips, county_fips, geo['in'] += ' tract:{}'.format(tract) return self.get(fields, geo=geo, **kwargs) - @supported_years(2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) + @supported_years(2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) def zipcode(self, fields, zcta, **kwargs): warnings.warn( "zipcode has been deprecated; use state_zipcode instead", @@ -370,7 +370,7 @@ def zipcode(self, fields, zcta, **kwargs): return self.state_zipcode(fields, state_fips, zcta, **kwargs) - @supported_years(2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) + @supported_years(2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011) def state_zipcode(self, fields, state_fips, zcta, **kwargs): year = kwargs.get('year', self.default_year) geo = { @@ -422,10 +422,10 @@ class ACS3DpClient(ACS3Client): class ACS1Client(ACSClient): - default_year = 2022 + default_year = 2023 dataset = 'acs1' - years = (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005) + years = (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005) @supported_years() def state_county_subdivision(self, fields, state_fips, From a232d14551e4981771ff2a47bc9651dcd4c3c84e Mon Sep 17 00:00:00 2001 From: "J. A. Cooper" Date: Tue, 14 Jan 2025 15:00:41 -0500 Subject: [PATCH 2/3] Fix ACS 1 bug by adding 2023 to the options. --- census/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/census/core.py b/census/core.py index 5b011f7..1c80b96 100644 --- a/census/core.py +++ b/census/core.py @@ -440,7 +440,7 @@ class ACS1DpClient(ACS1Client): dataset = 'acs1/profile' - years = (2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012) + years = (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012) class SF1Client(Client): From 07984bb24608037c2e53562453000ace800b88ab Mon Sep 17 00:00:00 2001 From: "J. A. Cooper" Date: Tue, 14 Jan 2025 15:43:28 -0500 Subject: [PATCH 3/3] Update test expectations for legislative district API syntax --- census/tests/test_census.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/census/tests/test_census.py b/census/tests/test_census.py index 1832efe..715e637 100644 --- a/census/tests/test_census.py +++ b/census/tests/test_census.py @@ -166,14 +166,15 @@ def test_acs5(self): ('Block Group 1; Census Tract 7007.06; ' 'Montgomery County; Maryland')), ('state_place', 'Gaithersburg city, Maryland'), + # 2022 and 2023 ACS5 API calls use legislative districts from 2022 as their geography ('state_district', 'Congressional District 6 (118th Congress), Maryland'), ('state_congressional_district', 'Congressional District 6 (118th Congress), Maryland'), ('state_legislative_district_upper', - 'State Senate District 6 (2022), Maryland'), + 'State Senate District 6 (2022); Maryland'), ('state_legislative_district_lower', - 'State Legislative District 6 (2022), Maryland'), + 'State Legislative District 6 (2022); Maryland'), ('state_zipcode', 'ZCTA5 20877'), )