==============================================================================
HD 2.4.b Stage 4 smoke test - era-A direct rows + era-B preview
==============================================================================

Stage 4 panel rows (era-A, 1975-2009): 680,031
Stage 4 build wall time: 6.23s
Year scope: PANEL_YEARS=range(1975, 2025); era-A subset = [1975, 2009].
Carve-out: 1972 (no field-level question) and 1973-1974 (Guide-undocumented status='c'; HD 2.4.b round 1 Vision verdict 2026-05-10) preserved as raw artifacts only.

--- Schema check (21 columns) ---
  Column order and types match locked �1 schema (21 columns). PASS

--- Per-year era-A panel row counts (1975-2009) ---
  year   total   r&d    r&d_eq  notes
  1975  4,710   4,710      0
  1976  4,889   4,889      0
  1977  4,718   4,718      0
  1978  3,194   3,194      0  <-- discontinuity (delta=-1,524)
  1979  7,383   7,383      0  <-- discontinuity (delta=+4,189) (pre-1981 fingerprint: leaves first appear)
  1980  11,074   11,074      0  <-- discontinuity (delta=+3,691)
  1981  21,690   10,484  11,206  <-- discontinuity (delta=+10,616) (Item 3 equipment added per FY24 Guide page 19)
  1982  21,179   10,590  10,589
  1983  21,528   10,681  10,847
  1984  25,731   13,154  12,577
  1985  26,689   13,525  13,164
  1986  27,557   14,031  13,526
  1987  23,478   12,113  11,365
  1988  15,970   8,680  7,290  <-- discontinuity (delta=-7,508)
  1989  21,618   11,297  10,321  <-- discontinuity (delta=+5,648)
  1990  21,845   11,448  10,397
  1991  22,122   11,450  10,672
  1992  21,754   11,398  10,356
  1993  18,900   10,315  8,585
  1994  24,336   12,746  11,590  <-- discontinuity (delta=+5,436)
  1995  26,655   13,711  12,944
  1996  25,725   13,312  12,413
  1997  25,218   13,193  12,025
  1998  23,309   12,575  10,734
  1999  22,074   11,939  10,135
  2000  22,521   12,246  10,275
  2001  22,937   12,454  10,483
  2002  21,577   11,929  9,648
  2003  22,135   12,262  9,873 (Items 2A/2B per FY24 Guide pages 15/19)
  2004  21,116   11,865  9,251
  2005  20,614   11,750  8,864
  2006  19,089   11,224  7,865
  2007  18,586   11,072  7,514
  2008  18,901   11,321  7,580
  2009  19,209   11,625  7,584

--- Pre-1981 fingerprint check (scoping doc �3(b)) ---
  (1975-1978: rollup-only fingerprint; 1979 onward: leaves emerge.
   FY 1973-1974 are carved out per the codeset disposition; the
   pre-1981 fingerprint window in the panel is therefore 1975-1980.)
  year   total   rollup  leaves  grand_All
  1975  4,710   1,442   2,734     534
  1976  4,889   1,508   2,847     534
  1977  4,718   1,460   2,723     535
  1978  3,194   1,020   1,858     316
  1979  7,383   3,231   3,592     560
  1980  11,074   3,449   7,067     558
  1981  21,690   6,766   13,812   1,112
  1982  21,179   6,635   13,434   1,110
  1983  21,528   6,715   13,695   1,118
  1984  25,731   7,756   16,865   1,110
  1985  26,689   8,028   17,551   1,110

--- Distinct discipline_coarse buckets (era-A panel) ---
  9 distinct buckets
                                       'All'  n=38,885  years=[1975-2009]
                               'Engineering'  n=140,207  years=[1975-2009]
                               'Geosciences'  n=84,872  years=[1975-2009]
                             'Life sciences'  n=119,238  years=[1975-2009]
                                 'Math & CS'  n=44,183  years=[1975-2009]
                        'Other sciences nec'  n=17,792  years=[1975-2009]
                         'Physical sciences'  n=109,355  years=[1975-2009]
                                'Psychology'  n=23,512  years=[1975-2009]
                           'Social sciences'  n=101,987  years=[1975-2009]

--- quality_flag distribution (era-A panel) ---
                'reported'  n=  390,307  (57.40%)
                 'imputed'  n=  260,067  (38.24%)
               'estimated'  n=   29,657  ( 4.36%)

