Skip to content

Codebook

The codebook modules define enumerated value labels and standardized coding schemes used throughout the survey processing pipeline.

Overview

Codebook enumerations use the LabeledEnum pattern to provide both numeric codes and human-readable labels. These are used for:

  • Data validation and type checking
  • Consistent coding across different survey years
  • Output formatting for travel demand models
  • Documentation and data dictionaries

Usage Example

from data_canon.codebook.trips import Mode, Purpose

# Access code and label
mode_code = Mode.WALK_TRANSIT.value  # 11
mode_label = Mode.WALK_TRANSIT.label  # "Walk to transit"

# Validate and look up
purpose = Purpose(4)  # Purpose.SHOPPING_ERRANDS
print(purpose.label)  # "Appointment, shopping, or errands (e.g., gas)"

data_canon.codebook.households

Codebook enumerations for hh table.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

BicycleType

bicycle_type value labels.

STANDARD class-attribute instance-attribute

STANDARD = (1, 'Standard')

ELECTRIC class-attribute instance-attribute

ELECTRIC = (2, 'Electric')

OTHER class-attribute instance-attribute

OTHER = (3, 'Other')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

HomeInRegion

home_in_region value labels.

NO class-attribute instance-attribute

NO = (0, 'No')

YES class-attribute instance-attribute

YES = (1, 'Yes')

IncomeDetailed

income_detailed value labels.

INCOME_UNDER15 class-attribute instance-attribute

INCOME_UNDER15 = (1, 'Under $15,000')

INCOME_15TO25 class-attribute instance-attribute

INCOME_15TO25 = (2, '$15,000-$24,999')

INCOME_25TO35 class-attribute instance-attribute

INCOME_25TO35 = (3, '$25,000-$34,999')

INCOME_35TO50 class-attribute instance-attribute

INCOME_35TO50 = (4, '$35,000-$49,999')

INCOME_50TO75 class-attribute instance-attribute

INCOME_50TO75 = (5, '$50,000-$74,999')

INCOME_75TO100 class-attribute instance-attribute

INCOME_75TO100 = (6, '$75,000-$99,999')

INCOME_100TO150 class-attribute instance-attribute

INCOME_100TO150 = (7, '$100,000-$149,999')

INCOME_150TO200 class-attribute instance-attribute

INCOME_150TO200 = (8, '$150,000-$199,999')

INCOME_200TO250 class-attribute instance-attribute

INCOME_200TO250 = (9, '$200,000-$249,999')

INCOME_250_OR_MORE class-attribute instance-attribute

INCOME_250_OR_MORE = (10, '$250,000 or more')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

IncomeFollowup

income_followup value labels.

INCOME_UNDER25 class-attribute instance-attribute

INCOME_UNDER25 = (1, 'Under $25,000')

INCOME_25TO50 class-attribute instance-attribute

INCOME_25TO50 = (2, '$25,000-$49,999')

INCOME_50TO75 class-attribute instance-attribute

INCOME_50TO75 = (3, '$50,000-$74,999')

INCOME_75TO100 class-attribute instance-attribute

INCOME_75TO100 = (4, '$75,000-$99,999')

INCOME_100TO200 class-attribute instance-attribute

INCOME_100TO200 = (5, '$100,000-$199,999')

INCOME_200_OR_MORE class-attribute instance-attribute

INCOME_200_OR_MORE = (6, '$200,000 or more')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

IncomeBroad

income_bin value labels.

INCOME_UNDER25 class-attribute instance-attribute

INCOME_UNDER25 = (1, 'Under $25,000')

INCOME_25TO50 class-attribute instance-attribute

INCOME_25TO50 = (2, '$25,000-$49,999')

INCOME_50TO75 class-attribute instance-attribute

INCOME_50TO75 = (3, '$50,000-$74,999')

INCOME_75TO100 class-attribute instance-attribute

INCOME_75TO100 = (4, '$75,000-$99,999')

INCOME_100TO200 class-attribute instance-attribute

INCOME_100TO200 = (5, '$100,000-$199,999')

INCOME_200_OR_MORE class-attribute instance-attribute

INCOME_200_OR_MORE = (6, '$200,000 or more')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

BREAKPOINTS class-attribute instance-attribute

BREAKPOINTS = nonmember([25000, 50000, 75000, 100000, 200000])

ParticipationGroup

participation_group value labels.

SIGNUP_BMOVE_DIARY_BMOVE class-attribute instance-attribute

SIGNUP_BMOVE_DIARY_BMOVE = (
    1,
    "Signup via browserMove, Diary via browserMove",
)

SIGNUP_BMOVE_DIARY_CALL_CENTER class-attribute instance-attribute

SIGNUP_BMOVE_DIARY_CALL_CENTER = (
    2,
    "Signup via browserMove, Diary via call center",
)

SIGNUP_BMOVE_DIARY_RMOVE class-attribute instance-attribute

SIGNUP_BMOVE_DIARY_RMOVE = (
    3,
    "Signup via browserMove, Diary via rMove",
)

SIGNUP_CALL_DIARY_BMOVE class-attribute instance-attribute

SIGNUP_CALL_DIARY_BMOVE = (
    4,
    "Signup via call center, Diary via browserMove",
)

SIGNUP_CALL_DIARY_CALL_CENTER class-attribute instance-attribute

SIGNUP_CALL_DIARY_CALL_CENTER = (
    5,
    "Signup via call center, Diary via call center",
)

SIGNUP_CALL_DIARY_RMOVE class-attribute instance-attribute

SIGNUP_CALL_DIARY_RMOVE = (
    6,
    "Signup via call center, Diary via rMove",
)

SIGNUP_RMOVE_DIARY_BMOVE class-attribute instance-attribute

SIGNUP_RMOVE_DIARY_BMOVE = (
    7,
    "Signup via rMove, Diary via browserMove",
)

SIGNUP_RMOVE_DIARY_CALL_CENTER class-attribute instance-attribute

SIGNUP_RMOVE_DIARY_CALL_CENTER = (
    8,
    "Signup via rMove, Diary via call center",
)

SIGNUP_RMOVE_DIARY_RMOVE class-attribute instance-attribute

SIGNUP_RMOVE_DIARY_RMOVE = (9, 'Signup via rMove, Diary via rMove')

ResidenceRentOwn

residence_rent_own value labels.

OWN class-attribute instance-attribute

OWN = (1, 'Own/buying (paying a mortgage)')

RENT class-attribute instance-attribute

RENT = (2, 'Rent')

NOPAYMENT_EMPLOYER class-attribute instance-attribute

NOPAYMENT_EMPLOYER = (3, 'Housing provided by job or military')

NOPAYMENT_OTHER class-attribute instance-attribute

