This repository was archived by the owner on Jul 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpipeline_map.yaml
More file actions
1866 lines (1866 loc) · 55.9 KB
/
Copy pathpipeline_map.yaml
File metadata and controls
1866 lines (1866 loc) · 55.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: 1
canonical_stages:
- id: 1_build_datasets
label: Stage 1
title: Build Datasets
description: Produce raw, base, extended, enhanced, stratified, source-imputed, and staged base datasets.
manifest_step_ids:
- 01_build_datasets
- 04_stage_base_datasets
- id: 2_build_calibration_package
label: Stage 2
title: Build Calibration Package
description: Build the calibration target package, geography tables, constraints, sparse matrices, and supporting metadata.
manifest_step_ids:
- 02_build_package
- id: 3_fit_weights
label: Stage 3
title: Fit Weights
description: Fit calibration weights for regional and national output builds.
manifest_step_ids:
- 03_fit_weights_regional
- 03_fit_weights_national
- id: 4_build_outputs
label: Stage 4
title: Build Outputs
description: Build local-area and national H5 outputs and upload diagnostics.
manifest_step_ids:
- 04_build_h5_regional
- 04_build_h5_national
- 04_upload_diagnostics
- id: 5_validate_and_promote_release
label: Stage 5
title: Validate and Promote Release
description: Validate staged artifacts, promote release outputs, and finalize publication manifests.
manifest_step_ids:
- 05_promote_release
stages:
- id: 1a_raw_data_download
label: 1a
title: 'Substage 1a: Raw Data Download'
canonical_stage_id: 1_build_datasets
legacy_stage_id: '0'
manifest_step_ids:
- 01_build_datasets
description: Download raw survey data from Census, IRS, Federal Reserve, and HuggingFace
country: us
extra_nodes:
- id: cps_url
label: Census CPS ASEC
node_type: artifact
description: ZIP with CSV files from www2.census.gov
- id: acs_url
label: Census ACS PUMS
node_type: artifact
description: Person + Household CSVs, 1-Year estimates
- id: scf_url
label: Federal Reserve SCF
node_type: artifact
description: Stata format (.dta), Survey of Consumer Finances
- id: hf_private
label: HuggingFace Private Repo
node_type: external
description: policyengine/irs-soi-puf - requires HUGGING_FACE_TOKEN
- id: hf_public
label: HuggingFace Public Repo
node_type: external
description: policyengine/policyengine-us-data - SIPP, block distributions, policy_data.db
- id: download_http
label: HTTP Download + ZIP Extract
node_type: process
description: requests.get() with streaming, tqdm progress bar
- id: download_hf
label: HuggingFace Hub Download
node_type: process
description: hf_hub_download(), token-authenticated for private repos
- id: csv_parse
label: CSV/Stata Parsing
node_type: process
description: pandas read_csv/read_stata, entity table construction
- id: out_cps_raw
label: census_cps_2024.h5
node_type: artifact
description: '5 entity tables: Person, Family, Household, Tax Unit, SPM Unit'
- id: out_acs_raw
label: census_acs_2022.h5
node_type: artifact
description: Person + Household tables
- id: out_puf_raw
label: irs_puf_2015.h5
node_type: artifact
description: PUF + Demographics tables
- id: out_soi
label: soi.csv
node_type: artifact
description: SOI aggregate statistics
- id: out_scf
label: SCF raw data
node_type: artifact
description: Stata -> DataFrame, auto loans + net worth
- id: out_sipp
label: pu2023_slim.csv
node_type: artifact
description: SIPP microdata (pipe-delimited)
- id: out_block
label: block_cd_distributions.csv.gz
node_type: artifact
description: Census block populations, block-to-CD crosswalk
- id: out_pop
label: np2023_d5_mid.csv
node_type: artifact
description: Census population projections
- id: out_calibration_db
label: policy_data.db
node_type: artifact
description: SQLite calibration targets database
- id: util_storage
label: STORAGE_FOLDER
node_type: utility
description: policyengine_us_data/storage/ - all downloads cached here
edges:
- source: cps_url
target: download_http
edge_type: external_source
label: CPS ASEC ZIP
- source: acs_url
target: download_http
edge_type: external_source
label: ACS PUMS CSV
- source: scf_url
target: download_http
edge_type: external_source
label: SCF .dta
- source: hf_private
target: download_hf
edge_type: external_source
label: PUF, demographics, SOI, pop
- source: hf_public
target: download_hf
edge_type: external_source
label: SIPP, block, policy_data.db
- source: download_http
target: csv_parse
edge_type: data_flow
label: raw files
- source: download_hf
target: csv_parse
edge_type: data_flow
label: raw files
- source: csv_parse
target: out_cps_raw
edge_type: produces_artifact
label: census_cps_2024.h5
- source: csv_parse
target: out_acs_raw
edge_type: produces_artifact
label: census_acs_2022.h5
- source: csv_parse
target: out_puf_raw
edge_type: produces_artifact
label: irs_puf_2015.h5
- source: csv_parse
target: out_soi
edge_type: produces_artifact
label: soi.csv
- source: download_http
target: out_scf
edge_type: produces_artifact
label: SCF raw data
- source: download_hf
target: out_sipp
edge_type: produces_artifact
label: pu2023_slim.csv
- source: download_hf
target: out_block
edge_type: produces_artifact
label: block_cd_distributions.csv.gz
- source: download_hf
target: out_pop
edge_type: produces_artifact
label: np2023_d5_mid.csv
- source: download_hf
target: out_calibration_db
edge_type: produces_artifact
label: policy_data.db
status: current
stability: moving
- id: 1b_base_dataset_construction
label: 1b
title: 'Substage 1b: Base Dataset Construction'
canonical_stage_id: 1_build_datasets
legacy_stage_id: '1'
manifest_step_ids:
- 01_build_datasets
description: Build CPS 2024 and PUF 2024 from raw survey data, donor-based labor-market imputations, and retirement contribution inference
country: us
extra_nodes:
- id: in_census_cps
label: census_cps_2024.h5
node_type: artifact
description: Raw CPS ASEC from substage 1a
- id: in_census_cps_prev
label: census_cps_2023.h5
node_type: artifact
description: Previous year CPS for income matching
- id: in_acs
label: ACS 2022
node_type: artifact
description: Training data for rent QRF
- id: in_sipp
label: SIPP 2023
node_type: artifact
description: Training data for tips QRF
- id: in_scf
label: SCF 2022
node_type: artifact
description: Training data for auto loans QRF
- id: in_org
label: CPS Basic ORG 2024
node_type: external
description: Monthly CPS basic ORG wage microdata used to train labor-market imputations
- id: in_uprating
label: uprating_factors.csv
node_type: artifact
description: PE uprating factors table
- id: out_cps
label: cps_2024.h5
node_type: artifact
description: Dataset.ARRAYS format, ~65K households (half-sample)
- id: out_puf
label: puf_2024.h5
node_type: artifact
description: Dataset.ARRAYS format
- id: in_irs_puf
label: irs_puf_2015.h5
node_type: artifact
description: Raw IRS PUF from substage 1a
- id: in_demographics
label: demographics_2015.csv
node_type: artifact
description: PUF demographics from HuggingFace
- id: in_cps_pension
label: CPS_2024 / CPS_2021
node_type: artifact
description: CPS donor sample for pension QRF; falls back to CPS_2021 if current CPS is unavailable
- id: util_seeded_rng
label: seeded_rng()
node_type: utility
description: Deterministic per-variable RNG
- id: util_qrf
label: microimpute QRF
node_type: utility
description: fit_predict() for sequential imputation
- id: util_retirement_limits
label: get_retirement_limits()
node_type: utility
description: IRS contribution limits
edges:
- source: in_census_cps
target: add_id_variables
edge_type: data_flow
label: raw CPS tables
- source: add_id_variables
target: add_personal_variables
edge_type: data_flow
- source: add_personal_variables
target: add_personal_income_variables
edge_type: data_flow
- source: add_personal_income_variables
target: add_previous_year_income
edge_type: data_flow
- source: in_census_cps_prev
target: add_previous_year_income
edge_type: data_flow
label: prior year PERIDNUM
- source: add_previous_year_income
target: add_ssn_card_type
edge_type: data_flow
- source: add_ssn_card_type
target: add_spm_variables
edge_type: data_flow
- source: add_spm_variables
target: add_household_variables
edge_type: data_flow
- source: add_household_variables
target: add_rent
edge_type: data_flow
- source: in_acs
target: add_rent
edge_type: external_source
label: ACS training data
- source: add_rent
target: add_tips
edge_type: data_flow
- source: in_sipp
target: add_tips
edge_type: external_source
label: SIPP training data
- source: add_tips
target: add_org_inputs
edge_type: data_flow
- source: in_org
target: add_org_inputs
edge_type: external_source
label: ORG donor data
- source: add_org_inputs
target: add_auto_loan
edge_type: data_flow
- source: in_scf
target: add_auto_loan
edge_type: external_source
label: SCF training data
- source: add_auto_loan
target: add_takeup
edge_type: data_flow
- source: add_takeup
target: downsample
edge_type: data_flow
- source: downsample
target: out_cps
edge_type: produces_artifact
label: cps_2024.h5
- source: in_irs_puf
target: preprocess_puf
edge_type: data_flow
label: raw PUF records
- source: preprocess_puf
target: simulate_qbi
edge_type: data_flow
- source: simulate_qbi
target: impute_puf_demographics
edge_type: data_flow
- source: in_demographics
target: impute_puf_demographics
edge_type: data_flow
label: demographics_2015.csv
- source: impute_puf_demographics
target: impute_puf_pension
edge_type: data_flow
- source: in_cps_pension
target: impute_puf_pension
edge_type: data_flow
label: CPS donor sample
- source: impute_puf_pension
target: mortgage_convert
edge_type: data_flow
- source: mortgage_convert
target: out_puf
edge_type: produces_artifact
label: puf_2024.h5
- source: in_uprating
target: out_puf
edge_type: data_flow
label: SOI growth rates
- source: util_seeded_rng
target: add_takeup
edge_type: uses_utility
- source: util_qrf
target: add_rent
edge_type: uses_utility
- source: util_qrf
target: add_tips
edge_type: uses_utility
- source: util_qrf
target: add_org_inputs
edge_type: uses_utility
- source: util_qrf
target: add_auto_loan
edge_type: uses_utility
- source: util_retirement_limits
target: add_personal_income_variables
edge_type: uses_utility
- source: util_qrf
target: impute_puf_demographics
edge_type: uses_utility
- source: util_qrf
target: impute_puf_pension
edge_type: uses_utility
status: current
stability: moving
- id: 1c_extended_cps_puf_clone
label: 1c
title: 'Substage 1c: Extended CPS (PUF Clone)'
canonical_stage_id: 1_build_datasets
legacy_stage_id: '2'
manifest_step_ids:
- 01_build_datasets
description: Merge CPS + PUF via cloning, rematch clone features, QRF-impute incomes and CPS-only vars, then finalize Extended CPS inputs
country: us
extra_nodes:
- id: in_cps_s2
label: CPS_2024_Full
node_type: artifact
description: From Stage 1 (full sample)
- id: in_puf_s2
label: PUF_2024
node_type: artifact
description: From Stage 1
- id: in_blocks_s2
label: block_cd_distributions.csv.gz
node_type: artifact
description: Census block populations
- id: in_scf_s2
label: SCF_2022
node_type: artifact
description: From substage 1a (mortgage-balance donor sample)
- id: geo_assign_s2
label: Geography Assignment
node_type: process
description: assign_random_geography() - population-weighted block draw
- id: out_ext
label: extended_cps_2024.h5
node_type: artifact
description: ~260K households (doubled), CPS half + PUF half
- id: util_qrf_s2
label: microimpute QRF
node_type: utility
description: fit_predict() for sequential imputation
- id: util_knn_s2
label: sklearn NearestNeighbors
node_type: utility
description: Role-aware donor matching on standardized clone predictors
edges:
- source: in_cps_s2
target: geo_assign_s2
edge_type: data_flow
label: CPS records
- source: in_blocks_s2
target: geo_assign_s2
edge_type: data_flow
label: block populations
- source: in_puf_s2
target: record_double
edge_type: data_flow
label: PUF records
- source: in_cps_s2
target: record_double
edge_type: data_flow
label: CPS records
- source: geo_assign_s2
target: record_double
edge_type: data_flow
- source: record_double
target: puf_qrf_pass
edge_type: data_flow
- source: puf_qrf_pass
target: retire_impute
edge_type: data_flow
- source: puf_qrf_pass
target: weeks_impute
edge_type: data_flow
- source: retire_impute
target: ss_reconcile
edge_type: data_flow
- source: weeks_impute
target: ss_reconcile
edge_type: data_flow
- source: ss_reconcile
target: clone_features
edge_type: data_flow
- source: clone_features
target: cps_only
edge_type: data_flow
- source: cps_only
target: qrf_pass2
edge_type: data_flow
- source: qrf_pass2
target: mortgage_hints
edge_type: data_flow
- source: in_scf_s2
target: mortgage_hints
edge_type: data_flow
label: SCF donor sample
- source: mortgage_hints
target: mortgage_convert
edge_type: data_flow
- source: mortgage_convert
target: computed_export_contract
edge_type: data_flow
- source: computed_export_contract
target: out_ext
edge_type: produces_artifact
- source: util_qrf_s2
target: puf_qrf_pass
edge_type: uses_utility
- source: util_qrf_s2
target: cps_only
edge_type: uses_utility
- source: util_qrf_s2
target: mortgage_hints
edge_type: uses_utility
- source: util_knn_s2
target: clone_features
edge_type: uses_utility
status: current
stability: moving
- id: 1d_enhanced_cps_reweighting
label: 1d
title: 'Substage 1d: Enhanced CPS Reweighting'
canonical_stage_id: 1_build_datasets
legacy_stage_id: 3a
manifest_step_ids:
- 01_build_datasets
description: Reweight Extended CPS to match national IRS/Census/CBO targets, then apply the 2025 ACA post-calibration override (deprecated ECPS pathway)
country: us
extra_nodes:
- id: in_ext_half
label: ExtendedCPS_2024_Half
node_type: artifact
description: Half-sample from Stage 2
- id: build_loss
label: build_loss_matrix()
node_type: process
description: Hundreds of calibration targets - returns (matrix, target_vector)
- id: t_soi
label: IRS SOI
node_type: external
description: AGI, income types, filer counts by AGI band / filing status
- id: t_census
label: Census Population
node_type: external
description: 86 single-year age groups from np2023_d5_mid.csv
- id: t_cbo
label: CBO Budget
node_type: external
description: Income tax, SNAP, SS, SSI, UC
- id: t_state
label: State Targets
node_type: process
description: 50 states + DC - population, AGI, ACA, SNAP, age groups
- id: t_jct
label: JCT Tax Expenditures
node_type: external
description: SALT, medical, charitable - counterfactual simulations
- id: weight_validate
label: Weight Validation
node_type: process
description: No NaN, no negatives - 100M < total HH < 200M
- id: out_enhanced
label: enhanced_cps_2024.h5
node_type: artifact
description: Reweighted production simulation dataset
- id: util_loss
label: build_loss_matrix()
node_type: utility
description: utils/loss.py
- id: util_l0_s3
label: HardConcrete L0
node_type: utility
description: utils/l0.py
edges:
- source: in_ext_half
target: build_loss
edge_type: data_flow
- source: t_soi
target: build_loss
edge_type: external_source
- source: t_census
target: build_loss
edge_type: external_source
- source: t_cbo
target: build_loss
edge_type: external_source
- source: t_jct
target: build_loss
edge_type: external_source
- source: t_state
target: build_loss
edge_type: external_source
- source: build_loss
target: reweight
edge_type: data_flow
label: (matrix, targets)
- source: reweight
target: weight_validate
edge_type: data_flow
- source: weight_validate
target: aca_2025_override
edge_type: data_flow
- source: aca_2025_override
target: out_enhanced
edge_type: produces_artifact
- source: util_loss
target: build_loss
edge_type: uses_utility
- source: util_l0_s3
target: reweight
edge_type: uses_utility
status: current
stability: moving
- id: 1e_stratified_cps
label: 1e
title: 'Substage 1e: Stratified CPS'
canonical_stage_id: 1_build_datasets
legacy_stage_id: 3b
manifest_step_ids:
- 01_build_datasets
description: Stratify Extended CPS by income - keep top 1%, sample remaining 99%
country: us
groups:
- id: create_stratified
label: create_stratified_cps_dataset()
description: Wrapper around AGI calculation, top-1% retention, and sampling into the stratified CPS artifact
node_ids:
- calc_agi
- strat_top
- strat_sample
- out_strat
extra_nodes:
- id: in_ext_cps
label: extended_cps_2024.h5
node_type: artifact
description: From Stage 2 (~260K HH)
- id: calc_agi
label: Calculate AGI
node_type: process
description: Microsimulation.calculate() - adjusted_gross_income mapped to household
- id: strat_top
label: Retain Top 1% by AGI
node_type: process
description: All high-income households kept - preserves tail representation
- id: strat_sample
label: Uniform Sample Remaining 99%
node_type: process
description: 'Target: ~12,000 households - optional 1.5x oversample of bottom 25%'
- id: out_strat
label: stratified_extended_cps_2024.h5
node_type: artifact
description: ~12K households - input to Stages 4-8
edges:
- source: in_ext_cps
target: calc_agi
edge_type: data_flow
- source: calc_agi
target: strat_top
edge_type: data_flow
- source: strat_top
target: strat_sample
edge_type: data_flow
- source: strat_top
target: out_strat
edge_type: data_flow
label: top 1%
- source: strat_sample
target: out_strat
edge_type: data_flow
label: sampled 99%
status: current
stability: moving
- id: 1f_source_imputation
label: 1f
title: 'Substage 1f: Source Imputation (ACS + SIPP + SCF)'
canonical_stage_id: 1_build_datasets
legacy_stage_id: '4'
manifest_step_ids:
- 01_build_datasets
description: Impute wealth/assets from external surveys onto stratified CPS via QRF
country: us
extra_nodes:
- id: in_strat_s4
label: stratified_extended_cps_2024.h5
node_type: artifact
description: From Stage 3 (~12K HH)
- id: in_acs_s4
label: ACS_2022
node_type: artifact
description: American Community Survey - has state_fips predictor
- id: in_sipp_s4
label: SIPP 2023
node_type: external
description: pu2023_slim.csv from HuggingFace
- id: in_scf_s4
label: SCF_2022
node_type: artifact
description: Survey of Consumer Finances - 50% random subsample
- id: sipp_assets_qrf
label: SIPP Assets QRF
node_type: process
description: 5 predictors - imputes bank_account_assets, stock_assets, bond_assets
- id: out_imputed
label: source_imputed_stratified_extended_cps.h5
node_type: artifact
description: Enriched with ACS/SIPP/SCF vars - uploaded to HuggingFace
- id: util_clone_assign
label: clone_and_assign.py
node_type: utility
description: Geography assignment
- id: util_qrf_s4
label: microimpute QRF
node_type: utility
description: fit_predict() for sequential imputation
edges:
- source: in_strat_s4
target: geo_assign
edge_type: data_flow
- source: geo_assign
target: acs_qrf
edge_type: data_flow
label: state_fips
- source: in_acs_s4
target: acs_qrf
edge_type: data_flow
- source: in_sipp_s4
target: sipp_qrf
edge_type: external_source
- source: in_sipp_s4
target: sipp_assets_qrf
edge_type: external_source
- source: in_scf_s4
target: scf_qrf
edge_type: external_source
- source: acs_qrf
target: sipp_qrf
edge_type: data_flow
label: chain
- source: sipp_qrf
target: sipp_assets_qrf
edge_type: data_flow
label: chain
- source: sipp_assets_qrf
target: scf_qrf
edge_type: data_flow
label: chain
- source: scf_qrf
target: out_imputed
edge_type: produces_artifact
- source: util_clone_assign
target: geo_assign
edge_type: uses_utility
- source: util_qrf_s4
target: acs_qrf
edge_type: uses_utility
- source: util_qrf_s4
target: sipp_qrf
edge_type: uses_utility
- source: util_qrf_s4
target: sipp_assets_qrf
edge_type: uses_utility
- source: util_qrf_s4
target: scf_qrf
edge_type: uses_utility
status: current
stability: moving
- id: 1g_stage_base_datasets
label: 1g
title: 'Substage 1g: Stage Base Datasets'
canonical_stage_id: 1_build_datasets
legacy_stage_id: '7'
manifest_step_ids:
- 04_stage_base_datasets
description: Stage base source-imputed datasets and policy database artifacts for the run
country: us
extra_nodes:
- id: in_source_imputed_s1g
label: source_imputed_*.h5
node_type: artifact
description: Base dataset artifacts copied into the pipeline volume
- id: in_policy_db_s1g
label: policy_data.db
node_type: artifact
description: Policy target database copied into the pipeline volume
- id: hf_staging_base_s1g
label: HuggingFace staging/{candidate_version}/{run_id}
node_type: external
description: Run-scoped staging prefix for base datasets
- id: stage_base_datasets
label: stage base datasets
node_type: process
description: Record base source-imputed datasets and policy database artifacts as staged run outputs.
source_file: modal_app/pipeline.py
status: current
stability: moving
validation_commands:
- uv run pytest tests/unit/test_pipeline.py
- id: out_staged_base_s1g
label: staged base datasets
node_type: artifact
description: Base artifacts uploaded to staging paths for later promotion
edges:
- source: in_source_imputed_s1g
target: stage_base_datasets
edge_type: data_flow
- source: in_policy_db_s1g
target: stage_base_datasets
edge_type: data_flow
- source: stage_base_datasets
target: out_staged_base_s1g
edge_type: produces_artifact
- source: out_staged_base_s1g
target: hf_staging_base_s1g
edge_type: data_flow
label: uploaded to
status: current
stability: moving
- id: 2a_matrix_build_calibration_target_construction
label: 2a
title: 'Substage 2a: Matrix Build (Calibration Target Construction)'
canonical_stage_id: 2_build_calibration_package
legacy_stage_id: '5'
manifest_step_ids:
- 02_build_package
description: Build sparse calibration matrix (targets x households x clones)
country: us
groups:
- id: run_calibration_build
label: run_calibration()
description: 'Build phase: resolve targets and constraints, assemble clone values, and package the sparse calibration matrix'
node_ids:
- stage2_input_bundle
- stage2_build_context
- stage2_target_config_identity
- stage2_target_catalog_load
- stage2_target_catalog_reader
- stage2_target_selection_policy
- stage2_target_selection_result
- stage2_geography_assignment_spec
- stage2_geography_assignment_result
- target_resolve
- stage2_target_config_apply
- target_uprate
- geo_build
- constraint_resolve
- state_precomp
- clone_assembly
- takeup_rerand
- sparse_build
- build_matrix
- build_matrix_chunked
- stage2_artifact_specs
- stage2_payload_boundary
- stage2_payload_writer
- stage2_payload_reader
- stage2_calibration_package_writer
- out_pkg
- out_metadata
- out_targets
- out_target_facets
- out_geography_summary
- stage2_calibration_package_contract_writer
- out_contract
- stage2_calibration_package_contract_validator
extra_nodes:
- id: in_stage1_contract_s2
label: dataset_build_output.json
node_type: artifact
description: Stage 1 handoff contract preferred for Stage 2 input resolution
- id: in_cps_s5
label: source_imputed_stratified_extended_cps.h5
node_type: artifact
description: From Stage 4 (~12K HH)
- id: in_db_s5
label: policy_data.db
node_type: external
description: SQLite calibration database - 10-step ETL
- id: in_config_s5
label: target_config.yaml
node_type: artifact
description: Active target include list
- id: in_blocks_s5
label: block_cd_distributions.csv.gz
node_type: artifact
description: Census block populations
- id: target_resolve
label: Target Resolution
node_type: process
description: SQL query to target_overview - ~8,000 rows total
- id: target_uprate
label: Target Uprating
node_type: process
description: CPI-U for dollars, pop growth for counts
- id: geo_build
label: Geography Index Build
node_type: process
description: state_to_cols, cd_to_cols maps
- id: constraint_resolve
label: Constraint Resolution
node_type: process
description: Non-geographic constraints from DB (age, medicaid, filer)
- id: takeup_rerand
label: Block-Level Takeup Re-randomization
node_type: process
description: Seeded on (block_geoid, hh_id) - ensures calibration consistency
- id: sparse_build
label: Sparse Matrix Construction
node_type: process
description: COO triples -> CSR matrix - shape (n_targets, 5.16M), ~0.02% nonzero
- id: out_pkg
label: calibration_package.pkl
node_type: artifact
description: X_sparse CSR matrix, targets_df, initial_weights, metadata
- id: out_metadata
label: calibration_package_meta.json
node_type: artifact
description: Metadata sidecar generated from the typed package payload and Stage 2 contract
- id: out_targets
label: calibration_targets.jsonl
node_type: artifact
description: Row-level selected target metadata with stable target_id and target_index join keys
- id: out_target_facets
label: calibration_target_facets.json
node_type: artifact
description: Compact target counts by variable, geography level, target name, period, and constraint key
- id: out_geography_summary
label: geography_assignment_summary.json
node_type: artifact
description: Compact clone-major geography identity summary for block, county, state, and congressional district arrays
- id: out_contract
label: calibration_package_contract.json
node_type: artifact
description: Stage 2 package handoff contract written next to calibration_package.pkl
- id: util_sql
label: sqlalchemy
node_type: utility
description: Database queries
- id: util_pool
label: ProcessPoolExecutor
node_type: utility
description: Parallel state computation
- id: util_takeup_s5
label: compute_block_takeup_for_entities()
node_type: utility
description: utils/takeup.py
- id: util_scipy
label: scipy.sparse
node_type: utility
description: CSR/COO matrix construction
edges:
- source: in_stage1_contract_s2
target: stage2_input_bundle
edge_type: data_flow
label: preferred input contract
- source: in_cps_s5
target: stage2_input_bundle
edge_type: data_flow
label: compatibility fallback
- source: in_db_s5
target: stage2_input_bundle
edge_type: external_source
label: compatibility fallback
- source: stage2_input_bundle
target: stage2_build_context
edge_type: data_flow
label: validated inputs
- source: stage2_artifact_specs
target: stage2_build_context
edge_type: uses_utility
label: output bundle paths
- source: stage2_build_context
target: target_resolve
edge_type: data_flow
label: dataset and database paths
- source: stage2_build_context
target: stage2_calibration_package_writer
edge_type: uses_utility
label: package output bundle
- source: in_db_s5
target: target_resolve
edge_type: external_source
label: SQL targets
- source: in_config_s5
target: stage2_target_config_identity
edge_type: data_flow
label: config file
- source: stage2_target_config_identity
target: stage2_target_catalog_load
edge_type: data_flow
label: resolved path and checksum
- source: in_db_s5
target: stage2_target_catalog_reader
edge_type: external_source
label: active and disabled targets
- source: stage2_target_catalog_reader
target: stage2_target_selection_policy
edge_type: data_flow
label: target catalog
- source: stage2_target_catalog_load
target: stage2_target_selection_policy
edge_type: data_flow
label: include/exclude rules
- source: stage2_target_selection_policy
target: stage2_target_selection_result
edge_type: data_flow
label: selected targets
- source: stage2_target_selection_result
target: build_matrix
edge_type: data_flow
label: matrix target order
- source: stage2_target_selection_result
target: build_matrix_chunked
edge_type: data_flow
label: matrix target order
- source: in_cps_s5
target: stage2_geography_assignment_spec
edge_type: data_flow
label: household AGI and fixed state overrides
- source: in_db_s5
target: stage2_geography_assignment_spec
edge_type: external_source
label: district AGI targets
- source: stage2_geography_assignment_spec
target: stage2_geography_assignment_result