1717
1818
1919test_lite = os .environ .get ("TEST_LITE" )
20- print ( 3 + 3 )
20+
2121
2222class CPS (Dataset ):
2323 name = "cps"
@@ -66,7 +66,6 @@ def generate(self):
6666 cps ,
6767 person ,
6868 spm_unit ,
69- self .time_period ,
7069 undocumented_target = 13e6 ,
7170 undocumented_workers_target = 8.3e6 ,
7271 undocumented_students_target = 0.21 * 1.9e6 ,
@@ -707,7 +706,6 @@ def add_ssn_card_type(
707706 cps : h5py .File ,
708707 person : pd .DataFrame ,
709708 spm_unit : pd .DataFrame ,
710- time_period : int ,
711709 undocumented_target : float = 13e6 ,
712710 undocumented_workers_target : float = 8.3e6 ,
713711 undocumented_students_target : float = 0.21 * 1.9e6 ,
@@ -1392,7 +1390,7 @@ def get_arrival_year_midpoint(peinusyr):
13921390
13931391 # Calculate arrival years once for all logic
13941392 arrival_years = get_arrival_year_midpoint (person .PEINUSYR )
1395- CURRENT_YEAR = time_period
1393+ CURRENT_YEAR = 2024
13961394 years_in_us = CURRENT_YEAR - arrival_years
13971395 age_at_entry = np .maximum (0 , person .A_AGE - years_in_us )
13981396
@@ -1416,11 +1414,10 @@ def get_arrival_year_midpoint(peinusyr):
14161414
14171415 # 3. Cuban / Haitian entrants (created by Congress in 1980)
14181416 # Only those who arrived after 1980
1419- CUBAN_HAITIAN_ARRIVAL_CUTOFF = 1980
14201417 cuban_haitian_mask = (
14211418 (ssn_card_type != 0 )
14221419 & np .isin (birth , list (COUNTRY_CODES ["CUBAN_HAITIAN" ]))
1423- & (arrival_years >= CUBAN_HAITIAN_ARRIVAL_CUTOFF )
1420+ & (arrival_years >= 1980 )
14241421 )
14251422 immigration_status [cuban_haitian_mask ] = "CUBAN_HAITIAN_ENTRANT"
14261423
@@ -1449,6 +1446,19 @@ def get_arrival_year_midpoint(peinusyr):
14491446 )
14501447 immigration_status [mask ] = "TPS"
14511448
1449+ # ---------------------------------------------------------------
1450+ # Map custom labels into Enum-approved buckets
1451+ placeholder_to_specific_status = {
1452+ "TEMP_NONQUALIFIED" : "TPS" ,
1453+ }
1454+ needs_translation = np .isin (
1455+ immigration_status , list (placeholder_to_specific_status .keys ())
1456+ )
1457+ immigration_status [needs_translation ] = (
1458+ pd .Series (immigration_status [needs_translation ])
1459+ .replace (placeholder_to_specific_status )
1460+ .values
1461+ )
14521462 # Final write (all values now in ImmigrationStatus Enum)
14531463 cps ["immigration_status" ] = immigration_status .astype ("S" )
14541464 # ============================================================================
0 commit comments