feat: fiscal-year periods on the verbs and survey-year helpers (#77)
`year` is the Census survey year, and Census files a government's fiscal year under survey year Y when it ended between July 1 of Y-1 and June 30 of Y, so one survey year covers different months for different governments. cog_spending(), cog_revenue() and cog_balances() gain a trailing `fiscal_period = FALSE`. With TRUE, every row gains fiscal_year_end (MMDD integer), period_start and period_end (Dates, inclusive), looked up per government-year from long.fiscal_year_end so a change of fiscal year is respected, plus provenance$transformations$fiscal_period. With the default, columns and provenance are exactly as before. cog_fiscal_periods(govid, years) returns the govid x years grid of periods; cog_survey_year(govid, date) returns the survey year whose period contains a date, using each candidate year's own fiscal_year_end and returning NA rather than borrowing another year's value. State governments, and the District of Columbia, cover the fiscal year ending in calendar year Y. That changes Alabama, Michigan (September 30) and Texas (August 31). Census's 2004 and 2006 technical documentation lists those exceptions, and the corpus agrees for survey year 2020: those states' federal aid rises with the CARES Act in 2020 while New York's and 15 large September-30 local governments' rises in 2021. D.C. rests on the documentation alone. Tests run against the bundled fixture (85 expectations). Refs #77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qbe6u2h83wgZdTgJgE4Xh5
This commit is contained in:
12 files changed
+899
-17
No files matched your search
@@ -22,6 +22,13 @@ reference:
|
||||
- cog_find_peers
|
||||
- cog_peer_compare
|
||||
- cog_geographic_rollup
|
||||
- title: Fiscal years
|
||||
desc: >
|
||||
Which calendar months a survey year covers for each government, and the
|
||||
survey year that covers a given date.
|
||||
contents:
|
||||
- cog_fiscal_periods
|
||||
- cog_survey_year
|
||||
- title: Corpus metadata
|
||||
desc: >
|
||||
What the corpus contains, where a given result came from, and how to
|
||||
|
||||
Reference in new issue
Block a user