11import orca
2- import numpy as np
3- import pandas as pd
42from templates import estimated_models , modelmanager as mm
53import time
64from logging_logic import log_execution_time
75from templates .utils .models import columns_in_formula
86
9- @orca .step ("kids_moving_model" )
10- def kids_moving_model (persons , households , get_new_households ):
7+ STEP_NAME = "kids_moving"
8+ REQUIRED_COLUMNS = [
9+ "persons.age" ,
10+ "persons.relate" ,
11+ ]
12+
13+ @orca .step (STEP_NAME )
14+ def kids_moving (persons , households , get_new_households ):
1115 """
12- Running the kids moving model and updating household
13- stats .
16+ Executes the `kids_move` estimated model and updates the household of kids
17+ moving out of their parent's home accordingly .
1418
15- Args:
16- persons (DataFrameWrapper): DataFrameWrapper of the persons table
17- households (DataFrameWrapper): DataFrameWrapper of the households table
19+ **Required tables:**
20+ - persons
21+ - households
1822
19- Returns:
20- None
23+ **Modifies State Variables:**
24+ - persons.household_id
25+ - persons.relate
26+ - households.lcm_county_id
2127 """
2228 start_time = time .time ()
2329
@@ -33,23 +39,6 @@ def kids_moving_model(persons, households, get_new_households):
3339 log_execution_time (start_time , orca .get_injectable ("year" ), "kids_moving" )
3440
3541def update_households_after_kids (persons , households , kids_moving , get_new_households ):
36- """
37- Add and update households after kids move out.
38-
39- Modifies State Variables:
40- - persons.household_id
41- - persons.relate
42- - households.lcm_county_id
43-
44- Args:
45- persons (DataFrameWrapper): DataFrameWrapper of persons table
46- households (DataFrameWrapper): DataFrameWrapper of households table
47- kids_moving (pd.Series): Pandas Series of kids moving out of household
48-
49- Returns:
50- None
51- """
52-
5342 # Kids moving to a new household conditions
5443 ## Condition 1: Kids flagged by kids_moving
5544 ## Condition 2: Households with more than 1 people
0 commit comments