--- expenditure_type distribution (era-A panel) ---
               'r&d'  n=  380,358  years=[1975-2009]
     'r&d_equipment'  n=  299,673  years=[1981-2009]

--- Sample rows: 3 per era-A decade ---

  late-1970s (1975-1979):
    yr=1975 inst='000166' coarse='All'                fine='All'                            et='r&d'            v=       0.0 qf='imputed'    sq='Expenditures by S&E field'
    yr=1975 inst='001002' coarse='All'                fine='All'                            et='r&d'            v=    2821.0 qf='reported'   sq='Expenditures by S&E field'
    yr=1975 inst='001002' coarse='Math & CS'          fine='Computer and information scien' et='r&d'            v=      68.0 qf='reported'   sq='Expenditures by S&E field'

  1980s (1980-1989):
    yr=1980 inst='000166' coarse='All'                fine='All'                            et='r&d'            v=       0.0 qf='reported'   sq='Expenditures by S&E field'
    yr=1980 inst='001002' coarse='All'                fine='All'                            et='r&d'            v=    1313.0 qf='reported'   sq='Expenditures by S&E field'
    yr=1980 inst='001002' coarse='Math & CS'          fine='Computer and information scien' et='r&d'            v=       0.0 qf='imputed'    sq='Expenditures by S&E field'

  1990s (1990-1999):
    yr=1990 inst='000166' coarse='All'                fine='All'                            et='r&d'            v=    4970.0 qf='imputed'    sq='Expenditures by S&E field'
    yr=1990 inst='000166' coarse='All'                fine='All'                            et='r&d_equipment'  v=     102.0 qf='imputed'    sq='Current fund research equipment exp'
    yr=1990 inst='000166' coarse='Math & CS'          fine='Computer and information scien' et='r&d'            v=       0.0 qf='imputed'    sq='Expenditures by S&E field'

  2000s (2000-2009):
    yr=2000 inst='000166' coarse='All'                fine='All'                            et='r&d'            v=   31045.0 qf='reported'   sq='Expenditures by S&E field'
    yr=2000 inst='000166' coarse='All'                fine='All'                            et='r&d_equipment'  v=     789.0 qf='reported'   sq='Current fund research equipment exp'
    yr=2000 inst='000166' coarse='Life sciences'      fine='Life sciences, all'             et='r&d'            v=   31045.0 qf='reported'   sq='Expenditures by S&E field'

--- Era-B preview: Stages 1-2 in-scope row counts (2010-2024) ---
  (Stage 5 has not shipped yet; this is the raw in-scope
   row stream Stage 5 will project at HD 2.4.b round 2.)
  year   in_scope_rows   Q4     Q5     Q9     Q11    Q14
  2010      196,070      141    448  93,400  80,694  21,387
  2011      220,568      144    467  105,312  90,948  23,697
  2012      190,073      145    442  90,744  77,826  20,916
  2013      187,805      146    450  89,736  77,412  20,061
  2014      187,841      150    462  89,240  78,258  19,731
  2015      189,300      152    473  89,072  79,482  20,121
  2016      192,007      157    467  90,616  81,474  19,293
  2017      199,095      155    489  94,072  84,420  19,959
  2018      198,461      156    495  94,184  83,796  19,830
  2019      201,256      159    507  95,656  84,912  20,022
  2020      204,458      160    505  96,336  87,216  20,241
  2021      203,945      160    521  96,992  85,680  20,592
  2022      206,402      158    530  98,224  86,598  20,892
  2023      215,145      162    553  102,176  90,396  21,858
  2024      219,785      162    552  103,808  92,898  22,365

  Note: Short Form Q2 is NOT in ERA_B_IN_SCOPE_QUESTIONS_CANONICAL
  and does not appear in the Stage 2 in-scope filter at HD 2.4.b
  round 1. Surface 3 probe (Short Form Q2 raw structure) runs as
  a separate scan against rel1 in HD 2.4.b round 2; the projection
  path Stage 5 needs for short-form rows is locked there.

--- Smoke-test boundaries ---
  Total wall time (Stage 4 full + era-B preview): 26.21s
  No parquet written: Stage 4 smoke test only.