NOPAYMENT_OTHER = (
    4,
    "Provided by family or friend without payment or rent",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER class-attribute instance-attribute

OTHER = (997, 'Other')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

ResidenceType

residence_type value labels.

SFH class-attribute instance-attribute

SFH = (1, 'Single-family house (detached house)')

TOWNHOUSE class-attribute instance-attribute

TOWNHOUSE = (
    2,
    "Single-family house attached to one or more houses (rowhouse or townhouse)",
)

MULTIFAMILY class-attribute instance-attribute

MULTIFAMILY = (
    3,
    "Building with 2-4 units (duplexes, triplexes, quads)",
)

CONDO_5TO50_UNITS class-attribute instance-attribute

CONDO_5TO50_UNITS = (4, 'Building with 5-49 apartments/condos')

CONDO_50PLUS_UNITS class-attribute instance-attribute

CONDO_50PLUS_UNITS = (
    5,
    "Building with 50 or more apartments/condos",
)

SENIOR class-attribute instance-attribute

SENIOR = (6, 'Senior or age-restricted apartments/condos')

MANUFACTURED class-attribute instance-attribute

MANUFACTURED = (7, 'Manufactured home/mobile home/trailer')

GROUP_QUARTERS class-attribute instance-attribute

GROUP_QUARTERS = (
    9,
    "Dorm, group quarters, or institutional housing",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

BOAT_RV class-attribute instance-attribute

BOAT_RV = (997, 'Other (e.g., boat, RV, van)')

data_canon.codebook.vehicles

Codebook enumerations for vehicle table.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

FuelType

fuel_type value labels.

GAS class-attribute instance-attribute

GAS = (1, 'Gas')

HEV class-attribute instance-attribute

HEV = (2, 'Hybrid (HEV)')

PHEV class-attribute instance-attribute

PHEV = (3, 'Plug-in hybrid (PHEV)')

EV class-attribute instance-attribute

EV = (4, 'Electric (EV)')

DIESEL class-attribute instance-attribute

DIESEL = (5, 'Diesel')

FLEX class-attribute instance-attribute

FLEX = (6, 'Flex fuel (FFV)')

BIO class-attribute instance-attribute

BIO = (997, 'Other (e.g., natural gas, bio-diesel)')

data_canon.codebook.persons

Codebook enumerations for person table.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

AgeCategory

age value labels.

AGE_UNDER_5 class-attribute instance-attribute

AGE_UNDER_5 = (1, 'Under 5')

AGE_5_TO_15 class-attribute instance-attribute

AGE_5_TO_15 = (2, '5 to 15')

AGE_16_TO_17 class-attribute instance-attribute

AGE_16_TO_17 = (3, '16 to 17')

AGE_18_TO_24 class-attribute instance-attribute

AGE_18_TO_24 = (4, '18 to 24')

AGE_25_TO_34 class-attribute instance-attribute

AGE_25_TO_34 = (5, '25 to 34')

AGE_35_TO_44 class-attribute instance-attribute

AGE_35_TO_44 = (6, '35 to 44')

AGE_45_TO_54 class-attribute instance-attribute

AGE_45_TO_54 = (7, '45 to 54')

AGE_55_TO_64 class-attribute instance-attribute

AGE_55_TO_64 = (8, '55 to 64')

AGE_65_TO_74 class-attribute instance-attribute

AGE_65_TO_74 = (9, '65 to 74')

AGE_75_TO_84 class-attribute instance-attribute

AGE_75_TO_84 = (10, '75 to 84')

AGE_85_AND_UP class-attribute instance-attribute

AGE_85_AND_UP = (11, '85 and up')

BREAKPOINTS class-attribute instance-attribute

BREAKPOINTS = nonmember([5, 16, 18, 25, 35, 45, 55, 65, 75, 85])

Education

education value labels.

LESS_HIGH_SCHOOL class-attribute instance-attribute

LESS_HIGH_SCHOOL = (1, 'Less than high school')

HIGHSCHOOL class-attribute instance-attribute

HIGHSCHOOL = (2, 'High school graduate/GED')

SOME_COLLEGE class-attribute instance-attribute

SOME_COLLEGE = (3, 'Some college, no degree')

VOCATIONAL class-attribute instance-attribute

VOCATIONAL = (4, 'Vocational/technical training')

ASSOCIATE class-attribute instance-attribute

ASSOCIATE = (5, 'Associate degree')

BACHELORS class-attribute instance-attribute

BACHELORS = (6, "Bachelor's degree")

GRAD class-attribute instance-attribute

GRAD = (7, 'Graduate/post-graduate degree')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

Employment

employment value labels.

EMPLOYED_FULLTIME class-attribute instance-attribute

EMPLOYED_FULLTIME = (1, 'Employed full-time (paid)')

EMPLOYED_PARTTIME class-attribute instance-attribute

EMPLOYED_PARTTIME = (2, 'Employed part-time (paid)')

EMPLOYED_SELF class-attribute instance-attribute

EMPLOYED_SELF = (3, 'Self-employed')

UNEMPLOYED_NOT_LOOKING class-attribute instance-attribute

UNEMPLOYED_NOT_LOOKING = (
    5,
    "Not employed and not looking for work (e.g., retired, stay-at-home parent, student)",
)

UNEMPLOYED_LOOKING class-attribute instance-attribute

UNEMPLOYED_LOOKING = (6, 'Unemployed and looking for work')

EMPLOYED_UNPAID class-attribute instance-attribute

EMPLOYED_UNPAID = (7, 'Unpaid volunteer or intern')

EMPLOYED_FURLOUGHED class-attribute instance-attribute

EMPLOYED_FURLOUGHED = (
    8,
    "Employed, but not currently working (e.g., on leave, furloughed 100%)",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

Ethnicity

ethnicity value labels.

NOT_HISPANIC class-attribute instance-attribute

NOT_HISPANIC = (1, 'Not Hispanic or Latino')

MEXICAN class-attribute instance-attribute

MEXICAN = (2, 'Mexican, Mexican American, Chicano')

PUERTO_RICAN class-attribute instance-attribute

PUERTO_RICAN = (3, 'Puerto Rican')

CUBAN class-attribute instance-attribute

CUBAN = (4, 'Cuban')

OTHER class-attribute instance-attribute

OTHER = (5, 'Other Hispanic or Latino')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

Gender

gender value labels.

FEMALE class-attribute instance-attribute

FEMALE = (1, 'Female')

MALE class-attribute instance-attribute

MALE = (2, 'Male')

TRANS class-attribute instance-attribute

TRANS = (3, 'Transgender')

NON_BINARY class-attribute instance-attribute

NON_BINARY = (4, 'Non-binary')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER class-attribute instance-attribute

OTHER = (997, 'Other/prefer to self-describe')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

Industry

industry value labels.

AGRICULTURE class-attribute instance-attribute

AGRICULTURE = (1, 'Agriculture, Forestry, Fishing, and Hunting')

MINING class-attribute instance-attribute

MINING = (2, 'Mining, Quarrying, and Oil and Gas Extraction')

UTILITIES class-attribute instance-attribute

UTILITIES = (3, 'Utilities')

CONSTRUCTION class-attribute instance-attribute

CONSTRUCTION = (4, 'Construction')

MANUFACTURING class-attribute instance-attribute

MANUFACTURING = (5, 'Manufacturing')

WHOLESALE_TRADE class-attribute instance-attribute

WHOLESALE_TRADE = (6, 'Wholesale Trade')

RETAIL_TRADE class-attribute instance-attribute

RETAIL_TRADE = (7, 'Retail Trade')

TRANSPORTATION class-attribute instance-attribute

TRANSPORTATION = (8, 'Transportation and Warehousing')

INFORMATION class-attribute instance-attribute

INFORMATION = (9, 'Information')

FINANCE_AND_INSURANCE class-attribute instance-attribute

FINANCE_AND_INSURANCE = (10, 'Finance and Insurance')

REALESTATE class-attribute instance-attribute

REALESTATE = (11, 'Real Estate and Rental and Leasing')

PROFESSIONAL class-attribute instance-attribute

PROFESSIONAL = (
    12,
    "Professional, Scientific, and Technical Services",
)

MANAGEMENT class-attribute instance-attribute

MANAGEMENT = (13, 'Management of Companies and Enteprises')

ADMINISTRATIVE class-attribute instance-attribute

ADMINISTRATIVE = (
    14,
    "Administrative and Support and Waste Management and Remediation Services",
)

EDUCATIONAL class-attribute instance-attribute

EDUCATIONAL = (15, 'Educational Services')

HEALTH_AND_SOCIAL class-attribute instance-attribute

HEALTH_AND_SOCIAL = (16, 'Health Care and Social Assistance')

ARTS_AND_RECREATION class-attribute instance-attribute

ARTS_AND_RECREATION = (17, 'Arts, Entertainment, and Recreation')

ACCOMMODATION class-attribute instance-attribute

ACCOMMODATION = (18, 'Accommodation and Food Services')

OTHER class-attribute instance-attribute

OTHER = (19, 'Other Services (except Public Administration)')

PUBLIC_ADMINISTRATION class-attribute instance-attribute

PUBLIC_ADMINISTRATION = (20, 'Public Administration')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER_SPECIFY class-attribute instance-attribute

OTHER_SPECIFY = (997, 'Other, please specify')

JobType

job_type value labels.

FIXED class-attribute instance-attribute

FIXED = (1, 'Go to one work location ONLY (outside of home)')

VARIES class-attribute instance-attribute

VARIES = (
    2,
    "Work location regularly varies (different offices/jobsites)",
)

WFH class-attribute instance-attribute

WFH = (
    3,
    "Work ONLY from home or remotely (telework, self-employed)",
)

DELIVERY class-attribute instance-attribute

DELIVERY = (
    4,
    "Drive/bike/travel for work (driver, sales, deliveries)",
)

HYBRID class-attribute instance-attribute

HYBRID = (
    5,
    "Work remotely some days and travel to a work location some days",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

Occupation

occupation value labels.

MANAGEMENT class-attribute instance-attribute

MANAGEMENT = (1, 'Management')

BUSINESS_FINANCE class-attribute instance-attribute

BUSINESS_FINANCE = (2, 'Business and Financial Operations')

COMPUTER_MATH class-attribute instance-attribute

COMPUTER_MATH = (3, 'Computer and Mathematical')

ARCH_ENG class-attribute instance-attribute

ARCH_ENG = (4, 'Architecture and Engineering')

SCIENCE class-attribute instance-attribute

SCIENCE = (5, 'Life, Physical, and Social Science')

COMMUNITY_SOCIAL class-attribute instance-attribute

COMMUNITY_SOCIAL = (6, 'Community and Social Service')

LEGAL class-attribute instance-attribute

LEGAL = (7, 'Legal')

EDUCATION class-attribute instance-attribute

EDUCATION = (8, 'Educational Instruction and Library')

ARTS_MEDIA class-attribute instance-attribute

ARTS_MEDIA = (9, 'Arts, Design, Entertainment, Sports, and Media')

HEALTHCARE_PROFESSIONAL class-attribute instance-attribute

HEALTHCARE_PROFESSIONAL = (
    10,
    "Healthcare Practitioners and Technical",
)

HEALTHCARE_SUPPORT class-attribute instance-attribute

HEALTHCARE_SUPPORT = (11, 'Healthcare Support')

PROTECTIVE class-attribute instance-attribute

PROTECTIVE = (12, 'Protective Service')

FOOD_SERVICE class-attribute instance-attribute

FOOD_SERVICE = (13, 'Food Preparation and Serving Related')

CLEANING_MAINTENANCE class-attribute instance-attribute

CLEANING_MAINTENANCE = (
    14,
    "Building and Grounds Cleaning and Maintenance",
)

PERSONAL_CARE class-attribute instance-attribute

PERSONAL_CARE = (15, 'Personal Care and Service')

SALES class-attribute instance-attribute

SALES = (16, 'Sales and Related')

OFFICE_ADMIN class-attribute instance-attribute

OFFICE_ADMIN = (17, 'Office and Administrative Support')

FARMING_FISHING class-attribute instance-attribute

FARMING_FISHING = (18, 'Farming, Fishing, and Forestry')

CONSTRUCTION class-attribute instance-attribute

CONSTRUCTION = (19, 'Construction and Extraction')

INSTALLATION_REPAIR class-attribute instance-attribute

INSTALLATION_REPAIR = (20, 'Installation, Maintenance, and Repair')

PRODUCTION class-attribute instance-attribute

PRODUCTION = (21, 'Production')

TRANSPORTATION class-attribute instance-attribute

TRANSPORTATION = (22, 'Transportation and Material Moving')

MILITARY class-attribute instance-attribute

MILITARY = (23, 'Military Specific')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER_PLEASE_SPECIFY class-attribute instance-attribute

OTHER_PLEASE_SPECIFY = (997, 'Other, please specify')

Race

race value labels.

AFAM class-attribute instance-attribute

AFAM = (1, 'African American or Black')

NATIVE class-attribute instance-attribute

NATIVE = (2, 'American Indian or Alaska Native')

ASIAN class-attribute instance-attribute

ASIAN = (3, 'Asian')

PACIFIC class-attribute instance-attribute

PACIFIC = (4, 'Native Hawaiian or Other Pacific Islander')

WHITE class-attribute instance-attribute

WHITE = (5, 'White')

OTHER class-attribute instance-attribute

OTHER = (6, 'Some other race')

MULTI class-attribute instance-attribute

MULTI = (7, 'Multiple races')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

Relationship

relationship value labels.

SELF class-attribute instance-attribute

SELF = (0, 'Self')

SPOUSE_PARTNER class-attribute instance-attribute

SPOUSE_PARTNER = (1, 'Spouse, partner')

CHILD class-attribute instance-attribute

CHILD = (2, 'Child or child-in-law')

PARENT class-attribute instance-attribute

PARENT = (3, 'Parent or parent-in-law')

SIBLING class-attribute instance-attribute

SIBLING = (4, 'Sibling or sibling-in-law')

OTHER_RELATIVE class-attribute instance-attribute

OTHER_RELATIVE = (5, 'Other relative (grandchild, cousin)')

NONRELATIVE class-attribute instance-attribute

NONRELATIVE = (6, 'Nonrelative (friend, roommate, household help)')

RemoteClassFreq

remote_class_freq value labels.

REMOTESCHOOL_6_7_DAYS class-attribute instance-attribute

REMOTESCHOOL_6_7_DAYS = (1, '6-7 days a week')

REMOTESCHOOL_5_DAYS class-attribute instance-attribute

REMOTESCHOOL_5_DAYS = (2, '5 days a week')

REMOTESCHOOL_4_DAYS class-attribute instance-attribute

REMOTESCHOOL_4_DAYS = (3, '4 days a week')

REMOTESCHOOL_3_DAYS class-attribute instance-attribute

REMOTESCHOOL_3_DAYS = (4, '3 days a week')

REMOTESCHOOL_2_DAYS class-attribute instance-attribute

REMOTESCHOOL_2_DAYS = (5, '2 days a week')

REMOTESCHOOL_1_DAY class-attribute instance-attribute

REMOTESCHOOL_1_DAY = (6, '1 day a week')

REMOTESCHOOL_1_3_PER_MONTH class-attribute instance-attribute

REMOTESCHOOL_1_3_PER_MONTH = (7, '1-3 days a month')

LESS_THAN_MONTHLY class-attribute instance-attribute

LESS_THAN_MONTHLY = (8, 'Less than monthly')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NEVER class-attribute instance-attribute

NEVER = (996, 'Never')

SchoolFreq

school_freq value labels.

SCHOOL_6_7_DAYS class-attribute instance-attribute

SCHOOL_6_7_DAYS = (1, '6-7 days a week')

SCHOOL_5_DAYS class-attribute instance-attribute

SCHOOL_5_DAYS = (2, '5 days a week')

SCHOOL_4_DAYS class-attribute instance-attribute

SCHOOL_4_DAYS = (3, '4 days a week')

SCHOOL_3_DAYS class-attribute instance-attribute

SCHOOL_3_DAYS = (4, '3 days a week')

SCHOOL_2_DAYS class-attribute instance-attribute

SCHOOL_2_DAYS = (5, '2 days a week')

SCHOOL_1_DAY class-attribute instance-attribute

SCHOOL_1_DAY = (6, '1 day a week')

SCHOOL_1_3_PER_MONTH class-attribute instance-attribute

SCHOOL_1_3_PER_MONTH = (7, '1-3 days a month')

LESS_THAN_MONTHLY class-attribute instance-attribute

LESS_THAN_MONTHLY = (8, 'Less than monthly')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NEVER class-attribute instance-attribute

NEVER = (996, 'Never')

SchoolType

school_type value labels.

ATHOME class-attribute instance-attribute

ATHOME = (1, 'Cared for at home')

DAYCARE class-attribute instance-attribute

DAYCARE = (2, 'Daycare outside home')

PRESCHOOL class-attribute instance-attribute

PRESCHOOL = (3, 'Preschool')

HOME_SCHOOL class-attribute instance-attribute

HOME_SCHOOL = (4, 'Home school')

ELEMENTARY class-attribute instance-attribute

ELEMENTARY = (5, 'Elementary school (public, private, charter)')

MIDDLE_SCHOOL class-attribute instance-attribute

MIDDLE_SCHOOL = (6, 'Middle school (public, private, charter)')

HIGH_SCHOOL class-attribute instance-attribute

HIGH_SCHOOL = (7, 'High school (public, private, charter)')

VOCATIONAL class-attribute instance-attribute

VOCATIONAL = (10, 'Vocational/technical school')

COLLEGE_2YEAR class-attribute instance-attribute

COLLEGE_2YEAR = (11, '2-year college')

COLLEGE_4YEAR class-attribute instance-attribute

COLLEGE_4YEAR = (12, '4-year college')

GRADUATE_SCHOOL class-attribute instance-attribute

GRADUATE_SCHOOL = (13, 'Graduate or professional school')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

OTHER class-attribute instance-attribute

OTHER = (997, 'Other')

Student

student value labels.

FULLTIME_INPERSON class-attribute instance-attribute

FULLTIME_INPERSON = (
    0,
    "Full-time student, currently attending some or all classes in-person",
)

PARTTIME_INPERSON class-attribute instance-attribute

PARTTIME_INPERSON = (
    1,
    "Part-time student, currently attending some or all classes in-person",
)

NONSTUDENT class-attribute instance-attribute

NONSTUDENT = (2, 'Not a student')

PARTTIME_ONLINE class-attribute instance-attribute

PARTTIME_ONLINE = (3, 'Part-time student, ONLY online classes')

FULLTIME_ONLINE class-attribute instance-attribute

FULLTIME_ONLINE = (4, 'Full-time student, ONLY online classes')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

CommuteFreq

commute and telework frequency value labels.

DAYS_6_7 class-attribute instance-attribute

DAYS_6_7 = (1, '6-7 days a week')

DAYS_5 class-attribute instance-attribute

DAYS_5 = (2, '5 days a week')

DAYS_4 class-attribute instance-attribute

DAYS_4 = (3, '4 days a week')

DAYS_3 class-attribute instance-attribute

DAYS_3 = (4, '3 days a week')

DAYS_2 class-attribute instance-attribute

DAYS_2 = (5, '2 days a week')

DAY_1 class-attribute instance-attribute

DAY_1 = (6, '1 day a week')

DAYS_1_3_PER_MONTH class-attribute instance-attribute

DAYS_1_3_PER_MONTH = (7, '1-3 days a month')

LESS_THAN_MONTHLY class-attribute instance-attribute

LESS_THAN_MONTHLY = (8, 'Less than monthly')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NEVER class-attribute instance-attribute

NEVER = (996, 'Never')

Vehicle

vehicle value labels.

HOUSEHOLD_VEHICLE_1 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_1 = (6, 'Household vehicle 1')

HOUSEHOLD_VEHICLE_2 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_2 = (7, 'Household vehicle 2')

HOUSEHOLD_VEHICLE_3 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_3 = (8, 'Household vehicle 3')

HOUSEHOLD_VEHICLE_4 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_4 = (9, 'Household vehicle 4')

HOUSEHOLD_VEHICLE_5 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_5 = (10, 'Household vehicle 5')

HOUSEHOLD_VEHICLE_6 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_6 = (11, 'Household vehicle 6')

HOUSEHOLD_VEHICLE_7 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_7 = (12, 'Household vehicle 7')

CARSHARE class-attribute instance-attribute

CARSHARE = (18, 'A carshare vehicle (e.g., ZipCar)')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NONE class-attribute instance-attribute

NONE = (996, 'None (I do not drive a vehicle)')

OTHER_VEHICLE class-attribute instance-attribute

OTHER_VEHICLE = (997, 'Other vehicle')

WorkParking

work_park value labels.

FREE class-attribute instance-attribute

FREE = (
    1,
    "Parking is always free at/near work, at park & ride, etc.",
)

EMPLOYER_PAYS_ALL class-attribute instance-attribute

EMPLOYER_PAYS_ALL = (2, 'Employer pays ALL parking costs (for me)')

EMPLOYER_DISCOUNT class-attribute instance-attribute

EMPLOYER_DISCOUNT = (
    3,
    "Employer offers discounted parking (I pay some)",
)

PERSONAL_PAY class-attribute instance-attribute

PERSONAL_PAY = (
    4,
    "I personally pay some or all parking costs (employer pays none)",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NOT_APPLICABLE class-attribute instance-attribute

NOT_APPLICABLE = (996, 'Not applicable (I never drive to work)')

DONT_KNOW class-attribute instance-attribute

DONT_KNOW = (998, "Don't know")

data_canon.codebook.trips

Codebook enumerations for trip table.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

Purpose

Base class for purpose value labels.

HOME class-attribute instance-attribute

HOME = (1, 'Went home')

WORK_VOLUNTEER class-attribute instance-attribute

WORK_VOLUNTEER = (
    2,
    "Went to work, work-related, volunteer-related",
)

SCHOOL class-attribute instance-attribute

SCHOOL = (3, 'Attended school/class')

SHOPPING_ERRANDS class-attribute instance-attribute

SHOPPING_ERRANDS = (
    4,
    "Appointment, shopping, or errands (e.g., gas)",
)

ESCORT class-attribute instance-attribute

ESCORT = (
    5,
    "Dropped off, picked up, or accompanied another person",
)

SOCIAL_LEISURE class-attribute instance-attribute

SOCIAL_LEISURE = (
    7,
    "Social, leisure, religious, entertainment activity",
)

PRIMARY_WORKPLACE class-attribute instance-attribute

PRIMARY_WORKPLACE = (10, 'Went to primary workplace')

WORK_ACTIVITY class-attribute instance-attribute

WORK_ACTIVITY = (
    11,
    "Went to work-related activity (e.g., meeting, delivery, worksite)",
)

WORK_TRAVEL class-attribute instance-attribute

WORK_TRAVEL = (12, 'Traveling for work (e.g., business trip)')

VOLUNTEERING class-attribute instance-attribute

VOLUNTEERING = (13, 'Volunteering')

OTHER_WORK class-attribute instance-attribute

OTHER_WORK = (14, 'Other work-related')

K12_SCHOOL class-attribute instance-attribute

K12_SCHOOL = (21, 'Attend K-12 school')

COLLEGE class-attribute instance-attribute

COLLEGE = (22, 'Attend college/university')

OTHER_CLASS class-attribute instance-attribute

OTHER_CLASS = (
    23,
    "Attend other type of class (e.g., cooking class)",
)

OTHER_EDUCATION class-attribute instance-attribute

OTHER_EDUCATION = (
    24,
    "Attend other education-related activity (e.g., field trip)",
)

VOCATIONAL class-attribute instance-attribute

VOCATIONAL = (25, 'Attend vocational education class')

DAYCARE class-attribute instance-attribute

DAYCARE = (26, 'Attend daycare or preschool')

GROCERY class-attribute instance-attribute

GROCERY = (30, 'Grocery shopping')

GAS class-attribute instance-attribute

GAS = (31, 'Got gas')

ROUTINE_SHOPPING class-attribute instance-attribute

ROUTINE_SHOPPING = (32, 'Other routine shopping (e.g., pharmacy)')

ERRAND_NO_APPT class-attribute instance-attribute

ERRAND_NO_APPT = (
    33,
    "Errand without appointment (e.g., post office)",
)

MEDICAL class-attribute instance-attribute

MEDICAL = (34, 'Medical visit (e.g., doctor, dentist)')

MAJOR_SHOPPING class-attribute instance-attribute

MAJOR_SHOPPING = (
    36,
    "Shopping for major item (e.g., furniture, car)",
)

ERRAND_WITH_APPT class-attribute instance-attribute

ERRAND_WITH_APPT = (37, 'Errand with appointment (e.g., haircut)')

ESCORT_CHILDCARE class-attribute instance-attribute

ESCORT_CHILDCARE = (40, 'To/from childcare or preschool')

ESCORT_SCHOOL class-attribute instance-attribute

ESCORT_SCHOOL = (41, 'To/from K-12 school or college')

ESCORT_WORK class-attribute instance-attribute

ESCORT_WORK = (
    42,
    "To/from other person's work or volunteer activity",
)

ESCORT_APT class-attribute instance-attribute

ESCORT_APT = (
    43,
    "To/from other person's scheduled activity (e.g., lesson, appointment)",
)

OTHER_ACTIVITY class-attribute instance-attribute

OTHER_ACTIVITY = (
    44,
    "Other activity only (e.g., attend meeting, pick-up or drop-off item)",
)

PICK_UP class-attribute instance-attribute

PICK_UP = (45, 'Pick someone up')

DROP_OFF class-attribute instance-attribute

DROP_OFF = (46, 'Drop someone off')

ACCOMPANY class-attribute instance-attribute

ACCOMPANY = (
    47,
    "Accompany someone only (e.g., go along for the ride)",
)

PICK_UP_AND_DROP_OFF class-attribute instance-attribute

PICK_UP_AND_DROP_OFF = (48, 'BOTH pick up AND drop off')

DINING class-attribute instance-attribute

DINING = (50, 'Dined out, got coffee, or take-out')

EXERCISE class-attribute instance-attribute

EXERCISE = (
    51,
    "Exercise or recreation (e.g., gym, jog, bike, walk dog)",
)

SOCIAL class-attribute instance-attribute

SOCIAL = (52, 'Social activity (e.g., visit friends/relatives)')

ENTERTAINMENT class-attribute instance-attribute

ENTERTAINMENT = (
    53,
    "Leisure/entertainment/cultural (e.g., cinema, museum, park)",
)

RELIGIOUS_CIVIC class-attribute instance-attribute

RELIGIOUS_CIVIC = (54, 'Religious/civic/volunteer activity')

VACATION class-attribute instance-attribute

VACATION = (55, 'Vacation or leisure trip')

FAMILY_ACTIVITY class-attribute instance-attribute

FAMILY_ACTIVITY = (56, "Family activity (e.g., watch child's game)")

MODE_CHANGE class-attribute instance-attribute

MODE_CHANGE = (
    60,
    "Changed or transferred mode (e.g., waited for bus or exited bus)",
)

OTHER_ERRAND class-attribute instance-attribute

OTHER_ERRAND = (61, 'Other errand')

OTHER_SOCIAL class-attribute instance-attribute

OTHER_SOCIAL = (62, 'Other social')

OTHER class-attribute instance-attribute

OTHER = (99, 'Other reason')

SPLIT_LOOP class-attribute instance-attribute

SPLIT_LOOP = (101, 'Split/loop trip')

OTHER_RESIDENCE class-attribute instance-attribute

OTHER_RESIDENCE = (
    150,
    "Went to another residence (e.g., someone else's home, second home)",
)

TEMP_LODGING class-attribute instance-attribute

TEMP_LODGING = (
    152,
    "Went to temporary lodging (e.g., hotel, vacation rental)",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

NOT_IMPUTABLE class-attribute instance-attribute

NOT_IMPUTABLE = (996, 'Not imputable')

PurposeCategory

Broad trip purpose groupings, used to categorize origin and destination purposes.

A coarser classification than Purpose, grouping detailed purpose codes into common categories for trip analysis and tour extraction. See PurposeToCategoryMap for the mapping from detailed purposes to these categories.

Used in:

HOME class-attribute instance-attribute

HOME = (1, 'Home')

WORK class-attribute instance-attribute

WORK = (2, 'Work')
WORK_RELATED = (3, 'Work related')

SCHOOL class-attribute instance-attribute

SCHOOL = (4, 'School')
SCHOOL_RELATED = (5, 'School related')

ESCORT class-attribute instance-attribute

ESCORT = (6, 'Escort')

SHOP class-attribute instance-attribute

SHOP = (7, 'Shop')

MEAL class-attribute instance-attribute

MEAL = (8, 'Meal')

SOCIALREC class-attribute instance-attribute

SOCIALREC = (9, 'Social or recreational')

ERRAND class-attribute instance-attribute

ERRAND = (10, 'Errand')

CHANGE_MODE class-attribute instance-attribute

CHANGE_MODE = (11, 'Change mode')

OVERNIGHT class-attribute instance-attribute

OVERNIGHT = (12, 'Overnight')

OTHER class-attribute instance-attribute

OTHER = (13, 'Other')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

NOT_IMPUTABLE class-attribute instance-attribute

NOT_IMPUTABLE = (996, 'Not imputable')

PurposeToCategoryMap

Mapping from detailed purpose codes to purpose categories.

PURPOSE_TO_CATEGORY class-attribute

PURPOSE_TO_CATEGORY: dict = {
    Purpose.HOME: PurposeCategory.HOME,
    Purpose.PRIMARY_WORKPLACE: PurposeCategory.WORK,
    Purpose.WORK_ACTIVITY: PurposeCategory.WORK_RELATED,
    Purpose.VOLUNTEERING: PurposeCategory.WORK_RELATED,
    Purpose.OTHER_WORK: PurposeCategory.WORK_RELATED,
    Purpose.WORK_VOLUNTEER: PurposeCategory.WORK_RELATED,
    Purpose.K12_SCHOOL: PurposeCategory.SCHOOL,
    Purpose.COLLEGE: PurposeCategory.SCHOOL,
    Purpose.DAYCARE: PurposeCategory.SCHOOL,
    Purpose.VOCATIONAL: PurposeCategory.SCHOOL,
    Purpose.OTHER_CLASS: PurposeCategory.SCHOOL_RELATED,
    Purpose.OTHER_EDUCATION: PurposeCategory.SCHOOL_RELATED,
    Purpose.SCHOOL: PurposeCategory.SCHOOL,
    Purpose.PICK_UP: PurposeCategory.ESCORT,
    Purpose.DROP_OFF: PurposeCategory.ESCORT,
    Purpose.ACCOMPANY: PurposeCategory.ESCORT,
    Purpose.PICK_UP_AND_DROP_OFF: PurposeCategory.ESCORT,
    Purpose.ESCORT: PurposeCategory.ESCORT,
    Purpose.GROCERY: PurposeCategory.SHOP,
    Purpose.ROUTINE_SHOPPING: PurposeCategory.SHOP,
    Purpose.MAJOR_SHOPPING: PurposeCategory.SHOP,
    Purpose.SHOPPING_ERRANDS: PurposeCategory.SHOP,
    Purpose.DINING: PurposeCategory.MEAL,
    Purpose.EXERCISE: PurposeCategory.SOCIALREC,
    Purpose.SOCIAL: PurposeCategory.SOCIALREC,
    Purpose.ENTERTAINMENT: PurposeCategory.SOCIALREC,
    Purpose.RELIGIOUS_CIVIC: PurposeCategory.SOCIALREC,
    Purpose.FAMILY_ACTIVITY: PurposeCategory.SOCIALREC,
    Purpose.SOCIAL_LEISURE: PurposeCategory.SOCIALREC,
    Purpose.OTHER_SOCIAL: PurposeCategory.SOCIALREC,
    Purpose.GAS: PurposeCategory.ERRAND,
    Purpose.ERRAND_NO_APPT: PurposeCategory.ERRAND,
    Purpose.MEDICAL: PurposeCategory.ERRAND,
    Purpose.ERRAND_WITH_APPT: PurposeCategory.ERRAND,
    Purpose.OTHER_ACTIVITY: PurposeCategory.ERRAND,
    Purpose.OTHER_ERRAND: PurposeCategory.ERRAND,
    Purpose.MODE_CHANGE: PurposeCategory.CHANGE_MODE,
    Purpose.OTHER_RESIDENCE: PurposeCategory.OVERNIGHT,
    Purpose.TEMP_LODGING: PurposeCategory.OVERNIGHT,
    Purpose.OTHER: PurposeCategory.OTHER,
    Purpose.MISSING: PurposeCategory.MISSING,
    Purpose.PNTA: PurposeCategory.PNTA,
    Purpose.NOT_IMPUTABLE: PurposeCategory.NOT_IMPUTABLE,
}

Driver

driver value labels.

DRIVER class-attribute instance-attribute

DRIVER = (1, 'Driver')

PASSENGER class-attribute instance-attribute

PASSENGER = (2, 'Passenger')

BOTH class-attribute instance-attribute

BOTH = (3, 'Both (switched drivers during trip)')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

Mode

mode value labels.

WALK class-attribute instance-attribute

WALK = (1, 'Walk/jog/wheelchair')

BIKE class-attribute instance-attribute

BIKE = (2, 'Standard bicycle (household)')

BIKE_BORROWED class-attribute instance-attribute

BIKE_BORROWED = (3, 'Borrowed bicycle')

BIKE_RENTED class-attribute instance-attribute

BIKE_RENTED = (4, 'Other rented bicycle')

OTHER class-attribute instance-attribute

OTHER = (5, 'Other')

HOUSEHOLD_VEHICLE_1 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_1 = (6, 'Household vehicle 1')

HOUSEHOLD_VEHICLE_2 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_2 = (7, 'Household vehicle 2')

HOUSEHOLD_VEHICLE_3 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_3 = (8, 'Household vehicle 3')

HOUSEHOLD_VEHICLE_4 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_4 = (9, 'Household vehicle 4')

HOUSEHOLD_VEHICLE_5 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_5 = (10, 'Household vehicle 5')

HOUSEHOLD_VEHICLE_6 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_6 = (11, 'Household vehicle 6')

HOUSEHOLD_VEHICLE_7 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_7 = (12, 'Household vehicle 7')

HOUSEHOLD_VEHICLE_8 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_8 = (13, 'Household vehicle 8')

HOUSEHOLD_VEHICLE_9 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_9 = (14, 'Household vehicle 9')

HOUSEHOLD_VEHICLE_10 class-attribute instance-attribute

HOUSEHOLD_VEHICLE_10 = (15, 'Household vehicle 10')

HOUSEHOLD_VEHICLE_OTHER class-attribute instance-attribute

HOUSEHOLD_VEHICLE_OTHER = (16, 'Other vehicle (household)')

CAR_RENTAL class-attribute instance-attribute

CAR_RENTAL = (17, 'Rental car')

CAR_SHARE class-attribute instance-attribute

CAR_SHARE = (18, 'Carshare (Zipcar, etc.)')

VANPOOL class-attribute instance-attribute

VANPOOL = (21, 'Vanpool')

OTHER_VEHICLE class-attribute instance-attribute

OTHER_VEHICLE = (22, 'Other vehicle (non-household)')

BUS_LOCAL class-attribute instance-attribute

BUS_LOCAL = (23, 'Local public bus')

BUS_SCHOOL class-attribute instance-attribute

BUS_SCHOOL = (24, 'School bus')

BUS_INTERCITY class-attribute instance-attribute

BUS_INTERCITY = (25, 'Intercity bus (Greyhound, etc.)')

BUS_PRIVATE class-attribute instance-attribute

BUS_PRIVATE = (26, 'Private shuttle/bus')

BUS_OTHER class-attribute instance-attribute

BUS_OTHER = (28, 'Other bus')

PARATRANSIT class-attribute instance-attribute

PARATRANSIT = (27, 'Paratransit/Dial-A-Ride')

BART class-attribute instance-attribute

BART = (30, 'BART')

AIR class-attribute instance-attribute

AIR = (31, 'Airplane/helicopter')

WATER class-attribute instance-attribute

WATER = (32, 'Boat/ferry/water taxi')

CAR_WORK class-attribute instance-attribute

CAR_WORK = (33, 'Work car')

CAR_FRIEND class-attribute instance-attribute

CAR_FRIEND = (34, 'Friend/relative/colleague car')

TAXI class-attribute instance-attribute

TAXI = (36, 'Regular taxi')

BUS_UNIVERSITY class-attribute instance-attribute

BUS_UNIVERSITY = (38, 'University/college shuttle')

LIGHT_RAIL class-attribute instance-attribute

LIGHT_RAIL = (39, 'Light rail')

RAIL_INTERCITY class-attribute instance-attribute

RAIL_INTERCITY = (
    41,
    "Intercity/commuter rail (ACE, Amtrak, Caltrain)",
)

RAIL_OTHER class-attribute instance-attribute

RAIL_OTHER = (42, 'Other rail')

SKATE class-attribute instance-attribute

SKATE = (43, 'Skateboard/rollerblade')

GOLF_CART class-attribute instance-attribute

GOLF_CART = (44, 'Golf cart')

ATV class-attribute instance-attribute

ATV = (45, 'ATV')

BUS_LOCAL_PUBLIC class-attribute instance-attribute

BUS_LOCAL_PUBLIC = (46, 'Local public bus')

MOTORCYCLE class-attribute instance-attribute

MOTORCYCLE = (47, 'Motorcycle (household)')

TNC class-attribute instance-attribute

TNC = (49, 'Rideshare (Uber, Lyft, etc.)')

MUNI_METRO class-attribute instance-attribute

MUNI_METRO = (53, 'MUNI Metro')

MOTORCYCLE_OTHER class-attribute instance-attribute

MOTORCYCLE_OTHER = (54, 'Motorcycle (non-household)')

BUS_EXPRESS class-attribute instance-attribute

BUS_EXPRESS = (55, 'Express/Transbay bus')

CAR_RENTAL_P2P class-attribute instance-attribute

CAR_RENTAL_P2P = (59, 'Peer-to-peer rental (Turo, etc.)')

TOWNCAR class-attribute instance-attribute

TOWNCAR = (60, 'Hired car (black car, limo)')

BUS_BRT class-attribute instance-attribute

BUS_BRT = (61, 'Rapid transit bus (BRT)')

BUS_WORK class-attribute instance-attribute

BUS_WORK = (62, 'Employer shuttle/bus')

MEDICAL class-attribute instance-attribute

MEDICAL = (63, 'Medical transportation')

UBER class-attribute instance-attribute

UBER = (64, 'Uber')

LYFT class-attribute instance-attribute

LYFT = (65, 'Lyft')

OTHER_TNC class-attribute instance-attribute

OTHER_TNC = (66, 'Other rideshare (not Uber/Lyft)')

BUS_PRIVATE_LOCAL class-attribute instance-attribute

BUS_PRIVATE_LOCAL = (67, 'Local private bus')

STREETCAR class-attribute instance-attribute

STREETCAR = (68, 'Cable car/streetcar')

BIKE_SHARE class-attribute instance-attribute

BIKE_SHARE = (69, 'Bike-share (standard)')

BIKE_SHARE_ELECTRIC class-attribute instance-attribute

BIKE_SHARE_ELECTRIC = (70, 'Bike-share (electric)')

SCOOTER_SHARE_ALT class-attribute instance-attribute

SCOOTER_SHARE_ALT = (71, 'Scooter-share')

MOPED_SHARE class-attribute instance-attribute

MOPED_SHARE = (73, 'Moped-share (Scoot, etc.)')

SEGWAY class-attribute instance-attribute

SEGWAY = (74, 'Segway')

OTHER_ALT class-attribute instance-attribute

OTHER_ALT = (75, 'Other')

CARPOOL_SERVICE class-attribute instance-attribute

CARPOOL_SERVICE = (76, 'Carpool match (Waze, etc.)')

MOPED class-attribute instance-attribute

MOPED = (77, 'Personal scooter/moped')

FERRY class-attribute instance-attribute

FERRY = (78, 'Ferry/water taxi')

BOAT class-attribute instance-attribute

BOAT = (80, 'Other boat (kayak, etc.)')

BIKE_ELECTRIC class-attribute instance-attribute

BIKE_ELECTRIC = (82, 'Electric bicycle (household)')

SCOOTER_SHARE class-attribute instance-attribute

SCOOTER_SHARE = (83, 'Scooter-share (Bird, Lime, etc.)')

HOUSEHOLD_VEHICLE class-attribute instance-attribute

HOUSEHOLD_VEHICLE = (100, 'Household vehicle/motorcycle')

CAR_OTHER class-attribute instance-attribute

CAR_OTHER = (101, 'Other vehicle (rental, carshare, etc.)')

SHUTTLE class-attribute instance-attribute

SHUTTLE = (102, 'Bus/shuttle/vanpool')

BICYCLE class-attribute instance-attribute

BICYCLE = (103, 'Bicycle')

OTHER_OTHER class-attribute instance-attribute

OTHER_OTHER = (104, 'Other')

RAIL class-attribute instance-attribute

RAIL = (105, 'Rail (train, BART, MUNI, etc.)')

TNC_OTHER class-attribute instance-attribute

TNC_OTHER = (106, 'Uber/Lyft/taxi/car service')

MICROMOBILITY class-attribute instance-attribute

MICROMOBILITY = (107, 'Micromobility (scooter, moped, etc.)')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER_UNKNOWN class-attribute instance-attribute

OTHER_UNKNOWN = (997, 'Other/Unknown')

ModeType

mode_type value labels.

WALK class-attribute instance-attribute

WALK = (1, 'Walk')

BIKE class-attribute instance-attribute

BIKE = (2, 'Bike')

BIKESHARE class-attribute instance-attribute

BIKESHARE = (3, 'Bikeshare')

SCOOTERSHARE class-attribute instance-attribute

SCOOTERSHARE = (4, 'Scootershare')

TAXI class-attribute instance-attribute

TAXI = (5, 'Taxi')

TNC class-attribute instance-attribute

TNC = (6, 'TNC')

OTHER class-attribute instance-attribute

OTHER = (7, 'Other')

CAR class-attribute instance-attribute

CAR = (8, 'Car')

CARSHARE class-attribute instance-attribute

CARSHARE = (9, 'Carshare')

SCHOOL_BUS class-attribute instance-attribute

SCHOOL_BUS = (10, 'School bus')

SHUTTLE class-attribute instance-attribute

SHUTTLE = (11, 'Shuttle/vanpool')

FERRY class-attribute instance-attribute

FERRY = (12, 'Ferry')

TRANSIT class-attribute instance-attribute

TRANSIT = (13, 'Transit')

LONG_DISTANCE class-attribute instance-attribute

LONG_DISTANCE = (14, 'Long distance passenger')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

AccessEgressMode

transit_access value labels.

WALK class-attribute instance-attribute

WALK = (1, 'Walked (or jogged/wheelchair)')

BICYCLE class-attribute instance-attribute

BICYCLE = (2, 'Bicycle')

TRANSFER_BUS class-attribute instance-attribute

TRANSFER_BUS = (3, 'Transferred from another bus')

MICROMOBILITY class-attribute instance-attribute

MICROMOBILITY = (
    4,
    "Micromobility (e.g., scooter, moped, skateboard)",
)

TRANSFER_OTHER class-attribute instance-attribute

TRANSFER_OTHER = (
    5,
    "Transferred from other transit (e.g., rail, air)",
)

TNC class-attribute instance-attribute

TNC = (6, 'Uber/Lyft, taxi, or car service')

CAR_HOUSEHOLD class-attribute instance-attribute

CAR_HOUSEHOLD = (
    7,
    "Drove and parked my own household's vehicle (or motorcycle)",
)

CAR_OTHER class-attribute instance-attribute

CAR_OTHER = (8, 'Drove and parked another vehicle (or motorcycle)')

DROPOFF_HOUSEHOLD class-attribute instance-attribute

DROPOFF_HOUSEHOLD = (
    9,
    "Got dropped off in my own household's vehicle (or motorcycle)",
)

DROPOFF_OTHER class-attribute instance-attribute

DROPOFF_OTHER = (
    10,
    "Got dropped off in another vehicle (or motorcycle)",
)

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER class-attribute instance-attribute

OTHER = (997, 'Other')

data_canon.codebook.tours

Tour building step for processing travel diary data.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

TourType

d_tour_type value labels.

HOME_BASED class-attribute instance-attribute

HOME_BASED = (1, 'Home-based tour')

WORK_BASED class-attribute instance-attribute

WORK_BASED = (2, 'Work-based tour')

PersonCategory

Simplified person categories for tour purpose prioritization.

WORKER class-attribute instance-attribute

WORKER = 'worker'

STUDENT class-attribute instance-attribute

STUDENT = 'student'

OTHER class-attribute instance-attribute

OTHER = 'other'

TourCategory

Tour boundary types.

COMPLETE class-attribute instance-attribute

COMPLETE = (1, 'Start at home, end at home')

PARTIAL_END class-attribute instance-attribute

PARTIAL_END = (2, 'Start at home, end not at home')

PARTIAL_START class-attribute instance-attribute

PARTIAL_START = (3, 'Start not at home, end at home')

PARTIAL_BOTH class-attribute instance-attribute

PARTIAL_BOTH = (4, 'Start not at home, end not at home')

TourDirection

Half-tour classification.

OUTBOUND class-attribute instance-attribute

OUTBOUND = (1, 'Outbound half-tour')

INBOUND class-attribute instance-attribute

INBOUND = (2, 'Inbound half-tour')

SUBTOUR class-attribute instance-attribute

SUBTOUR = (3, 'Subtour')

TourDataQuality

Tour data quality classification for validation and filtering.

VALID class-attribute instance-attribute

VALID = (0, 'Valid tour')

SINGLE_TRIP class-attribute instance-attribute

SINGLE_TRIP = (1, 'Single-trip tour')

LOOP_TRIP class-attribute instance-attribute

LOOP_TRIP = (2, 'Home-based loop trip')

MISSING_HOME_ANCHOR class-attribute instance-attribute

MISSING_HOME_ANCHOR = (3, 'No home anchor at either end of tour')

INDETERMINATE class-attribute instance-attribute

INDETERMINATE = (4, 'Invalid tour, cause unknown')

CHANGE_MODE class-attribute instance-attribute

CHANGE_MODE = (
    5,
    "Change mode as primary purpose (linking failure)",
)

data_canon.codebook.days

Codebook enumerations for day table.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

TravelDow

travel_dow value labels.

MONDAY class-attribute instance-attribute

MONDAY = (1, 'Monday')

TUESDAY class-attribute instance-attribute

TUESDAY = (2, 'Tuesday')

WEDNESDAY class-attribute instance-attribute

WEDNESDAY = (3, 'Wednesday')

THURSDAY class-attribute instance-attribute

THURSDAY = (4, 'Thursday')

FRIDAY class-attribute instance-attribute

FRIDAY = (5, 'Friday')

SATURDAY class-attribute instance-attribute

SATURDAY = (6, 'Saturday')

SUNDAY class-attribute instance-attribute

SUNDAY = (7, 'Sunday')

AttendSchool

attend_school value labels.

YES_USUAL class-attribute instance-attribute

YES_USUAL = (1, 'Yes, attend school at usual location')

NO_ANOTHER class-attribute instance-attribute

NO_ANOTHER = (2, 'Yes, attend school at another location')

NO class-attribute instance-attribute

NO = (3, 'No, do not attend school')

DONT_KNOW class-attribute instance-attribute

DONT_KNOW = (998, "Don't know")

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

NoSchoolReason

no_school_reason value labels.

SICK class-attribute instance-attribute

SICK = (1, 'Sick')

ONLINE_HOME class-attribute instance-attribute

ONLINE_HOME = (2, 'Online / at home')

ONLINE_OTHER class-attribute instance-attribute

ONLINE_OTHER = (3, 'Online / at other location')

VACATION class-attribute instance-attribute

VACATION = (4, 'Vacation')

CLOSED_SCHEDULED class-attribute instance-attribute

CLOSED_SCHEDULED = (5, 'Scheduled school closure (e.g., holiday)')

CLOSED_UNSCHEDULED class-attribute instance-attribute

CLOSED_UNSCHEDULED = (
    6,
    "Unscheduled school closure (e.g., weather)",
)

OTHER class-attribute instance-attribute

OTHER = (7, 'Other')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

DONT_KNOW class-attribute instance-attribute

DONT_KNOW = (998, "Don't know")

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

BeginEndDay

begin_day and end_day value labels.

HOME class-attribute instance-attribute

HOME = (1, 'Home')

SOMEONE_ELSES_HOME class-attribute instance-attribute

SOMEONE_ELSES_HOME = (2, "Someone else's home")

WORK class-attribute instance-attribute

WORK = (3, 'Work')

OTHER_HOME class-attribute instance-attribute

OTHER_HOME = (
    4,
    "Your/Their other home (e.g., other parent, second home)",
)

TRAVELING class-attribute instance-attribute

TRAVELING = (5, 'Traveling (e.g., red-eye flight)')

TEMPORARY class-attribute instance-attribute

TEMPORARY = (7, 'Temporary lodging (e.g., hotel, vacation rental)')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

OTHER class-attribute instance-attribute

OTHER = (997, 'Other')

Delivery

delivery value labels.

TAKEOUT class-attribute instance-attribute

TAKEOUT = (1, 'Take-out / prepared food delivery')

SERVICES class-attribute instance-attribute

SERVICES = (
    2,
    "Someone came to provide a service (e.g., cleaning, repair)",
)

GROCERIES class-attribute instance-attribute

GROCERIES = (3, 'Groceries / other goods delivery')

PACKAGE_HOME class-attribute instance-attribute

PACKAGE_HOME = (
    4,
    "Postal package delivery (e.g., USPS, FedEx, UPS)",
)

PACKAGE_OTHER class-attribute instance-attribute

PACKAGE_OTHER = (
    5,
    "Postal package delivery other location (e.g., Amazon locker)",
)

PACKAGE_WORK class-attribute instance-attribute

PACKAGE_WORK = (6, 'Postal package delivery work location')

OTHER_PACKAGE class-attribute instance-attribute

OTHER_PACKAGE = (
    7,
    "Other item delivery (e.g., furniture, appliance)",
)

OTHER_PACKAGE_WORK class-attribute instance-attribute

OTHER_PACKAGE_WORK = (8, 'Other item delivery work location')

NONE_OF_THE_ABOVE class-attribute instance-attribute

NONE_OF_THE_ABOVE = (9, 'None of the above')

MadeTravel

made_travel value labels.

YES class-attribute instance-attribute

YES = (1, 'Yes, made trips')

NO class-attribute instance-attribute

NO = (2, 'No, did not go anywhere or make trips')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

DONT_KNOW class-attribute instance-attribute

DONT_KNOW = (998, "Don't know")

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

NoTravelReason

no_travel_reason value labels.

DID_TRAVEL class-attribute instance-attribute

DID_TRAVEL = (0, 'I did make trips')

NOWORK class-attribute instance-attribute

NOWORK = (1, 'No work/school, took day off')

WFH class-attribute instance-attribute

WFH = (2, 'Worked from home (telework)')

HANGOUT class-attribute instance-attribute

HANGOUT = (3, 'Just hung out at home')

HOLIDAY class-attribute instance-attribute

HOLIDAY = (4, 'Scheduled school/work holiday')

NO_TRANSPORT class-attribute instance-attribute

NO_TRANSPORT = (5, 'No transportation available')

SICK class-attribute instance-attribute

SICK = (6, 'Sick or caring for sick household member')

DELIVERY class-attribute instance-attribute

DELIVERY = (7, 'Waiting for a delivery or service at home')

HOMESCHOOL class-attribute instance-attribute

HOMESCHOOL = (8, 'Remote learning / homeschooling')

WEATHER class-attribute instance-attribute

WEATHER = (9, 'Bad weather (e.g., snowstorm)')

DONT_KNOW class-attribute instance-attribute

DONT_KNOW = (998, "Person made trips but don't know when or where")

OTHER class-attribute instance-attribute

OTHER = (997, 'Other')

MISSING class-attribute instance-attribute

MISSING = (995, 'Missing Response')

PNTA class-attribute instance-attribute

PNTA = (999, 'Prefer not to answer')

Project/Format-specific

data_canon.codebook.daysim

Codebook enumerations for DaySim model format.

DaySim is an activity-based travel demand model that requires specific coding schemes. These enums define the output codes expected by DaySim.

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

DaysimMode

DaySim mode codes.

Mode hierarchy used by DaySim activity-based model.

OTHER class-attribute instance-attribute

OTHER = (0, 'Other')

WALK class-attribute instance-attribute

WALK = (1, 'Walk')

BIKE class-attribute instance-attribute

BIKE = (2, 'Bike')

SOV class-attribute instance-attribute

SOV = (3, 'Drive alone (SOV)')

HOV2 class-attribute instance-attribute

HOV2 = (4, 'Shared ride 2 (HOV2)')

HOV3 class-attribute instance-attribute

HOV3 = (5, 'Shared ride 3+ (HOV3+)')

WALK_TRANSIT class-attribute instance-attribute

WALK_TRANSIT = (6, 'Walk to transit')

DRIVE_TRANSIT class-attribute instance-attribute

DRIVE_TRANSIT = (7, 'Drive to transit')

SCHOOL_BUS class-attribute instance-attribute

SCHOOL_BUS = (8, 'School bus')

TNC class-attribute instance-attribute

TNC = (9, 'TNC (Uber/Lyft)')

DaysimPathType

DaySim path type codes.

Network and transit service type indicators.

NONE class-attribute instance-attribute

NONE = (0, 'None')

FULL_NETWORK class-attribute instance-attribute

FULL_NETWORK = (1, 'Full network')

NO_TOLL class-attribute instance-attribute

NO_TOLL = (2, 'No-toll network')

BUS class-attribute instance-attribute

BUS = (3, 'Bus')

LRT class-attribute instance-attribute

LRT = (4, 'Light rail')

PREMIUM class-attribute instance-attribute

PREMIUM = (5, 'Premium (commuter rail/express bus)')

BART class-attribute instance-attribute

BART = (6, 'BART')

FERRY class-attribute instance-attribute

FERRY = (7, 'Ferry')

DaysimDriverPassenger

DaySim driver/passenger/occupancy codes.

Indicates role in vehicle and TNC occupancy.

DRIVER class-attribute instance-attribute

DRIVER = (1, 'Driver')

PASSENGER class-attribute instance-attribute

PASSENGER = (2, 'Passenger')

NA class-attribute instance-attribute

NA = (3, 'N/A (non-auto mode)')

MISSING class-attribute instance-attribute

MISSING = (9, 'Missing (auto mode, unknown role)')

TNC_ALONE class-attribute instance-attribute

TNC_ALONE = (11, 'TNC alone')

TNC_2 class-attribute instance-attribute

TNC_2 = (12, 'TNC with 2 passengers')

TNC_3PLUS class-attribute instance-attribute

TNC_3PLUS = (13, 'TNC with 3+ passengers')

DaysimPurpose

DaySim purpose codes.

Activity purpose codes for trip ends.

HOME class-attribute instance-attribute

HOME = (0, 'Home')

WORK class-attribute instance-attribute

WORK = (1, 'Work')

SCHOOL class-attribute instance-attribute

SCHOOL = (2, 'School')

ESCORT class-attribute instance-attribute

ESCORT = (3, 'Escort')

PERSONAL_BUSINESS class-attribute instance-attribute

PERSONAL_BUSINESS = (4, 'Personal business')

SHOP class-attribute instance-attribute

SHOP = (5, 'Shop')

MEAL class-attribute instance-attribute

MEAL = (6, 'Meal')

SOCIAL_REC class-attribute instance-attribute

SOCIAL_REC = (7, 'Social/recreation')

CHANGE_MODE class-attribute instance-attribute

CHANGE_MODE = (8, 'Change mode')

OTHER class-attribute instance-attribute

OTHER = (9, 'Other')

DaysimGender

DaySim gender codes.

MALE class-attribute instance-attribute

MALE = (1, 'Male')

FEMALE class-attribute instance-attribute

FEMALE = (2, 'Female')

OTHER class-attribute instance-attribute

OTHER = (3, 'Other/non-binary')

MISSING class-attribute instance-attribute

MISSING = (9, 'Missing')

DaysimStudentType

DaySim student type codes.

NOT_STUDENT class-attribute instance-attribute

NOT_STUDENT = (0, 'Not a student')

FULL_TIME class-attribute instance-attribute

FULL_TIME = (1, 'Full-time student')

PART_TIME class-attribute instance-attribute

PART_TIME = (2, 'Part-time student')

MISSING class-attribute instance-attribute

MISSING = (-1, 'Missing')

DaysimWorkerType

DaySim worker type codes.

Employment status classification for persons.

NON_WORKER class-attribute instance-attribute

NON_WORKER = (0, 'Not a worker')

FULL_TIME_WORKER class-attribute instance-attribute

FULL_TIME_WORKER = (1, 'Full-time worker')

PART_TIME_WORKER class-attribute instance-attribute

PART_TIME_WORKER = (2, 'Part-time worker')

DaysimPaidParking

DaySim paid parking at work codes.

FREE class-attribute instance-attribute

FREE = (0, 'Free parking')

PAID class-attribute instance-attribute

PAID = (1, 'Paid parking')

MISSING class-attribute instance-attribute

MISSING = (-1, 'Missing/not applicable')

DaysimResidenceOwnership

DaySim residence ownership codes.

OWN class-attribute instance-attribute

OWN = (1, 'Own')

RENT class-attribute instance-attribute

RENT = (2, 'Rent')

OTHER class-attribute instance-attribute

OTHER = (3, 'Other')

MISSING class-attribute instance-attribute

MISSING = (-1, 'Missing')

DaysimResidenceType

DaySim residence type codes.

SINGLE_FAMILY class-attribute instance-attribute

SINGLE_FAMILY = (1, 'Single-family detached')

DUPLEX_TOWNHOUSE class-attribute instance-attribute

DUPLEX_TOWNHOUSE = (2, 'Duplex/triplex/townhouse')

APARTMENT class-attribute instance-attribute

APARTMENT = (3, 'Apartment/condo')

MOBILE_HOME class-attribute instance-attribute

MOBILE_HOME = (4, 'Mobile home/trailer')

DORM class-attribute instance-attribute

DORM = (5, 'Dorm/group quarters')

OTHER class-attribute instance-attribute

OTHER = (6, 'Other')

MISSING class-attribute instance-attribute

MISSING = (-1, 'Missing')

VehicleOccupancy

Vehicle occupancy thresholds for mode classification.

Used to classify auto trips into SOV, HOV2, and HOV3+ categories.

SOV class-attribute instance-attribute

SOV = (1, 'Single occupant vehicle (1 person)')

HOV2 class-attribute instance-attribute

HOV2 = (2, 'High occupancy vehicle 2 (2 people)')

HOV3_MIN class-attribute instance-attribute

HOV3_MIN = (2, 'Minimum occupancy for HOV3+ (>2 people)')

DaysimPersonType

DaySim person type codes.

Person type classification based on employment, student status, and age.

FULL_TIME_WORKER class-attribute instance-attribute

FULL_TIME_WORKER = (1, 'Full-time worker')

PART_TIME_WORKER class-attribute instance-attribute

PART_TIME_WORKER = (2, 'Part-time worker')

RETIRED class-attribute instance-attribute

RETIRED = (3, 'Retired (65+)')

NON_WORKER class-attribute instance-attribute

NON_WORKER = (4, 'Non-working adult')

UNIVERSITY_STUDENT class-attribute instance-attribute

UNIVERSITY_STUDENT = (5, 'University student')

CHILD_DRIVING_AGE class-attribute instance-attribute

CHILD_DRIVING_AGE = (6, 'High school student (16+)')

CHILD_NON_DRIVING_AGE class-attribute instance-attribute

CHILD_NON_DRIVING_AGE = (7, 'Child age 5-15')

CHILD_UNDER_5 class-attribute instance-attribute

CHILD_UNDER_5 = (8, 'Child age 0-4')

data_canon.codebook.ctramp

Codebook definitions for CT-RAMP related enumerations.

_INMF_ALTERNATIVES module-attribute

_INMF_ALTERNATIVES = build_alternatives(
    maxes={
        "escort": 2,
        "shopping": 1,
        "othmaint": 1,
        "othdiscr": 1,
        "eatout": 1,
        "social": 1,
    }
)

_INMF_REVERSE_LOOKUP module-attribute

_INMF_REVERSE_LOOKUP: dict[
    tuple[int, int, int, int, int, int], int
] = {
    (
        alt.escort,
        alt.shopping,
        alt.othmaint,
        alt.othdiscr,
        alt.eatout,
        alt.social,
    ): code
    for code, alt in (_INMF_ALTERNATIVES.items())
}

_INMF_MAXES module-attribute

_INMF_MAXES = {
    "escort": max(
        (alt.escort) for alt in (_INMF_ALTERNATIVES.values())
    ),
    "shopping": max(
        (alt.shopping) for alt in (_INMF_ALTERNATIVES.values())
    ),
    "othmaint": max(
        (alt.othmaint) for alt in (_INMF_ALTERNATIVES.values())
    ),
    "othdiscr": max(
        (alt.othdiscr) for alt in (_INMF_ALTERNATIVES.values())
    ),
    "eatout": max(
        (alt.eatout) for alt in (_INMF_ALTERNATIVES.values())
    ),
    "social": max(
        (alt.social) for alt in (_INMF_ALTERNATIVES.values())
    ),
}

__all__ module-attribute

__all__ = [
    "_INMF_ALTERNATIVES",
    "_INMF_MAXES",
    "_INMF_REVERSE_LOOKUP",
]

csv_alternatives module-attribute

csv_alternatives = load_alternatives_from_csv(
    "tests\\fixtures\\CTRAMP_IndividualNonMandatoryTourFrequencyAlternatives.csv"
)

py_alternatives module-attribute

py_alternatives = build_alternatives(
    maxes={
        "escort": 2,
        "shopping": 1,
        "othmaint": 1,
        "othdiscr": 1,
        "eatout": 1,
        "social": 1,
    }
)

bads module-attribute

bads = 0

alt_csv module-attribute

alt_csv = csv_alternatives.get(code)

alt_py module-attribute

alt_py = py_alternatives.get(code)

LabeledEnum

Base class for enumerations with values and labels.

Each enum member is defined as a tuple of (value, label): MEMBER_NAME = (1, "Descriptive Label") or MEMBER_NAME = ("some_string", "Descriptive Label")

The enum provides: - value: The integer or string value - label: The human-readable label - field_name: The canonical field name - description: The field description

Class Methods: - from_value(val): Look up an enum member by its value - from_label(label): Look up an enum member by its label - get_field_name(): Get the canonical field name for the enum - get_description(): Get the field description for the enum

Example

class Gender(LabeledEnum): canonical_field_name = "gender" field_description = "Respondent's gender identity"

MALE = (1, "Male")
FEMALE = (2, "Female")

member = Gender.MALE print(member.value) # 1 print(member.label) # "Male" print(member.field_name) # "gender" print(member.description) # "Respondent's gender identity"

found = Gender.from_value(1) # Returns Gender.MALE found = Gender.from_label("Female") # Returns Gender.FEMALE

CTRAMPEmploymentCategory

Enumeration for employment category.

FULL_TIME_EMPLOYED class-attribute instance-attribute

FULL_TIME_EMPLOYED = 'Full-time employed'

PART_TIME_EMPLOYED class-attribute instance-attribute

PART_TIME_EMPLOYED = 'Part-time employed'

NOT_EMPLOYED class-attribute instance-attribute

NOT_EMPLOYED = 'Not employed'

CTRAMPStudentCategory

Enumeration for student category.

COLLEGE_OR_HIGHER class-attribute instance-attribute

COLLEGE_OR_HIGHER = 'College or higher'

GRADE_OR_HIGH_SCHOOL class-attribute instance-attribute

GRADE_OR_HIGH_SCHOOL = 'Grade or high school'

NOT_STUDENT class-attribute instance-attribute

NOT_STUDENT = 'Not a student'

FreeParkingChoice

Enumeration for free parking choice categories.

PARK_FOR_FREE class-attribute instance-attribute

PARK_FOR_FREE = (1, 'park for free')

PAY_TO_PARK class-attribute instance-attribute

PAY_TO_PARK = (2, 'pay to park')

CTRAMPGender

Enumeration for CT-RAMP gender categories.

MALE class-attribute instance-attribute

MALE = ('m', 'Male')

FEMALE class-attribute instance-attribute

FEMALE = ('f', 'Female')

TourComposition

Enumeration for tour composition categories.

ADULTS_ONLY class-attribute instance-attribute

ADULTS_ONLY = (1, 'adults only')

CHILDREN_ONLY class-attribute instance-attribute

CHILDREN_ONLY = (2, 'children only')

ADULTS_AND_CHILDREN class-attribute instance-attribute

ADULTS_AND_CHILDREN = (3, 'adults and children')

WalkToTransitSubZone

Enumeration for walk-to-transit subzone categories.

CANNOT_WALK class-attribute instance-attribute

CANNOT_WALK = (0, 'cannot walk to transit')

SHORT_WALK class-attribute instance-attribute

SHORT_WALK = (1, 'short-walk')

LONG_WALK class-attribute instance-attribute

LONG_WALK = (2, 'long-walk')

CTRAMPPersonType

Enumeration for person type categories.

FULL_TIME_WORKER class-attribute instance-attribute

FULL_TIME_WORKER = (1, 'Full-time worker')

PART_TIME_WORKER class-attribute instance-attribute

PART_TIME_WORKER = (2, 'Part-time worker')

UNIVERSITY_STUDENT class-attribute instance-attribute

UNIVERSITY_STUDENT = (3, 'University student')

NON_WORKER class-attribute instance-attribute

NON_WORKER = (4, 'Nonworker')

RETIRED class-attribute instance-attribute

RETIRED = (5, 'Retired')

CHILD_NON_DRIVING_AGE class-attribute instance-attribute

CHILD_NON_DRIVING_AGE = (6, 'Child of non-driving age')

CHILD_DRIVING_AGE class-attribute instance-attribute

CHILD_DRIVING_AGE = (7, 'Child of driving age')

CHILD_UNDER_5 class-attribute instance-attribute

CHILD_UNDER_5 = (8, 'Child too young for school')

CTRAMPModeType

Enumeration for trip mode type categories.

DA class-attribute instance-attribute

DA = (1, 'Drive alone')

DA_TOLL class-attribute instance-attribute

DA_TOLL = (2, 'Drive alone - toll')

SR2 class-attribute instance-attribute

SR2 = (3, 'Shared ride 2')

SR2_TOLL class-attribute instance-attribute

SR2_TOLL = (4, 'Shared ride 2 - toll')

SR3 class-attribute instance-attribute

SR3 = (5, 'Shared ride 3+')

SR3_TOLL class-attribute instance-attribute

SR3_TOLL = (6, 'Shared ride 3+ - toll')

WALK class-attribute instance-attribute

WALK = (7, 'Walk')

BIKE class-attribute instance-attribute

BIKE = (8, 'Bike')

WLK_LOC_WLK class-attribute instance-attribute

WLK_LOC_WLK = (9, 'Walk to local bus')

WLK_LRF_WLK class-attribute instance-attribute

WLK_LRF_WLK = (10, 'Walk to light rail or ferry')

WLK_EXP_WLK class-attribute instance-attribute

WLK_EXP_WLK = (11, 'Walk to express bus')

WLK_HVY_WLK class-attribute instance-attribute

WLK_HVY_WLK = (12, 'Walk to heavy rail')

WLK_COM_WLK class-attribute instance-attribute

WLK_COM_WLK = (13, 'Walk to commuter rail')

DRV_LOC_WLK class-attribute instance-attribute

DRV_LOC_WLK = (14, 'Drive to local bus')

DRV_LRF_WLK class-attribute instance-attribute

DRV_LRF_WLK = (15, 'Drive to light rail or ferry')

DRV_EXP_WLK class-attribute instance-attribute

DRV_EXP_WLK = (16, 'Drive to express bus')

DRV_HVY_WLK class-attribute instance-attribute

DRV_HVY_WLK = (17, 'Drive to heavy rail')

DRV_COM_WLK class-attribute instance-attribute

DRV_COM_WLK = (18, 'Drive to commuter rail')

TAXI class-attribute instance-attribute

TAXI = (19, 'Taxi')

TNC class-attribute instance-attribute

TNC = (20, 'TNC - single party')

TNC2 class-attribute instance-attribute

TNC2 = (21, 'TNC - shared')

CTRAMPTourCategory

Enumeration for tour category.

MANDATORY class-attribute instance-attribute

MANDATORY = ('MANDATORY', 'Mandatory tour')

INDIVIDUAL_NON_MANDATORY class-attribute instance-attribute

INDIVIDUAL_NON_MANDATORY = (
    "NON_MANDATORY",
    "Individual non-mandatory tour",
)

JOINT_NON_MANDATORY class-attribute instance-attribute

JOINT_NON_MANDATORY = (
    "JOINT_NON_MANDATORY",
    "Joint non-mandatory tour",
)

AT_WORK class-attribute instance-attribute

AT_WORK = ('AT_WORK', 'At-work subtour')

CTRAMPActivityPattern

Enumeration for activity pattern.

MANDATORY class-attribute instance-attribute

MANDATORY = ('M', 'Mandatory')

NON_MANDATORY class-attribute instance-attribute

NON_MANDATORY = ('N', 'Non-mandatory')

HOME class-attribute instance-attribute

HOME = ('H', 'Home')

CTRAMPPurpose

Enumeration for tour purpose.

HOME class-attribute instance-attribute

HOME = ('Home', 'Home')

WORK_LOW class-attribute instance-attribute

WORK_LOW = ('work_low', 'Work - Low income')

WORK_MED class-attribute instance-attribute

WORK_MED = ('work_med', 'Work - Medium income')

WORK_HIGH class-attribute instance-attribute

WORK_HIGH = ('work_high', 'Work - High income')

WORK_VERY_HIGH class-attribute instance-attribute

WORK_VERY_HIGH = ('work_very high', 'Work - Very High income')

UNIVERSITY class-attribute instance-attribute

UNIVERSITY = ('university', 'University')

SCHOOL_HIGH class-attribute instance-attribute

SCHOOL_HIGH = ('school_high', 'School - High school')

SCHOOL_GRADE class-attribute instance-attribute

SCHOOL_GRADE = ('school_grade', 'School - Grade school')

ATWORK_BUSINESS class-attribute instance-attribute

ATWORK_BUSINESS = ('atwork_business', 'At-work - Business')

ATWORK_EAT class-attribute instance-attribute

ATWORK_EAT = ('atwork_eat', 'At-work - Eating')

ATWORK_MAINT class-attribute instance-attribute

ATWORK_MAINT = ('atwork_maint', 'At-work - Maintenance')

EATOUT class-attribute instance-attribute

EATOUT = ('eatout', 'Eating out')

ESCORT_KIDS class-attribute instance-attribute

ESCORT_KIDS = ('escort_kids', 'Escort - Kids')

ESCORT_NO_KIDS class-attribute instance-attribute

ESCORT_NO_KIDS = ('escort_no kids', 'Escort - No kids')

SHOPPING class-attribute instance-attribute

SHOPPING = ('shopping', 'Shopping')

SOCIAL class-attribute instance-attribute

SOCIAL = ('social', 'Social/recreational')

OTHMAINT class-attribute instance-attribute

OTHMAINT = ('othmaint', 'Other maintenance')

OTHDISCR class-attribute instance-attribute

OTHDISCR = ('othdiscr', 'Other discretionary')

JTFChoice

Enumeration for joint tour frequency choice categories.

NONE_PRE_SCHOOL_ONLY class-attribute instance-attribute

NONE_PRE_SCHOOL_ONLY = (
    -4,
    "no joint tours, only pre-school children leave household",
)

NONE_FEWER_THAN_2_LEAVE_HH class-attribute instance-attribute

NONE_FEWER_THAN_2_LEAVE_HH = (
    -3,
    "no joint tours, fewer than 2 people leave household",
)

NONE_SINGLE_PERSON_HH class-attribute instance-attribute

NONE_SINGLE_PERSON_HH = (-2, 'no joint tours, single person hh')

NONE_NONE class-attribute instance-attribute

NONE_NONE = (1, 'no joint tours')

ONE_SHOP class-attribute instance-attribute

ONE_SHOP = (2, '1 shop (S)')

ONE_MAINT class-attribute instance-attribute

ONE_MAINT = (3, '1 maintenance (M)')

ONE_EATOUT class-attribute instance-attribute

ONE_EATOUT = (4, '1 eating out (E)')

ONE_VISIT class-attribute instance-attribute

ONE_VISIT = (5, '1 visiting family/friends (V)')

ONE_DISCR class-attribute instance-attribute

ONE_DISCR = (6, '1 discretionary (D)')

TWO_SHOP class-attribute instance-attribute

TWO_SHOP = (7, '2 shop (SS)')

ONE_SHOP_ONE_MAINT class-attribute instance-attribute

ONE_SHOP_ONE_MAINT = (8, '1 shop, 1 maintenance (SM)')

ONE_SHOP_ONE_EATOUT class-attribute instance-attribute

ONE_SHOP_ONE_EATOUT = (9, '1 shop, 1 eating out (SE)')

ONE_SHOP_ONE_VISIT class-attribute instance-attribute

ONE_SHOP_ONE_VISIT = (10, '1 shop, 1 visit (SV)')

ONE_SHOP_ONE_DISCR class-attribute instance-attribute

ONE_SHOP_ONE_DISCR = (11, '1 shop, 1 discretionary (SD)')

TWO_MAINT class-attribute instance-attribute

TWO_MAINT = (12, '2 maintenance (MM)')

ONE_MAINT_ONE_EATOUT class-attribute instance-attribute

ONE_MAINT_ONE_EATOUT = (13, '1 maintenance, 1 eating out (ME)')

ONE_MAINT_ONE_VISIT class-attribute instance-attribute

ONE_MAINT_ONE_VISIT = (14, '1 maintenance, 1 visit (MV)')

ONE_MAINT_ONE_DISCR class-attribute instance-attribute

ONE_MAINT_ONE_DISCR = (15, '1 maintenance, 1 discretionary (MD)')

TWO_EATOUT class-attribute instance-attribute

TWO_EATOUT = (16, '2 eating out')

ONE_EATOUT_ONE_VISIT class-attribute instance-attribute

ONE_EATOUT_ONE_VISIT = (17, '1 eating out, 1 visit (EV)')

ONE_EATOUT_ONE_DISCR class-attribute instance-attribute

ONE_EATOUT_ONE_DISCR = (18, '1 eating out, 1 discretionary (ED)')

TWO_VISIT class-attribute instance-attribute

TWO_VISIT = (19, '2 visiting')

ONE_VISIT_ONE_DISCR class-attribute instance-attribute

ONE_VISIT_ONE_DISCR = (20, '1 visit, 1 discretionary')

TWO_DISCR class-attribute instance-attribute

TWO_DISCR = (21, '2 discretionary')

WFHChoice

Enumeration for work-from-home choice categories.

NON_WORKER_OR_NO_WFH class-attribute instance-attribute

NON_WORKER_OR_NO_WFH = (
    0,
    "non-worker or workers who don't work from home",
)

WORKS_FROM_HOME class-attribute instance-attribute

WORKS_FROM_HOME = (1, 'workers who work from home')

IMFChoice

Enumeration for individual mandatory tour frequency choice categories.

NONE class-attribute instance-attribute

NONE = (0, 'no mandatory tours')

ONE_WORK class-attribute instance-attribute

ONE_WORK = (1, 'one work tour')

TWO_WORK class-attribute instance-attribute

TWO_WORK = (2, 'two work tours')

ONE_SCHOOL class-attribute instance-attribute

ONE_SCHOOL = (3, 'one school tour')

TWO_SCHOOL class-attribute instance-attribute

TWO_SCHOOL = (4, 'two school tours')

ONE_WORK_ONE_SCHOOL class-attribute instance-attribute

ONE_WORK_ONE_SCHOOL = (5, 'one work tour and one school tour')

INMFAlternative dataclass

Data class representing an individual non-mandatory tour frequency alternative.

load_alternatives_from_csv

load_alternatives_from_csv(
    path: str | Path,
) -> dict[int, INMFAlternative]

Load alternatives from a CSV file.

build_alternatives

build_alternatives(
    *,
    sizes: dict[str, int] | None = None,
    maxes: dict[str, int] | None = None
) -> dict[int, INMFAlternative]

Build all combinations of alternatives.

Provide either: - sizes: mapping field -> number of levels (e.g. 2 for 0..1), OR - maxes: mapping field -> maximum value (inclusive), which will be converted to sizes by +1.

The iteration order matches the CSV with fields varying at these rates (slowest -> fastest): escort, shopping, othmaint, eatout, social, othdiscr.