33import time
44from logging_logic import log_execution_time
55from templates .utils .models import columns_in_formula
6+ from config import DEMOSConfig , KidsMovingModuleConfig , get_config
67
78STEP_NAME = "kids_moving"
89REQUIRED_COLUMNS = [
@@ -39,6 +40,10 @@ def kids_moving(persons, households, get_new_households):
3940 log_execution_time (start_time , orca .get_injectable ("year" ), "kids_moving" )
4041
4142def update_households_after_kids (persons , households , kids_moving , get_new_households ):
43+ # Load module config
44+ demos_config : DEMOSConfig = get_config ()
45+ module_config : KidsMovingModuleConfig = demos_config .kids_moving_module_config
46+
4247 # Kids moving to a new household conditions
4348 ## Condition 1: Kids flagged by kids_moving
4449 ## Condition 2: Households with more than 1 people
@@ -65,9 +70,9 @@ def update_households_after_kids(persons, households, kids_moving, get_new_house
6570 # Get the old household_id for the moving kids to retrieve the county_id
6671 # TODO: Parametrize county_id
6772 old_household_id = persons .local .loc [kids_moving_index , "household_id" ].values
68- county_assignment = households .local .loc [old_household_id , "lcm_county_id" ].values
73+ county_assignment = households .local .loc [old_household_id , module_config . geoid_col ].values
6974
7075 new_households = get_new_households (kids_moving_index .sum ())
7176 persons .local .loc [kids_moving_index , "household_id" ] = new_households
7277 persons .local .loc [kids_moving_index , "relate" ] = 0
73- households .local .loc [new_households , "lcm_county_id" ] = county_assignment
78+ households .local .loc [new_households , module_config . geoid_col ] = county_assignment
0 commit comments